Skip to content

Instantly share code, notes, and snippets.

@philopon
Created June 1, 2018 03:43
Show Gist options
  • Save philopon/c1329fec6bf30ef870df18f971a842d3 to your computer and use it in GitHub Desktop.
Save philopon/c1329fec6bf30ef870df18f971a842d3 to your computer and use it in GitHub Desktop.
rdkit-2018_03_1/boost-1.67
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 67257785..4f972afe 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -44,6 +44,7 @@ option(RDK_BUILD_DESCRIPTORS3D "Build the 3D descriptors calculators, requires E
option(RDK_BUILD_FREESASA_SUPPORT "build the rdkit freesasa wrapper" OFF )
option(RDK_BUILD_COORDGEN_SUPPORT "build the rdkit coordgen wrapper" ON )
option(RDK_BUILD_MOLINTERCHANGE_SUPPORT "build in support for CommonChem molecule interchange" ON )
+option(RDK_INSTALL_DEV_COMPONENT "install libraries and headers" ON)
if(NOT MSVC)
if(RDK_OPTIMIZE_NATIVE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mpopcnt")
@@ -62,6 +63,9 @@ if(RDK_SWIG_STATIC AND RDK_BUILD_SWIG_WRAPPERS)
endif(NOT RDK_INSTALL_STATIC_LIBS)
endif()
+if(RDK_INSTALL_DYNAMIC_LIBS)
+ add_definitions(-DRDKIT_DYN_LINK)
+endif()
if(RDK_PGSQL_STATIC AND RDK_BUILD_PGSQL)
if(NOT RDK_INSTALL_STATIC_LIBS)
@@ -83,10 +87,15 @@ set(RDK_PYTHON_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/rdkit")
#-------
# Config variables:
set(RDKit_Year "2018")
-set(RDKit_Month "03")
+set(RDKit_Month "09")
set(RDKit_Revision "1")
+set(RDKit_RevisionModifier "dev1")
set(RDKit_ABI "1")
+# we need an integer version of the month later, so remove the zero padding
+# if there is any
+string(REGEX REPLACE "^0" "" RDKit_intMonth ${RDKit_Month} )
+
set(RDKit_CodeDir "${CMAKE_CURRENT_SOURCE_DIR}/Code")
set(RDKit_ExternalDir "${CMAKE_CURRENT_SOURCE_DIR}/External")
@@ -181,23 +190,25 @@ if(RDK_BUILD_PYTHON_WRAPPERS)
if(PYTHON_VERSION_MAJOR EQUAL 3)
# Find boost-python3 using name specified as command line option then fall back to commonly used names
set(RDK_BOOST_PYTHON3_NAME "python3" CACHE STRING "Name of the boost python3 library. If installed as libboost_python-xxx.so, use python-xxx.")
- foreach(Boost_Python_Lib "${RDK_BOOST_PYTHON3_NAME}" "python-py3${PYTHON_VERSION_MINOR}" "python3")
- find_package(Boost 1.56.0 COMPONENTS "${Boost_Python_Lib}" QUIET)
- if(Boost_FOUND)
- list(APPEND Boost_IMPORTED_LIBRARIES "Boost::${Boost_Python_Lib}")
- break()
- endif()
- endforeach()
- # If boost-python3 not found, just find boost-python and hope that it is compatible with python3
- if(NOT Boost_FOUND)
- find_package(Boost 1.56.0 COMPONENTS python REQUIRED)
- list(APPEND Boost_IMPORTED_LIBRARIES "Boost::python")
- endif()
- else(PYTHON_VERSION_MAJOR EQUAL 3)
- find_package(Boost 1.56.0 COMPONENTS python REQUIRED)
- list(APPEND Boost_IMPORTED_LIBRARIES "Boost::python")
+ list(APPEND Boost_Python_Names "${RDK_BOOST_PYTHON3_NAME}" "python-py3${PYTHON_VERSION_MINOR}" "python3")
endif(PYTHON_VERSION_MAJOR EQUAL 3)
+ # Boost 1.67+ uses a version suffix like "python36" or "python27"
+ list(APPEND Boost_Python_Names "python${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR}")
+
+ # Try each potential boost-python name until one works
+ foreach(Boost_Python_Lib ${Boost_Python_Names})
+ find_package(Boost 1.56.0 COMPONENTS "${Boost_Python_Lib}" QUIET)
+ if(Boost_FOUND)
+ break()
+ endif()
+ endforeach()
+
+ # Finally just try "python" and hope it is a compatible version
+ if(NOT Boost_FOUND)
+ find_package(Boost 1.56.0 COMPONENTS python REQUIRED)
+ endif()
+
if(RDK_INSTALL_INTREE)
set(RDKit_PythonDir "${CMAKE_SOURCE_DIR}/rdkit")
@@ -262,15 +273,6 @@ else(RDK_BUILD_PYTHON_WRAPPERS)
find_package(Boost 1.56.0 REQUIRED)
endif(RDK_BUILD_PYTHON_WRAPPERS)
-# set the boost include directories
-target_link_libraries(rdkit_base INTERFACE Boost::boost)
-
-target_include_directories(rdkit_base INTERFACE
- $<BUILD_INTERFACE:${RDKit_CodeDir}>
- $<INSTALL_INTERFACE:${RDKit_HdrDir}>
- )
-
-
# Detect clang, which masquerades as gcc. CMake 2.6 doesn't know how to
# detect it.
string(REGEX MATCH "clang" CMAKE_COMPILER_IS_CLANG "${CMAKE_C_COMPILER}")
@@ -302,12 +304,23 @@ else()
endif()
if(RDK_USE_BOOST_SERIALIZATION)
+ set(T_LIBS ${Boost_LIBRARIES})
find_package(Boost 1.56.0 COMPONENTS serialization)
if (Boost_SERIALIZATION_LIBRARY)
- list(APPEND Boost_IMPORTED_LIBRARIES "Boost::serialization")
+ set(Boost_LIBRARIES ${T_LIBS} ${Boost_LIBRARIES})
endif()
endif()
+
+# set the boost include directories and linkage:
+target_include_directories(rdkit_base INTERFACE
+ $<BUILD_INTERFACE:${RDKit_CodeDir}>
+ $<INSTALL_INTERFACE:${RDKit_HdrDir}>
+ ${Boost_INCLUDE_DIR}
+ )
+target_link_libraries(rdkit_base INTERFACE ${BOOST_LIBRARIES})
+
+
if(RDK_BUILD_PGSQL)
find_package(PostgreSQL REQUIRED)
endif(RDK_BUILD_PGSQL)
@@ -455,7 +468,7 @@ SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README")
SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/license.txt")
SET(CPACK_PACKAGE_VERSION_MAJOR ${RDKit_Year})
SET(CPACK_PACKAGE_VERSION_MINOR ${RDKit_Month})
-SET(CPACK_PACKAGE_VERSION_PATCH ${RDKit_Revision})
+SET(CPACK_PACKAGE_VERSION_PATCH ${RDKit_Revision}${RDKit_RevisionModifier})
SET(CPACK_PACKAGE_INSTALL_DIRECTORY "CMake ${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}")
#IF(WIN32 AND NOT UNIX)
# # There is a bug in NSI that does not handle full unix paths properly. Make
@philopon
Copy link
Author

philopon commented Jun 1, 2018

git diff Release_2018_03_1..738fc041629913a2d5b0352766f8b66b38679316 CMakeLists.txt

の結果そのままペーストしただけ。

patch -p1 < CMakeLists.patch

で当たる

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment