-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCMakeLists.txt
119 lines (94 loc) · 3.53 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
cmake_minimum_required(VERSION 3.18)
# Define the project.
project(MoleculeAutoCorrect
LANGUAGES CXX
DESCRIPTION "Library for molecular graph correction")
# 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(MOLECULEAUTOCORRECT_SOURCE_DIR ${PROJECT_SOURCE_DIR}/source)
set(MOLECULEAUTOCORRECT_BIN_DIR ${PROJECT_SOURCE_DIR}/bin)
set(MOLECULEAUTOCORRECT_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 ${MOLECULEAUTOCORRECT_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)
# Check that Molpert was found.
# It's the responsibility of the user to specify its location.
if(NOT DEFINED Molpert_INCLUDE_DIRS OR NOT IS_DIRECTORY ${Molpert_INCLUDE_DIRS})
message(FATAL_ERROR "Variable Molpert_INCLUDE_DIRS (=\"${Molpert_INCLUDE_DIRS}\") is not set or doesn't specify a valid directory.")
else()
set(Molpert_FOUND True)
endif()
# The RDKit may have been compiled without Boost.Serialization support.
# Ensure we have Boost.Serialization.
find_package(Boost REQUIRED COMPONENTS serialization)
include_directories(
${Boost_INCLUDE_DIRS}
${RDKit_INCLUDE_DIRS}
${Molpert_INCLUDE_DIRS}
${MOLECULEAUTOCORRECT_SOURCE_DIR})
link_directories(
${Boost_LIBRARY_DIRS}
${RDKit_LIBRARY_DIRS})
# Define the library targets.
add_library(MoleculeAutoCorrect INTERFACE)
target_link_libraries(MoleculeAutoCorrect INTERFACE
Boost::serialization
RDKitRDGeneral
RDKitGraphMol
RDKitFingerprints
RDKitSmilesParse)
option(BUILD_PYTHON_BINDINGS "Enable Python binding compilation" ON)
if (BUILD_PYTHON_BINDINGS)
find_package(Python REQUIRED COMPONENTS Interpreter Development)
find_package(Boost REQUIRED COMPONENTS python)
add_library(pyMoleculeAutoCorrect MODULE
${MOLECULEAUTOCORRECT_SOURCE_DIR}/wrap/pyMoleculeAutoCorrect.cpp)
target_include_directories(pyMoleculeAutoCorrect PUBLIC
${Molpert_INCLUDE_DIRS}/wrap
${MOLECULEAUTOCORRECT_SOURCE_DIR}/wrap
${Python_INCLUDE_DIRS})
target_link_directories(pyMoleculeAutoCorrect PUBLIC
${Python_LIBRARY_DIRS})
target_link_libraries(pyMoleculeAutoCorrect PUBLIC
${Python_LIBRARIES}
Boost::python
MoleculeAutoCorrect)
set_target_properties(pyMoleculeAutoCorrect PROPERTIES
PREFIX ""
IMPORT_PREFIX ""
OUTPUT_NAME "MoleculeAutoCorrect")
install(
TARGETS
pyMoleculeAutoCorrect
DESTINATION ${MOLECULEAUTOCORRECT_LIB_DIR})
endif()
# Define the executable targets
add_executable(AutoCorrectMolecule
${MOLECULEAUTOCORRECT_SOURCE_DIR}/AutoCorrectMolecule.cpp)
target_link_libraries(AutoCorrectMolecule PRIVATE
MoleculeAutoCorrect)
add_executable(MakeChemicalDictionary
${MOLECULEAUTOCORRECT_SOURCE_DIR}/MakeChemicalDictionary.cpp)
target_link_libraries(MakeChemicalDictionary PRIVATE
MoleculeAutoCorrect
RDKitFileParsers)
add_executable(HighlightMoleculeErrors
${MOLECULEAUTOCORRECT_SOURCE_DIR}/HighlightMoleculeErrors.cpp)
target_link_libraries(HighlightMoleculeErrors PRIVATE
MoleculeAutoCorrect
RDKitDepictor
RDKitMolDraw2D)
# Specify where the executables should be installed.
install(
TARGETS
AutoCorrectMolecule
MakeChemicalDictionary
HighlightMoleculeErrors
DESTINATION ${MOLECULEAUTOCORRECT_BIN_DIR})