forked from EUDAT-B2STAGE/B2STAGE-GridFTP
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
267 lines (234 loc) · 13 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
##############################################################################
# Copyright (c) 2013 CINECA (www.hpc.cineca.it)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#
# Globus DSI to manage data on iRODS.
#
# Author: Roberto Mucci - SCAI - CINECA
# Email: hpc-service@cineca.it
#
###############################################################################
cmake_minimum_required (VERSION 2.6)
project (iRODS_DSI C CXX)
set(GENERIC_LIB_VERSION "1.8")
set(IRODS_MIN_VERSION "4.2.0")
##### Check ENV variables ######
if (DEFINED ENV{GLOBUS_LOCATION})
message("GLOBUS_LOCATION is defined as $ENV{GLOBUS_LOCATION}")
else()
message( FATAL_ERROR "GLOBUS_LOCATION is NOT defined, CMake will exit." )
endif()
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
if (DEFINED ENV{IRODS_PATH})
message("IRODS_PATH is defined as $ENV{IRODS_PATH}")
if ($ENV{IRODS_PATH} STREQUAL "/usr")
add_definitions(-DIRODS_HEADER_HPP)
set(irods_include_path_list "$ENV{IRODS_PATH}/include/irods")
if (DEFINED ENV{IRODS_42_COMPAT})
#find_package(IRODS ${IRODS_MIN_VERSION} REQUIRED CONFIG)
find_package(IRODS REQUIRED CONFIG)
set(CMAKE_INSTALL_RPATH $ENV{IRODS_EXTERNALS_PATH}/clang-runtime6.0-0/lib)
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++ -O0)
set(CMAKE_C_COMPILER $ENV{IRODS_EXTERNALS_PATH}/clang6.0-0/bin/clang)
set(CMAKE_CXX_COMPILER $ENV{IRODS_EXTERNALS_PATH}/clang6.0-0/bin/clang++)
link_libraries(c++abi)
remove_definitions(-DIRODS_HEADER_HPP)
add_definitions(-DIRODS_42)
if (DEFINED ENV{IRODS_EXTERNALS_PATH})
set(irods_include_path_list "$ENV{IRODS_PATH}/include/irods"
"$ENV{IRODS_EXTERNALS_PATH}/clang6.0-0/include/c++/v1")
set(irods_link_obj_path
PRIVATE
irods_client
irods_plugin_dependencies
irods_common
"$ENV{IRODS_PATH}/lib/irods/plugins/network/libtcp_client.so"
"$ENV{IRODS_PATH}/lib/irods/plugins/auth/libnative_client.so"
#"$ENV{IRODS_PATH}/lib/libirods_client.so"
#"$ENV{IRODS_PATH}/lib/libirods_common.so"
"-lrt"
"-lcurl"
"$ENV{IRODS_EXTERNALS_PATH}/avro1.8.2-0/lib/libavrocpp.so"
"$ENV{IRODS_EXTERNALS_PATH}/jansson2.7-0/lib/libjansson.so"
"$ENV{IRODS_EXTERNALS_PATH}/boost1.67.0-0/lib/libboost_filesystem.so"
"$ENV{IRODS_EXTERNALS_PATH}/boost1.67.0-0/lib/libboost_regex.so"
"$ENV{IRODS_EXTERNALS_PATH}/boost1.67.0-0/lib/libboost_system.so"
"$ENV{IRODS_EXTERNALS_PATH}/boost1.67.0-0/lib/libboost_thread.so")
else()
message( FATAL_ERROR "IRODS_EXTERNALS_PATH is NOT defined, CMake will exit." )
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 CPACK_DEBIAN_PACKAGE_VERSION)
set(CPACK_DEBIAN_PACKAGE_VERSION ${IRODS_CPACK_DEBIAN_PACKAGE_VERSION})
endif()
set(CPACK_PACKAGE_FILE_NAME "irods-gridftp-client${IRODS_PACKAGE_FILE_NAME_SUFFIX}")
set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY OFF)
set(CPACK_COMPONENT_INCLUDE_TOPLEVEL_DIRECTORY OFF)
set(CPACK_COMPONENTS_GROUPING IGNORE)
set(CPACK_PACKAGE_VERSION ${IRODS_VERSION})
set(CPACK_PACKAGE_VERSION_MAJOR ${IRODS_VERSION_MAJOR})
set(CPACK_PACKAGE_VERSION_MINOR ${IRODS_VERSION_MINOR})
set(CPACK_PACKAGE_VERSION_PATCH ${IRODS_VERSION_PATCH})
set(CPACK_PACKAGE_CONTACT "Renaissance Computing Institute <info@irods.org>")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "The integrated Rule-Oriented Data System")
set(CPACK_PACKAGE_VENDOR "Renaissance Computing Institute <info@irods.org>")
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://irods.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 "1")
set(CPACK_RPM_PACKAGE_LICENSE "BSD-3-Clause")
set(CPACK_RPM_PACKAGE_VENDOR "iRODS Consortium")
set(CPACK_RPM_PACKAGE_URL "https://irods.org")
set(CPACK_RPM_PACKAGE_AUTOREQ 0)
set(CPACK_RPM_PACKAGE_AUTOPROV 0)
set(CPACK_ARCHIVE_COMPONENT_INSTALL OFF)
set(CPACK_DEBIAN_PACKAGE_NAME "irods-gridftp-client")
set(CPACK_DEBIAN_PACKAGE_DEPENDS "${IRODS_PACKAGE_DEPENDENCIES_STRING}, irods-runtime (= ${CPACK_DEBIAN_PACKAGE_VERSION}), libc6, libssl1.0.0")
#set(CPACK_DEBIAN_PACKAGE_REPLACES "irods-icat, irods-resource")
set(CPACK_RPM_PACKAGE_NAME "irods-gridftp-client")
#set(CPACK_RPM_PACKAGE_OBSOLETES "irods-icat, irods-resource")
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)
elseif (DEFINED ENV{IRODS_40_COMPAT})
set(irods_link_obj_path
"$ENV{IRODS_PATH}/lib/irods/libirods_client.so"
"$ENV{IRODS_PATH}/lib/irods/libirods_client_api.so"
"-lrt"
"-lcurl"
"$ENV{IRODS_PATH}/lib/irods/libjansson.a"
"$ENV{IRODS_PATH}/lib/irods/libboost_filesystem.a"
"$ENV{IRODS_PATH}/lib/irods/libboost_regex.a"
"$ENV{IRODS_PATH}/lib/irods/libboost_system.a"
"$ENV{IRODS_PATH}/lib/irods/libboost_thread.a")
else()
set(irods_link_obj_path
"$ENV{IRODS_PATH}/lib/libirods_client.so"
"$ENV{IRODS_PATH}/lib/libirods_client_api.so"
"-lrt"
"-lpthread"
"-pthread"
"-lssl"
"-lcurl"
"$ENV{IRODS_PATH}/lib/irods/externals/libjansson.a"
"$ENV{IRODS_PATH}/lib/irods/externals/libboost_chrono.a"
"$ENV{IRODS_PATH}/lib/irods/externals/libboost_filesystem.a"
"$ENV{IRODS_PATH}/lib/irods/externals/libboost_program_options.a"
"$ENV{IRODS_PATH}/lib/irods/externals/libboost_regex.a"
"$ENV{IRODS_PATH}/lib/irods/externals/libboost_system.a"
"$ENV{IRODS_PATH}/lib/irods/externals/libboost_thread.a")
endif()
else()
set(irods_include_path_list "$ENV{IRODS_PATH}/lib/api/include"
"$ENV{IRODS_PATH}/lib/core/include"
"$ENV{IRODS_PATH}/server/icat/include"
"$ENV{IRODS_PATH}/lib/md5/include/"
"$ENV{IRODS_PATH}/lib/sha1/include/"
"$ENV{IRODS_PATH}/server/core/include/"
"$ENV{IRODS_PATH}/server/drivers/include/"
"$ENV{IRODS_PATH}/server/re/include/")
set(irods_link_obj_path "$ENV{IRODS_PATH}/lib/core/obj/libRodsAPIs.a")
endif()
else()
message( FATAL_ERROR "IRODS_PATH is NOT defined, CMake will exit." )
endif()
if (DEFINED ENV{RESOURCE_MAP_PATH})
message("RESOURCE_MAP_PATH is defined as $ENV{RESOURCE_MAP_PATH}")
else()
message( WARNING "RESOURCE_MAP_PATH is NOT defined!" )
endif()
if (DEFINED ENV{FLAVOR})
message("FLAVOR is defined as $ENV{FLAVOR}")
set(dsi_library_name globus_gridftp_server_iRODS_$ENV{FLAVOR})
set(gridmap_callout_library_name gridmap_iRODS_callout_$ENV{FLAVOR})
set(gridmap_callout_library_LINK_FLAGS "-lglobus_gridmap_callout_error_$ENV{FLAVOR}")
else()
message( WARNING "FLAVOR is NOT defined!" )
set(dsi_library_name globus_gridftp_server_iRODS)
set(gridmap_callout_library_name gridmap_iRODS_callout)
set(gridmap_callout_library_LINK_FLAGS "-lglobus_gridmap_callout_error")
endif()
if (NOT DEFINED ENV{DEST_LIB_DIR})
set(ENV{DEST_LIB_DIR} "$ENV{GLOBUS_LOCATION}/lib")
# Note: this may have to be lib64 on 64-bit platforms.
endif()
message("DEST_LIB_DIR is defined as $ENV{DEST_LIB_DIR}")
if (NOT DEFINED ENV{DEST_ETC_DIR})
if ($ENV{GLOBUS_LOCATION} STREQUAL "/usr")
set(ENV{DEST_ETC_DIR} "/etc/grid-security")
else()
set(ENV{DEST_ETC_DIR} "$ENV{GLOBUS_LOCATION}/etc")
endif()
endif()
message("DEST_ETC_DIR is defined as $ENV{DEST_ETC_DIR}")
if (NOT DEFINED ENV{DEST_BIN_DIR})
set(ENV{DEST_BIN_DIR} "$ENV{GLOBUS_LOCATION}/bin")
endif()
message("DEST_BIN_DIR is defined as $ENV{DEST_BIN_DIR}")
#################################
message("DSI library name will be: ${dsi_library_name}")
message("Gridmap callout library name will be: ${gridmap_callout_library_name}")
add_library(${dsi_library_name} SHARED DSI/globus_gridftp_server_iRODS.c DSI/pid_manager.c external/cJSON.c)
add_library(${gridmap_callout_library_name} SHARED DSI/gridmap_iRODS_callout.c DSI/libirodsmap.c)
set_target_properties(${dsi_library_name} PROPERTIES VERSION ${GENERIC_LIB_VERSION} )
set_target_properties(${dsi_library_name} PROPERTIES LINKER_LANGUAGE CXX)
target_link_libraries(${dsi_library_name} ${irods_link_obj_path})
set_target_properties(${gridmap_callout_library_name} PROPERTIES LINK_FLAGS ${gridmap_callout_library_LINK_FLAGS} VERSION ${GENERIC_LIB_VERSION} )
set_target_properties(${gridmap_callout_library_name} PROPERTIES LINKER_LANGUAGE CXX)
target_link_libraries(${gridmap_callout_library_name} ${irods_link_obj_path})
set(gridmap_callout_conf_name gridmap_iRODS_callout.conf)
set(testirodsmap_exe "testirodsmap")
set(testirodsmap_exe_LINK_FLAGS "-ldl -lglobus_gss_assist -lstdc++")
add_executable(${testirodsmap_exe} DSI/testirodsmap.c DSI/libirodsmap.c)
set_target_properties(${testirodsmap_exe} PROPERTIES LINKER_LANGUAGE CXX)
set_target_propertieS(${testirodsmap_exe} PROPERTIES LINK_FLAGS ${testirodsmap_exe_LINK_FLAGS})
target_link_libraries(${testirodsmap_exe} ${irods_link_obj_path})
set(testpidmanager_exe "testpidmanager")
add_executable(${testpidmanager_exe} DSI/pid_manager_test.c DSI/pid_manager.c external/cJSON.c)
target_link_libraries(${testpidmanager_exe} ${irods_link_obj_path} "-lm -lglobus_gridftp_server")
set(CMAKE_C_FLAGS "-g -O2 -Wall -lstdc++ -lcurl -O3 -DNDEBUG")
include_directories(${irods_include_path_list})
include_directories($ENV{GLOBUS_LOCATION}/include/globus
$ENV{GLOBUS_LOCATION}/lib/globus/include
$ENV{GLOBUS_LOCATION}/lib64/globus/include
DSI
external)
if (DEFINED ENV{FLAVOR})
include_directories($ENV{GLOBUS_LOCATION}/include/ENV{FLAVOR})
endif()
install(TARGETS ${dsi_library_name} ${gridmap_callout_library_name} DESTINATION $ENV{DEST_LIB_DIR})
install(TARGETS ${testirodsmap_exe} DESTINATION $ENV{DEST_BIN_DIR})
install(TARGETS ${testpidmanager_exe} DESTINATION $ENV{DEST_BIN_DIR})
configure_file(DSI/${gridmap_callout_conf_name}.in ${gridmap_callout_conf_name})
install(FILES ${gridmap_callout_conf_name} DESTINATION $ENV{DEST_ETC_DIR})