diff --git a/CMakeLists.txt b/CMakeLists.txt index 3debfd523..f09305273 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -86,11 +86,6 @@ if(RDK_PGSQL_STATIC AND RDK_BUILD_PGSQL) endif(NOT RDK_INSTALL_STATIC_LIBS) endif() -if(RDK_USE_URF) - ADD_DEFINITIONS("-DRDK_USE_URF") - include_directories(${PROJECT_BINARY_DIR}/include) - link_directories(${PROJECT_BINARY_DIR}/lib) -endif() include(TestBigEndian) TEST_BIG_ENDIAN(RDK_BIG_ENDIAN) @@ -170,6 +165,10 @@ if(RDK_BUILD_COORDGEN_SUPPORT) include_directories(${RDKit_ExternalDir}) endif() +if(RDK_USE_URF) + ADD_DEFINITIONS("-DRDK_USE_URF") + include_directories(${RDKit_ExternalDir}/RingFamilies/RingDecomposerLib/src/RingDecomposerLib) +endif() if(CMAKE_SIZEOF_VOID_P MATCHES 4) diff --git a/Code/GraphMol/CMakeLists.txt b/Code/GraphMol/CMakeLists.txt index 1c338ad23..23e5d13b4 100644 --- a/Code/GraphMol/CMakeLists.txt +++ b/Code/GraphMol/CMakeLists.txt @@ -16,7 +16,7 @@ rdkit_library(GraphMol target_link_libraries(GraphMol PUBLIC ${RDKit_THREAD_LIBS}) if(RDK_USE_URF) - target_link_libraries(GraphMol PUBLIC URFLib) + target_link_libraries(GraphMol PUBLIC ${RDK_URF_LIBS}) endif() rdkit_headers(Atom.h diff --git a/Code/JavaWrappers/CMakeLists.txt b/Code/JavaWrappers/CMakeLists.txt index 49157e7e4..7291c415e 100644 --- a/Code/JavaWrappers/CMakeLists.txt +++ b/Code/JavaWrappers/CMakeLists.txt @@ -31,13 +31,13 @@ set(swigRDKitLibList "${swigRDKitLibList}" #if(RDK_BUILD_COORDGEN_SUPPORT) # set(swigRDKitLibList "${swigRDKitLibList};${RDK_COORDGEN_LIBS}") #endif(RDK_BUILD_COORDGEN_SUPPORT) +if(RDK_USE_URF) + set(swigRDKitLibList "${swigRDKitLibList};${RDK_URF_LIBS};") +endif(RDK_USE_URF) set(swigRDKitLibs "") foreach(swigRDKitLib ${swigRDKitLibList}) set(swigRDKitLibs "${swigRDKitLibs}${swigRDKitLib}${swigRDKitLibSuffix};") endforeach() -if(RDK_USE_URF) - set(swigRDKitLibs "${swigRDKitLibs};RingDecomposerLibStatic;") -endif(RDK_USE_URF) set(swigRDKitLibs "${swigRDKitLibs}${Boost_SERIALIZATION_LIBRARY};") if(RDK_USE_BOOST_IOSTREAMS) diff --git a/Code/PgSQL/rdkit/CMakeLists.txt b/Code/PgSQL/rdkit/CMakeLists.txt index a0d58221b..ee78d4f7c 100644 --- a/Code/PgSQL/rdkit/CMakeLists.txt +++ b/Code/PgSQL/rdkit/CMakeLists.txt @@ -115,12 +115,12 @@ set(pgRDKitLibList "${pgRDKitLibList}" "FileParsers;SmilesParse;Fingerprints;Subgraphs;Descriptors;" "PartialCharges;SubstructMatch;GraphMol;EigenSolvers;DataStructs;Depictor;" "RDGeometryLib;RDGeneral") +if(RDK_USE_URF) + set(pgRDKitLibList "${pgRDKitLibList};${RDK_URF_LIBS}") +endif(RDK_USE_URF) foreach(pgRDKitLib ${pgRDKitLibList}) set(pgRDKitLibs "${pgRDKitLibs}${pgRDKitLib}${pgRDKitLibSuffix};") endforeach() -if(RDK_USE_URF) - set(pgRDKitLibs "${pgRDKitLibs};RingDecomposerLibStatic") -endif(RDK_USE_URF) target_link_libraries(${EXTENSION}${EXTENSION_SUFFIX} ${pgRDKitLibs}) if(RDK_BUILD_THREADSAFE_SSS) target_link_libraries(${EXTENSION}${EXTENSION_SUFFIX} ${RDKit_THREAD_LIBS}) diff --git a/External/RingFamilies/CMakeLists.txt b/External/RingFamilies/CMakeLists.txt index 71ff7bc4d..4b1436f34 100644 --- a/External/RingFamilies/CMakeLists.txt +++ b/External/RingFamilies/CMakeLists.txt @@ -1,20 +1,35 @@ +add_custom_target(ringdecomposerlib_support ALL) + if(RDK_USE_URF) -include(ExternalProject) +if(NOT DEFINED URFLIB_DIR) + set(URFLIB_DIR "${CMAKE_CURRENT_SOURCE_DIR}/RingDecomposerLib/src/RingDecomposerLib") +endif() -ExternalProject_Add(RingDecomposerLib_project - GIT_REPOSITORY https://github.com/rareylab/RingDecomposerLib.git - GIT_TAG v1.1.3_rdkit - PATCH_COMMAND "" - PREFIX ${CMAKE_CURRENT_SOURCE_DIR} - SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/RingDecomposerLib" - CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${PROJECT_BINARY_DIR} - TEST_COMMAND "") +if(NOT EXISTS "${URFLIB_DIR}/RingDecomposerLib.h") + set(RELEASE_NO "1.1.3_rdkit") + set(MD5 "e9a0bcdda8b921a35e812b9888a9a874") + downloadAndCheckMD5("https://github.com/rareylab/RingDecomposerLib/archive/v${RELEASE_NO}.tar.gz" + "${CMAKE_CURRENT_SOURCE_DIR}/RingDecomposerLib-v${RELEASE_NO}.tar.gz" ${MD5}) + execute_process(COMMAND ${CMAKE_COMMAND} -E tar zxf + ${CMAKE_CURRENT_SOURCE_DIR}/RingDecomposerLib-v${RELEASE_NO}.tar.gz + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) + file(RENAME "RingDecomposerLib-${RELEASE_NO}" "RingDecomposerLib") +else() + message("-- Found RingDecomposerLib source in ${URFLIB_DIR}") +endif() -set(RDK_URF_LIBS RingDecomposerLibStatic - CACHE STRING "the external libraries" FORCE) +set(urflib_INCLUDE_DIRS ${URFLIB_DIR} + CACHE STRING "RingDecomposerLib Include Dir" FORCE) +file(GLOB URFSOURCES "${URFLIB_DIR}/*.c") -rdkit_library(URFLib URF.cpp SHARED LINK_LIBRARIES ${RDK_URF_LIBS} ) -add_dependencies(URFLib RingDecomposerLib_project) +rdkit_library(RingDecomposerLib ${URFSOURCES} SHARED) +install(TARGETS RingDecomposerLib DESTINATION ${RDKit_LibDir}) +rdkit_headers(${URFLIB_DIR}/RingDecomposerLib.h DEST "") + + +rdkit_library(URFLib URF.cpp SHARED LINK_LIBRARIES RingDecomposerLib ) +set(RDK_URF_LIBS URFLib RingDecomposerLib + CACHE STRING "the libraries for the URF calculation" FORCE) endif(RDK_USE_URF)