-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
312 lines (248 loc) · 9.22 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
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
cmake_minimum_required(VERSION 3.5.0 FATAL_ERROR) #CPACK_DEBIAN_<COMPONENT>_PACKAGE_NAME
find_package(IRODS 4.2.11 EXACT REQUIRED)
set(CMAKE_C_COMPILER ${IRODS_EXTERNALS_FULLPATH_CLANG}/bin/clang)
set(CMAKE_CXX_COMPILER ${IRODS_EXTERNALS_FULLPATH_CLANG}/bin/clang++)
project(irods-microservice-hydroshare C CXX)
if (NOT CMAKE_INSTALL_PREFIX)
set(CMAKE_INSTALL_PREFIX "/" CACHE STRING "Install root path. Change from \"/\" for run-in-place installations." FORCE)
message(STATUS "Setting unspecified CMAKE_INSTALL_PREFIX to '${CMAKE_INSTALL_PREFIX}'. This is the correct setting for normal builds.")
endif()
if (NOT CPACK_PACKAGING_INSTALL_PREFIX)
set(CPACK_PACKAGING_INSTALL_PREFIX "/" CACHE STRING "Package root path. \"/\" is correct for normal package builds.." FORCE)
message(STATUS "Setting unspecified CPACK_PACKAGING_INSTALL_PREFIX to '${CPACK_PACKAGING_INSTALL_PREFIX}'. This is the correct setting for normal builds.")
endif()
if (NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build {Debug, Release}." FORCE)
message(STATUS "Setting unspecified CMAKE_BUILD_TYPE to '${CMAKE_BUILD_TYPE}'")
endif()
if (NOT IRODS_EXTERNALS_PACKAGE_ROOT)
set(IRODS_EXTERNALS_PACKAGE_ROOT "/opt/irods-externals" CACHE STRING "Choose the location of iRODS external packages." FORCE)
message(STATUS "Setting unspecified IRODS_EXTERNALS_PACKAGE_ROOT to '${IRODS_EXTERNALS_PACKAGE_ROOT}'")
endif()
macro(IRODS_MACRO_SET_AND_CHECK_DEPENDENCY_FULL_PATH DEPENDENCY_NAME DEPENDENCY_SUBDIRECTORY)
if (NOT IS_DIRECTORY ${IRODS_EXTERNALS_PACKAGE_ROOT}/${DEPENDENCY_SUBDIRECTORY})
message(FATAL_ERROR "${DEPENDENCY_NAME} not found at ${IRODS_EXTERNALS_PACKAGE_ROOT}/${DEPENDENCY_SUBDIRECTORY}")
endif()
set(IRODS_EXTERNALS_FULLPATH_${DEPENDENCY_NAME} ${IRODS_EXTERNALS_PACKAGE_ROOT}/${DEPENDENCY_SUBDIRECTORY})
endmacro()
set(CMAKE_C_COMPILER ${IRODS_EXTERNALS_FULLPATH_CLANG}/bin/clang)
set(CMAKE_CXX_COMPILER ${IRODS_EXTERNALS_FULLPATH_CLANG}/bin/clang++)
find_package(OpenSSL REQUIRED)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -stdlib=libc++")
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -stdlib=libc++")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -stdlib=libc++")
add_compile_options(-nostdinc++)
add_compile_options(-std=c++14)
link_libraries(
"-Wl,-rpath=${IRODS_EXTERNALS_FULLPATH_CLANG_RUNTIME}/lib"
"-Wl,-rpath=${IRODS_EXTERNALS_FULLPATH_FMT}/lib"
${IRODS_EXTERNALS_FULLPATH_FMT}/lib/libfmt.so
c++abi)
include_directories(
${IRODS_EXTERNALS_FULLPATH_CLANG}/include/c++/v1
${IRODS_EXTERNALS_FULLPATH_FMT}/include)
set(
IRODS_AUDIT_PLUGIN_LOCKING_SERVER_COMPILE_DEFINITIONS
RODS_SERVER
ENABLE_RE
)
set(
IRODS_AUDIT_PLUGIN_LOCKING_SERVER_LINK_LIBRARIES
irods_server
irods_clerver
)
install(FILES hydroshare.re DESTINATION /etc/irods/)
set(
PLUGIN1
msiHSAddNewFile
)
add_library(
${PLUGIN1}
MODULE
${CMAKE_SOURCE_DIR}/src/lib-msiHSAddNewFile.cpp
)
target_include_directories(
${PLUGIN1}
PRIVATE
/usr/include/irods
${IRODS_EXTERNALS_FULLPATH_BOOST}/include
${IRODS_EXTERNALS_FULLPATH_JSON}/include
)
target_link_libraries(
${PLUGIN1}
PRIVATE
${OPENSSL_CRYPTO_LIBRARY}
curl
)
target_compile_definitions(${PLUGIN1} PRIVATE ${IRODS_AUDIT_PLUGIN_LOCKING_SERVER_COMPILE_DEFINITIONS} ${IRODS_COMPILE_DEFINITIONS} BOOST_SYSTEM_NO_DEPRECATED)
target_compile_options(${PLUGIN1} PRIVATE -Wno-write-strings)
set_property(TARGET ${PLUGIN1} PROPERTY CXX_STANDARD ${IRODS_CXX_STANDARD})
install(
TARGETS
${PLUGIN1}
LIBRARY
DESTINATION usr/lib/irods/plugins/microservices
)
set(
PLUGIN2
msiHSRemoveFile
)
add_library(
${PLUGIN2}
MODULE
${CMAKE_SOURCE_DIR}/src/lib-msiHSRemoveFile.cpp
)
target_include_directories(
${PLUGIN2}
PRIVATE
/usr/include/irods
${IRODS_EXTERNALS_FULLPATH_BOOST}/include
${IRODS_EXTERNALS_FULLPATH_JSON}/include
)
target_link_libraries(
${PLUGIN2}
PRIVATE
${OPENSSL_CRYPTO_LIBRARY}
curl
)
target_compile_definitions(${PLUGIN2} PRIVATE ${IRODS_AUDIT_PLUGIN_LOCKING_SERVER_COMPILE_DEFINITIONS} ${IRODS_COMPILE_DEFINITIONS} BOOST_SYSTEM_NO_DEPRECATED)
target_compile_options(${PLUGIN2} PRIVATE -Wno-write-strings)
set_property(TARGET ${PLUGIN2} PROPERTY CXX_STANDARD ${IRODS_CXX_STANDARD})
install(
TARGETS
${PLUGIN2}
LIBRARY
DESTINATION usr/lib/irods/plugins/microservices
)
set(
PLUGIN3
msiHSAddQuotaHolder
)
add_library(
${PLUGIN3}
MODULE
${CMAKE_SOURCE_DIR}/src/lib-msiHSAddQuotaHolder.cpp
)
target_include_directories(
${PLUGIN3}
PRIVATE
/usr/include/irods
${IRODS_EXTERNALS_FULLPATH_BOOST}/include
${IRODS_EXTERNALS_FULLPATH_JSON}/include
)
target_link_libraries(
${PLUGIN3}
PRIVATE
${OPENSSL_CRYPTO_LIBRARY}
curl
)
target_compile_definitions(${PLUGIN3} PRIVATE ${IRODS_AUDIT_PLUGIN_LOCKING_SERVER_COMPILE_DEFINITIONS} ${IRODS_COMPILE_DEFINITIONS} BOOST_SYSTEM_NO_DEPRECATED)
target_compile_options(${PLUGIN3} PRIVATE -Wno-write-strings)
set_property(TARGET ${PLUGIN3} PROPERTY CXX_STANDARD ${IRODS_CXX_STANDARD})
install(
TARGETS
${PLUGIN3}
LIBRARY
DESTINATION usr/lib/irods/plugins/microservices
)
set(
PLUGIN4
msiHSRemoveQuotaHolder
)
add_library(
${PLUGIN4}
MODULE
${CMAKE_SOURCE_DIR}/src/lib-msiHSRemoveQuotaHolder.cpp
)
target_include_directories(
${PLUGIN4}
PRIVATE
/usr/include/irods
${IRODS_EXTERNALS_FULLPATH_BOOST}/include
${IRODS_EXTERNALS_FULLPATH_JSON}/include
)
target_link_libraries(
${PLUGIN4}
PRIVATE
${OPENSSL_CRYPTO_LIBRARY}
curl
)
target_compile_definitions(${PLUGIN4} PRIVATE ${IRODS_AUDIT_PLUGIN_LOCKING_SERVER_COMPILE_DEFINITIONS} ${IRODS_COMPILE_DEFINITIONS} BOOST_SYSTEM_NO_DEPRECATED)
target_compile_options(${PLUGIN4} PRIVATE -Wno-write-strings)
set_property(TARGET ${PLUGIN4} PROPERTY CXX_STANDARD ${IRODS_CXX_STANDARD})
install(
TARGETS
${PLUGIN4}
LIBRARY
DESTINATION usr/lib/irods/plugins/microservices
)
set(
PLUGIN5
msiHSResetQuotaDir
)
add_library(
${PLUGIN5}
MODULE
${CMAKE_SOURCE_DIR}/src/lib-msiHSResetQuotaDir.cpp
)
target_include_directories(
${PLUGIN5}
PRIVATE
/usr/include/irods
${IRODS_EXTERNALS_FULLPATH_BOOST}/include
${IRODS_EXTERNALS_FULLPATH_JSON}/include
)
target_link_libraries(
${PLUGIN5}
PRIVATE
${OPENSSL_CRYPTO_LIBRARY}
curl
)
target_compile_definitions(${PLUGIN5} PRIVATE ${IRODS_AUDIT_PLUGIN_LOCKING_SERVER_COMPILE_DEFINITIONS} ${IRODS_COMPILE_DEFINITIONS} BOOST_SYSTEM_NO_DEPRECATED)
target_compile_options(${PLUGIN5} PRIVATE -Wno-write-strings)
set_property(TARGET ${PLUGIN5} PROPERTY CXX_STANDARD ${IRODS_CXX_STANDARD})
install(
TARGETS
${PLUGIN5}
LIBRARY
DESTINATION usr/lib/irods/plugins/microservices
)
set(CPACK_PACKAGE_FILE_NAME "hydroshare-quota-microservices-${IRODS_LINUX_DISTRIBUTION_NAME}${IRODS_LINUX_DISTRIBUTION_VERSION_MAJOR}-${CMAKE_SYSTEM_PROCESSOR}")
set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY OFF)
set(CPACK_COMPONENT_INCLUDE_TOPLEVEL_DIRECTORY OFF)
set(CPACK_COMPONENTS_GROUPING IGNORE)
set(CPACK_PACKAGE_VERSION "1.3.0")
set(CPACK_PACKAGE_VERSION_MAJOR "1")
set(CPACK_PACKAGE_VERSION_MINOR "3")
set(CPACK_PACKAGE_VERSION_PATCH "0")
set(CPACK_PACKAGE_CONTACT "CUAHSI Inc. <[email protected]>")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "The HydroShare microservices library")
set(CPACK_PACKAGE_VENDOR "CUAHSI Inc. <[email protected]>")
set(CPACK_DEB_COMPONENT_INSTALL OFF)
set(CPACK_DEBIAN_PACKAGE_SECTION "contrib/science")
set(CPACK_DEBIAN_COMPRESSION_TYPE "gzip")
set(CPACK_DEBIAN_PACKAGE_PRIORITY "extra")
set(CPACK_DEBIAN_PACKAGE_HOMEPAGE "https://www.cuahsi.org")
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS OFF)
set(CPACK_DEBIAN_PACKAGE_CONTROL_STRICT_PERMISSION ON)
set(CPACK_RPM_COMPONENT_INSTALL OFF)
set(CPACK_RPM_PACKAGE_RELEASE "0")
set(CPACK_RPM_PACKAGE_LICENSE "BSD-3-Clause")
set(CPACK_RPM_PACKAGE_VENDOR "CUAHSI Inc.")
set(CPACK_RPM_PACKAGE_URL "https://www.cuahsi.org")
set(CPACK_RPM_PACKAGE_AUTOREQ 0)
set(CPACK_RPM_PACKAGE_AUTOPROV 0)
set(CPACK_ARCHIVE_COMPONENT_INSTALL OFF)
set(CPACK_DEBIAN_PACKAGE_NAME "hydroshare-quota-microservices")
set(CPACK_DEBIAN_PACKAGE_DEPENDS "${IRODS_PACKAGE_DEPENDENCIES_STRING}, irods-runtime (= ${IRODS_VERSION}), libc6")
set(CPACK_RPM_PACKAGE_NAME "hydroshare-quota-microservices")
if (IRODS_LINUX_DISTRIBUTION_NAME STREQUAL "centos" OR IRODS_LINUX_DISTRIBUTION_NAME STREQUAL "centos linux")
set(CPACK_RPM_PACKAGE_REQUIRES "${IRODS_PACKAGE_DEPENDENCIES_STRING}, irods-runtime = ${IRODS_VERSION}, openssl")
elseif (IRODS_LINUX_DISTRIBUTION_NAME STREQUAL "opensuse")
set(CPACK_RPM_PACKAGE_REQUIRES "${IRODS_PACKAGE_DEPENDENCIES_STRING}, irods-runtime = ${IRODS_VERSION}, libopenssl1_0_0")
endif()
if (NOT CPACK_GENERATOR)
set(CPACK_GENERATOR ${IRODS_CPACK_GENERATOR} CACHE STRING "CPack generator to use, e.g. {DEB, RPM, TGZ}." FORCE)
message(STATUS "Setting unspecified CPACK_GENERATOR to ${CPACK_GENERATOR}. This is the correct setting for normal builds.")
endif()
include(CPack)