-
Notifications
You must be signed in to change notification settings - Fork 9
/
CMakeLists.txt
193 lines (169 loc) · 8.76 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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
## Project settings
#
cmake_minimum_required(VERSION 3.12)
project(privateer VERSION 0.5 LANGUAGES C CXX)
SET(PRIVATEER_CC_FLAGS "-g -O2 -w")
SET(PRIVATEER_CXX_FLAGS "-g -O2 -w")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${PRIVATEER_CC_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${PRIVATEER_CXX_FLAGS}")
option(BUILD_SHARED_LIBS "Build as a shared library" ON)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(THREADS_PREFER_PTHREAD_FLAG ON)
set(PRIVATEER_SOURCE_DIR ${CMAKE_SOURCE_DIR}/src/privateer)
set(PRIVATEERDATA ${CMAKE_SOURCE_DIR}/data)
set(CLIBDENV $ENV{CLIBD})
## Find Privateer's dependencies that have been compiled locally.
if (MODE STREQUAL "TESTING")
set (MMDB2DEP ${CMAKE_SOURCE_DIR}/privateer_dependencies/lib/libmmdb2.so)
set (CCP4CDEP ${CMAKE_SOURCE_DIR}/privateer_dependencies/lib/libccp4srs.so)
set (CCP4SRSDEP ${CMAKE_SOURCE_DIR}/privateer_dependencies/lib/libccp4c.so)
set (CLIPPERCOREDEP ${CMAKE_SOURCE_DIR}/privateer_dependencies/lib/libclipper-core.so)
set (CLIPPERMMDBDEP ${CMAKE_SOURCE_DIR}/privateer_dependencies/lib/libclipper-mmdb.so)
set (CLIPPERMINIMOLDEP ${CMAKE_SOURCE_DIR}/privateer_dependencies/lib/libclipper-minimol.so)
set (CLIPPERCONTRIBDEP ${CMAKE_SOURCE_DIR}/privateer_dependencies/lib/libclipper-contrib.so)
set (CLIPPERCCP4DEP ${CMAKE_SOURCE_DIR}/privateer_dependencies/lib/libclipper-ccp4.so)
set (CLIPPERCIFDEP ${CMAKE_SOURCE_DIR}/privateer_dependencies/lib/libclipper-cif.so)
else()
find_library(MMDB2DEP NAMES mmdb2
HINTS ${CMAKE_SOURCE_DIR}/dependencies/lib)
find_library(CCP4CDEP NAMES ccp4c
HINTS ${CMAKE_SOURCE_DIR}/dependencies/lib)
find_library(CCP4SRSDEP NAMES ccp4srs
HINTS ${CMAKE_SOURCE_DIR}/dependencies/lib)
find_library(CLIPPERCOREDEP NAMES clipper-core
HINTS ${CMAKE_SOURCE_DIR}/dependencies/lib)
find_library(CLIPPERMMDBDEP NAMES clipper-mmdb
HINTS ${CMAKE_SOURCE_DIR}/dependencies/lib)
find_library(CLIPPERMINIMOLDEP NAMES clipper-minimol
HINTS ${CMAKE_SOURCE_DIR}/dependencies/lib)
find_library(CLIPPERCONTRIBDEP NAMES clipper-contrib
HINTS ${CMAKE_SOURCE_DIR}/dependencies/lib)
find_library(CLIPPERCCP4DEP NAMES clipper-ccp4
HINTS ${CMAKE_SOURCE_DIR}/dependencies/lib)
find_library(CLIPPERCIFDEP NAMES clipper-cif
HINTS ${CMAKE_SOURCE_DIR}/dependencies/lib)
endif()
if (MODE STREQUAL "TESTING")
add_subdirectory(${CMAKE_SOURCE_DIR}/privateer_dependencies/pybind11)
else()
add_subdirectory(${CMAKE_SOURCE_DIR}/dependencies/pybind11)
endif()
find_package(Threads REQUIRED)
#Find Privateer's main.cpp file
set(PRIVATEER_SOURCE ${PRIVATEER_SOURCE_DIR}/cpp/privateer.cpp)
#Location of include files to be linked
if (MODE STREQUAL "TESTING")
include_directories(${CMAKE_SOURCE_DIR}/privateer_dependencies/include
${CMAKE_SOURCE_DIR}/privateer_dependencies/gemmi/include
${PYBIND11_INCLUDE_DIR}
${PYTHON_INCLUDE_DIRS}
${PRIVATEER_SOURCE_DIR}/cpp
${PRIVATEER_SOURCE_DIR}/cpp/pybind11)
else()
include_directories(${CMAKE_SOURCE_DIR}/dependencies/include
${CMAKE_SOURCE_DIR}/dependencies/gemmi/include
${PYBIND11_INCLUDE_DIR}
${PYTHON_INCLUDE_DIRS}
${PRIVATEER_SOURCE_DIR}/cpp
${PRIVATEER_SOURCE_DIR}/cpp/pybind11)
endif()
file(COPY ${PRIVATEERDATA}/glycomics/privateer_glycomics_database.json
DESTINATION ${CLIBDENV})
file(COPY ${PRIVATEERDATA}/linkage_torsions/privateer_torsion_database.json
DESTINATION ${CLIBDENV})
file(COPY ${PRIVATEERDATA}/linkage_torsions/privateer_torsions_z_score_database.json
DESTINATION ${CLIBDENV})
# Copy directories
add_custom_target(copy_resources ALL
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_SOURCE_DIR}/data
${CLIBDENV}/privateer_data
COMMENT "Copying Privateer Data files to ${CLIBDENV}/privateer_data")
add_library(privateer_lib
${PRIVATEER_SOURCE_DIR}/cpp/third-party/gemmi_compilation_unit.cpp
${PRIVATEER_SOURCE_DIR}/cpp/privateer-error.h
${PRIVATEER_SOURCE_DIR}/cpp/privateer-json.h
${PRIVATEER_SOURCE_DIR}/cpp/clipper-glyco.cpp
${PRIVATEER_SOURCE_DIR}/cpp/privateer-db.cpp
${PRIVATEER_SOURCE_DIR}/cpp/clipper-glyco_data.cpp
${PRIVATEER_SOURCE_DIR}/cpp/privateer-blobs.cpp
${PRIVATEER_SOURCE_DIR}/cpp/privateer-composition.cpp
${PRIVATEER_SOURCE_DIR}/cpp/privateer-dbquery.cpp
${PRIVATEER_SOURCE_DIR}/cpp/privateer-cryo_em.cpp
${PRIVATEER_SOURCE_DIR}/cpp/privateer-xray.cpp
${PRIVATEER_SOURCE_DIR}/cpp/privateer-modelling.cpp
${PRIVATEER_SOURCE_DIR}/cpp/privateer-interactions.cpp
${PRIVATEER_SOURCE_DIR}/cpp/privateer-lib.cpp
${PRIVATEER_SOURCE_DIR}/cpp/pybind11/privateer-pybind11.cpp
${PRIVATEER_SOURCE_DIR}/cpp/pybind11/privateer-ccp4mg.cpp
${PRIVATEER_SOURCE_DIR}/cpp/pybind11/privateer-restraints.cpp
${PRIVATEER_SOURCE_DIR}/cpp/pybind11/privateer-pyanalysis.cpp
${PRIVATEER_SOURCE_DIR}/cpp/pybind11/privateer-pymodelling.cpp)
target_link_libraries ( privateer_lib
${MMDB2DEP}
${CCP4CDEP}
${CCP4SRSDEP}
${CLIPPERCOREDEP}
${CLIPPERMMDBDEP}
${CLIPPERMINIMOLDEP}
${CLIPPERCONTRIBDEP}
${CLIPPERCCP4DEP}
${CLIPPERCIFDEP}
${PYTHON_LIBRARY}
Threads::Threads)
set_target_properties ( privateer_lib PROPERTIES OUTPUT_NAME privateer )
add_executable(privateer_exec
${PRIVATEER_SOURCE})
target_link_libraries ( privateer_exec
privateer_lib
${MMDB2DEP}
${CCP4CDEP}
${CCP4SRSDEP}
${CLIPPERCOREDEP}
${CLIPPERMMDBDEP}
${CLIPPERMINIMOLDEP}
${CLIPPERCONTRIBDEP}
${CLIPPERCCP4DEP}
${CLIPPERCIFDEP}
${PYTHON_LIBRARY}
Threads::Threads)
set_target_properties ( privateer_exec PROPERTIES OUTPUT_NAME privateer )
pybind11_add_module(privateer_core ${PRIVATEER_SOURCE_DIR}/cpp/pybind11/privateer-pybind11.cpp
${PRIVATEER_SOURCE_DIR}/cpp/pybind11/privateer-ccp4mg.cpp
${PRIVATEER_SOURCE_DIR}/cpp/pybind11/privateer-restraints.cpp
${PRIVATEER_SOURCE_DIR}/cpp/pybind11/privateer-pyanalysis.cpp
${PRIVATEER_SOURCE_DIR}/cpp/pybind11/privateer-pymodelling.cpp)
pybind11_add_module(privateer_modelling ${PRIVATEER_SOURCE_DIR}/cpp/pybind11/privateer-pybind11.cpp
${PRIVATEER_SOURCE_DIR}/cpp/pybind11/privateer-ccp4mg.cpp
${PRIVATEER_SOURCE_DIR}/cpp/pybind11/privateer-restraints.cpp
${PRIVATEER_SOURCE_DIR}/cpp/pybind11/privateer-pyanalysis.cpp
${PRIVATEER_SOURCE_DIR}/cpp/pybind11/privateer-pymodelling.cpp)
target_link_libraries ( privateer_core PRIVATE
privateer_lib
${MMDB2DEP}
${CCP4CDEP}
${CCP4SRSDEP}
${CLIPPERCOREDEP}
${CLIPPERMMDBDEP}
${CLIPPERMINIMOLDEP}
${CLIPPERCONTRIBDEP}
${CLIPPERCCP4DEP}
${CLIPPERCIFDEP}
${PYTHON_LIBRARY})
target_link_libraries ( privateer_modelling PRIVATE
privateer_lib
${MMDB2DEP}
${CCP4CDEP}
${CCP4SRSDEP}
${CLIPPERCOREDEP}
${CLIPPERMMDBDEP}
${CLIPPERMINIMOLDEP}
${CLIPPERCONTRIBDEP}
${CLIPPERCCP4DEP}
${CLIPPERCIFDEP}
${PYTHON_LIBRARY})
install ( TARGETS privateer_lib LIBRARY DESTINATION ${PROJECT_SOURCE_DIR})
install ( TARGETS privateer_exec DESTINATION ${PROJECT_SOURCE_DIR})
install ( TARGETS privateer_core DESTINATION ${PROJECT_SOURCE_DIR} )
install ( TARGETS privateer_modelling DESTINATION ${PROJECT_SOURCE_DIR} )