1
- cmake_minimum_required (VERSION 3.14 )
1
+ cmake_minimum_required (VERSION 3.16 )
2
2
3
3
project (RDKit )
4
4
@@ -71,7 +71,7 @@ option(RDK_BUILD_MINIMAL_LIB_RXN "build support for reactions into MinimalLib" O
71
71
option (RDK_BUILD_MINIMAL_LIB_SUBSTRUCTLIBRARY "build support for SubstructLibrary into MinimalLib" ON )
72
72
option (RDK_BUILD_MINIMAL_LIB_MCS "build support for MCS into MinimalLib" OFF )
73
73
74
- set (RDK_BOOST_VERSION "1.58 .0" )
74
+ set (RDK_BOOST_VERSION "1.70 .0" )
75
75
76
76
if (NOT MSVC )
77
77
if (RDK_OPTIMIZE_POPCNT )
@@ -150,7 +150,7 @@ set(RDKit_ExternalDir "${CMAKE_CURRENT_SOURCE_DIR}/External")
150
150
set (RDKit_DataDir "${CMAKE_CURRENT_SOURCE_DIR} /Data" )
151
151
152
152
#include catch
153
- find_package (Catch2 3 )
153
+ find_package (Catch2 3 QUIET )
154
154
if (NOT Catch2_FOUND )
155
155
Include (FetchContent )
156
156
@@ -290,59 +290,26 @@ if(RDK_BUILD_PYTHON_WRAPPERS)
290
290
291
291
#-------
292
292
# pull in python:
293
- find_package (PythonInterp )
294
- if (PYTHONINTERP_FOUND AND NOT Python_ADDITIONAL_VERSIONS )
295
- set (Python_ADDITIONAL_VERSIONS "${PYTHON_VERSION_MAJOR} .${PYTHON_VERSION_MINOR} " )
296
- endif (PYTHONINTERP_FOUND AND NOT Python_ADDITIONAL_VERSIONS )
297
-
298
- if (PYTHON_VERSION_MAJOR EQUAL 2 )
299
- message (FATAL_ERROR "ERROR: The RDKit no longer supports Python 2.\n If you have Python 3 installed, you can tell cmake where to find it using the -DPYTHON_EXECUTABLE argument." )
300
- endif ()
301
-
302
- find_package (PythonLibs )
303
- target_include_directories (rdkit_base INTERFACE ${PYTHON_INCLUDE_DIR} )
293
+ find_package (Python3 COMPONENTS Interpreter Development NumPy )
294
+ target_include_directories (rdkit_base INTERFACE ${Python3_INCLUDE_DIRS} )
295
+ target_include_directories (rdkit_base INTERFACE ${Python3_NumPy_INCLUDE_DIRS} )
304
296
305
297
# determine linkage of python
306
298
execute_process (
307
299
COMMAND
308
- ${PYTHON_EXECUTABLE } -c "import sysconfig; print(sysconfig.get_config_var('Py_ENABLE_SHARED'))"
300
+ ${Python3_EXECUTABLE } -c "import sysconfig; print(sysconfig.get_config_var('Py_ENABLE_SHARED'))"
309
301
OUTPUT_VARIABLE Py_ENABLE_SHARED
310
302
OUTPUT_STRIP_TRAILING_WHITESPACE
311
303
)
312
304
313
305
if (WIN32 OR "${Py_ENABLE_SHARED} " STREQUAL "1" )
314
- target_link_libraries (rdkit_py_base INTERFACE ${PYTHON_LIBRARIES} )
315
- endif ()
316
-
317
- find_package (NumPy REQUIRED )
318
- target_include_directories (rdkit_base INTERFACE ${PYTHON_NUMPY_INCLUDE_PATH} )
319
-
320
- if (PYTHON_VERSION_MAJOR EQUAL 3 )
321
- # Find boost-python3 using name specified as command line option then fall back to commonly used names
322
- set (RDK_BOOST_PYTHON3_NAME "python3" CACHE STRING "Name of the boost python3 library. If installed as libboost_python-xxx.so, use python-xxx." )
323
- list (APPEND Boost_Python_Names "${RDK_BOOST_PYTHON3_NAME} " "python-py3${PYTHON_VERSION_MINOR} " "python3" )
324
- endif (PYTHON_VERSION_MAJOR EQUAL 3 )
325
-
326
- # Boost 1.67+ uses a version suffix like "python36" or "python27"
327
- list (APPEND Boost_Python_Names "python${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR} " )
328
-
329
- # Try each potential boost-python name until one works
330
- foreach (Boost_Python_LibN ${Boost_Python_Names} )
331
- find_package (Boost ${RDK_BOOST_VERSION} COMPONENTS "${Boost_Python_LibN} " QUIET )
332
- if (Boost_FOUND )
333
- set (Boost_Python_Lib ${Boost_Python_LibN} )
334
- break ()
335
- endif ()
336
- endforeach ()
337
- # Finally just try "python" and hope it is a compatible version
338
- if (NOT Boost_FOUND )
339
- find_package (Boost ${RDK_BOOST_VERSION} COMPONENTS python REQUIRED )
340
- set (Boost_Python_Lib "python" )
306
+ target_link_libraries (rdkit_py_base INTERFACE ${Python3_LIBRARY} )
341
307
endif ()
342
308
343
- find_package (Boost COMPONENTS "numpy${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR} " REQUIRED )
309
+
310
+ find_package (Boost ${RDK_BOOST_VERSION} COMPONENTS "python${Python3_VERSION_MAJOR}${Python3_VERSION_MINOR} " "numpy${Python3_VERSION_MAJOR}${Python3_VERSION_MINOR} " REQUIRED CONFIG )
344
311
345
- target_link_libraries (rdkit_py_base INTERFACE Boost::${Boost_Python_Lib} "Boost::numpy${PYTHON_VERSION_MAJOR }${PYTHON_VERSION_MINOR } " )
312
+ target_link_libraries (rdkit_py_base INTERFACE " Boost::python ${Python3_VERSION_MAJOR}${Python3_VERSION_MINOR} " "Boost::numpy${Python3_VERSION_MAJOR }${Python3_VERSION_MINOR } " )
346
313
347
314
if (RDK_INSTALL_INTREE )
348
315
set (RDKit_PythonDir "${CMAKE_SOURCE_DIR} /rdkit" )
@@ -351,7 +318,7 @@ if(RDK_BUILD_PYTHON_WRAPPERS)
351
318
# Determine correct installation directory for Python bindings
352
319
execute_process (
353
320
COMMAND
354
- ${PYTHON_EXECUTABLE } -c "import sys; import sysconfig; \
321
+ ${Python3_EXECUTABLE } -c "import sys; import sysconfig; \
355
322
base_key = 'base' if sys.platform == 'win32' else 'platbase'; \
356
323
schema = 'nt' if sys.platform == 'win32' else 'posix_prefix'; \
357
324
print(sysconfig.get_path('platlib', schema, vars={base_key: '${CMAKE_INSTALL_PREFIX} '}))"
@@ -392,21 +359,20 @@ if(RDK_BUILD_PYTHON_WRAPPERS)
392
359
# We strip off the first word though (which will be the compiler name).
393
360
execute_process (
394
361
COMMAND
395
- ${PYTHON_EXECUTABLE } -c "import sysconfig; print(sysconfig.get_config_var('LDSHARED').lstrip().split(' ', 1)[1])"
362
+ ${Python3_EXECUTABLE } -c "import sysconfig; print(sysconfig.get_config_var('LDSHARED').lstrip().split(' ', 1)[1])"
396
363
OUTPUT_VARIABLE PYTHON_LDSHARED
397
364
OUTPUT_STRIP_TRAILING_WHITESPACE
398
365
)
399
- message ("PYTHON Py_ENABLE_SHARED: ${Py_ENABLE_SHARED} " )
400
- message ("PYTHON USING LINK LINE: ${PYTHON_LDSHARED} " )
401
366
endif ()
402
367
368
+
403
369
install (TARGETS rdkit_py_base EXPORT ${RDKit_EXPORTED_TARGETS}
404
370
COMPONENT dev )
405
371
406
372
# check to see if we can find nbval,
407
373
execute_process (
408
374
COMMAND
409
- ${PYTHON_EXECUTABLE } -c "import nbval"
375
+ ${Python3_EXECUTABLE } -c "import nbval"
410
376
ERROR_VARIABLE nbvalERR
411
377
OUTPUT_STRIP_TRAILING_WHITESPACE )
412
378
if (NOT nbvalERR )
@@ -416,7 +382,7 @@ if(RDK_BUILD_PYTHON_WRAPPERS)
416
382
endif ()
417
383
418
384
else (RDK_BUILD_PYTHON_WRAPPERS )
419
- find_package (Boost ${RDK_BOOST_VERSION} REQUIRED )
385
+ find_package (Boost ${RDK_BOOST_VERSION} REQUIRED CONFIG )
420
386
endif (RDK_BUILD_PYTHON_WRAPPERS )
421
387
422
388
find_package (Eigen3 )
@@ -452,7 +418,7 @@ else()
452
418
endif ()
453
419
454
420
if (RDK_USE_BOOST_SERIALIZATION )
455
- find_package (Boost ${RDK_BOOST_VERSION} COMPONENTS system serialization iostreams REQUIRED )
421
+ find_package (Boost ${RDK_BOOST_VERSION} COMPONENTS system serialization iostreams REQUIRED CONFIG )
456
422
target_link_libraries (rdkit_base INTERFACE ${Boost_LIBRARIES} )
457
423
target_compile_definitions (rdkit_base INTERFACE -DRDK_USE_BOOST_SERIALIZATION )
458
424
if (NOT Boost_USE_STATIC_LIBS )
@@ -462,7 +428,7 @@ endif()
462
428
463
429
if (RDK_USE_BOOST_IOSTREAMS )
464
430
target_compile_definitions (rdkit_base INTERFACE -DRDK_USE_BOOST_IOSTREAMS )
465
- find_package (Boost ${RDK_BOOST_VERSION} COMPONENTS system iostreams REQUIRED )
431
+ find_package (Boost ${RDK_BOOST_VERSION} COMPONENTS system iostreams REQUIRED CONFIG )
466
432
target_link_libraries (rdkit_base INTERFACE ${Boost_LIBRARIES} )
467
433
468
434
if (NOT Boost_USE_STATIC_LIBS )
@@ -471,7 +437,7 @@ if(RDK_USE_BOOST_IOSTREAMS)
471
437
472
438
# deal with zlib
473
439
if (WIN32 )
474
- find_package (Boost ${RDK_BOOST_VERSION} COMPONENTS zlib )
440
+ find_package (Boost ${RDK_BOOST_VERSION} COMPONENTS zlib CONFIG )
475
441
if (Boost_zlib_FOUND )
476
442
set (zlib_lib Boost::zlib )
477
443
endif ()
0 commit comments