forked from AlanKerstjens/Molpert
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
79 lines (60 loc) · 2.06 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
cmake_minimum_required(VERSION 3.18)
# Define the project.
project(Molpert
LANGUAGES CXX
DESCRIPTION "Library for graph-based perturbation of RDKit molecules")
# Specify the C++ standard.
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED True)
# Define the directories where the source code can be found and where the
# compiled libraries/executables should be stored.
set(MOLPERT_SOURCE_DIR ${PROJECT_SOURCE_DIR}/source)
set(MOLPERT_LIB_DIR ${PROJECT_SOURCE_DIR}/lib)
# Include the library directory in the default RPATH of the targets.
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
set(CMAKE_INSTALL_RPATH ${MOLPERT_LIB_DIR})
# Search for the RDKit.
# If found this will also retrieve the Boost version used to build the RDKit.
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
find_package(RDKit REQUIRED)
# Define the library targets.
add_library(Molpert INTERFACE)
target_include_directories(Molpert INTERFACE
${MOLPERT_SOURCE_DIR}
${MOLPERT_SOURCE_DIR}/addons
${Boost_INCLUDE_DIRS}
${RDKit_INCLUDE_DIRS})
target_link_directories(Molpert INTERFACE
${Boost_LIBRARY_DIRS}
${RDKit_LIBRARY_DIRS})
target_link_libraries(Molpert INTERFACE
RDKitRDGeneral
RDKitGraphMol
RDKitFingerprints
RDKitSmilesParse)
# Enable conditional compilation of Python bindings
option(BUILD_PYTHON_BINDINGS "Enable Python binding compilation" ON)
if(BUILD_PYTHON_BINDINGS)
add_definitions(-DBUILD_PYTHON_BINDINGS)
find_package(Python REQUIRED COMPONENTS Interpreter Development)
find_package(Boost REQUIRED COMPONENTS python)
add_library(pyMolpert MODULE
${MOLPERT_SOURCE_DIR}/wrap/pyMolpert.cpp)
target_include_directories(pyMolpert PUBLIC
${MOLPERT_SOURCE_DIR}/wrap
${Python_INCLUDE_DIRS})
target_link_directories(pyMolpert PUBLIC
${Python_LIBRARY_DIRS})
target_link_libraries(pyMolpert PUBLIC
${Python_LIBRARIES}
Boost::python
Molpert)
set_target_properties(pyMolpert PROPERTIES
PREFIX ""
IMPORT_PREFIX ""
OUTPUT_NAME "molpert")
install(
TARGETS
pyMolpert
DESTINATION ${MOLPERT_LIB_DIR})
endif()