forked from EUDAT-B2STAGE/B2STAGE-GridFTP
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
167 lines (148 loc) · 7.26 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
##############################################################################
# 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: [email protected]
#
###############################################################################
cmake_minimum_required (VERSION 2.6)
project (iRODS_DSI C CXX)
set(GENERIC_LIB_VERSION "1.8")
##### 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_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_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")
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})