-
Notifications
You must be signed in to change notification settings - Fork 10
/
CMakeLists.txt
165 lines (137 loc) · 5.74 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
cmake_minimum_required(VERSION 3.5.0 FATAL_ERROR) #CPACK_DEBIAN_<COMPONENT>_PACKAGE_NAME
set(IRODS_MINIMUM_VERSION "4.90.0")
find_package(IRODS "${IRODS_MINIMUM_VERSION}" REQUIRED)
set(IRODS_PLUGIN_REVISION "0")
set(IRODS_PLUGIN_VERSION "${IRODS_MINIMUM_VERSION}.${IRODS_PLUGIN_REVISION}")
set(IRODS_PACKAGE_REVISION "0")
include(IrodsCXXCompiler)
set(CMAKE_CXX_STANDARD ${IRODS_CXX_STANDARD})
set(CMAKE_MODULE_LINKER_FLAGS_INIT "-Wl,--enable-new-dtags -Wl,--as-needed -Wl,-z,defs")
set(CMAKE_MODULE_LINKER_FLAGS_RELEASE_INIT "-Wl,--gc-sections -Wl,-z,combreloc")
include(IrodsRunpathDefaults)
set(IRODS_TARGET_NAME_PREFIX irods_rule_engine_plugin)
project(irods_capability-storage_tiering
VERSION "${IRODS_PLUGIN_VERSION}"
LANGUAGES CXX)
include("${IRODS_TARGETS_PATH}")
include(GNUInstallDirs)
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()
set(IRODS_BUILD_WITH_WERROR OFF CACHE BOOL "Choose whether to compile with -Werror.")
if (IRODS_BUILD_WITH_WERROR)
add_compile_options(-Werror)
endif()
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-fpermissive>)
endif()
if (NOT DEFINED THREADS_PREFER_PTHREAD_FLAG)
set(THREADS_PREFER_PTHREAD_FLAG TRUE)
endif()
find_package(Threads REQUIRED)
find_package(nlohmann_json "3.6.1" REQUIRED)
find_package(OpenSSL REQUIRED)
set(IRODS_POLICY_NAME "unified_storage_tiering")
set(IRODS_PLUGIN_TARGET_NAME "${IRODS_TARGET_NAME_PREFIX}-${IRODS_POLICY_NAME}")
string(REPLACE "_" "-" IRODS_POLICY_NAME_HYPHENS "${IRODS_POLICY_NAME}")
set(IRODS_POLICY_PACKAGE_COMPONENT "${IRODS_POLICY_NAME_HYPHENS}")
add_library(
"${IRODS_PLUGIN_TARGET_NAME}"
MODULE
"${CMAKE_CURRENT_SOURCE_DIR}/src/main.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/storage_tiering.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/configuration.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/utilities.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/data_verification_utilities.cpp"
)
target_link_libraries(
"${IRODS_PLUGIN_TARGET_NAME}"
PRIVATE
irods_common
irods_server
nlohmann_json::nlohmann_json
"${IRODS_EXTERNALS_FULLPATH_BOOST}/lib/libboost_system.so"
"${IRODS_EXTERNALS_FULLPATH_BOOST}/lib/libboost_regex.so"
"${IRODS_EXTERNALS_FULLPATH_BOOST}/lib/libboost_filesystem.so"
)
target_include_directories(
"${IRODS_PLUGIN_TARGET_NAME}"
PRIVATE
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
"${IRODS_EXTERNALS_FULLPATH_BOOST}/include"
)
target_compile_definitions(
"${IRODS_PLUGIN_TARGET_NAME}"
PRIVATE
BOOST_SYSTEM_NO_DEPRECATED
RODS_SERVER
ENABLE_RE
${IRODS_COMPILE_DEFINITIONS}
${IRODS_COMPILE_DEFINITIONS_PRIVATE}
)
target_compile_options(
"${IRODS_PLUGIN_TARGET_NAME}"
PRIVATE
-Wno-write-strings
)
install(
TARGETS
"${IRODS_PLUGIN_TARGET_NAME}"
LIBRARY
DESTINATION "${IRODS_PLUGINS_DIRECTORY}/rule_engines"
COMPONENT "${IRODS_POLICY_PACKAGE_COMPONENT}"
)
install(
FILES
"${CMAKE_CURRENT_SOURCE_DIR}/packaging/test_plugin_unified_storage_tiering.py"
DESTINATION "${IRODS_HOME_DIRECTORY}/scripts/irods/test"
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
COMPONENT "${IRODS_POLICY_PACKAGE_COMPONENT}"
)
install(
FILES
"${CMAKE_CURRENT_SOURCE_DIR}/packaging/run_unified_storage_tiering_plugin_test.py"
DESTINATION "${IRODS_HOME_DIRECTORY}/scripts"
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
COMPONENT "${IRODS_POLICY_PACKAGE_COMPONENT}"
)
install(
FILES
"${CMAKE_CURRENT_SOURCE_DIR}/packaging/example_unified_tiering_invocation.r"
DESTINATION "${IRODS_HOME_DIRECTORY}"
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
COMPONENT "${IRODS_POLICY_PACKAGE_COMPONENT}"
)
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()
# CPACK_DEBIAN_PACKAGE_VERSION was previously a cache variable. Evict it.
unset(CPACK_DEBIAN_PACKAGE_VERSION CACHE)
include(IrodsCPackCommon)
list(APPEND CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION "${CPACK_PACKAGING_INSTALL_PREFIX}${IRODS_HOME_DIRECTORY}")
list(APPEND CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION "${CPACK_PACKAGING_INSTALL_PREFIX}${IRODS_HOME_DIRECTORY}/scripts")
list(APPEND CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION "${CPACK_PACKAGING_INSTALL_PREFIX}${IRODS_HOME_DIRECTORY}/scripts/irods")
list(APPEND CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION "${CPACK_PACKAGING_INSTALL_PREFIX}${IRODS_HOME_DIRECTORY}/scripts/irods/test")
string(REPLACE "_" "-" IRODS_PLUGIN_TARGET_NAME_HYPHENS "${IRODS_PLUGIN_TARGET_NAME}")
set(CPACK_PACKAGE_NAME "${IRODS_PLUGIN_TARGET_NAME_HYPHENS}")
set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY OFF)
set(CPACK_COMPONENT_INCLUDE_TOPLEVEL_DIRECTORY OFF)
set(CPACK_COMPONENTS_GROUPING IGNORE)
set(CPACK_PACKAGE_VERSION ${IRODS_PLUGIN_VERSION})
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "The integrated Rule-Oriented Data System")
set(CPACK_DEB_COMPONENT_INSTALL ON)
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS OFF)
set(CPACK_DEBIAN_PACKAGE_CONTROL_STRICT_PERMISSION ON)
set(CPACK_DEBIAN_FILE_NAME DEB-DEFAULT)
set(CPACK_DEBIAN_PACKAGE_DEPENDS "irods-server (= ${IRODS_VERSION}), irods-runtime (= ${IRODS_VERSION})")
set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CMAKE_SOURCE_DIR}/packaging/postinst;")
set(CPACK_RPM_COMPONENT_INSTALL ON)
set(CPACK_RPM_PACKAGE_LICENSE "BSD-3-Clause")
set(CPACK_RPM_PACKAGE_AUTOREQ 0)
set(CPACK_RPM_PACKAGE_AUTOPROV 0)
set(CPACK_RPM_FILE_NAME RPM-DEFAULT)
set(CPACK_RPM_PACKAGE_REQUIRES "irods-server = ${IRODS_VERSION}, irods-runtime = ${IRODS_VERSION}")
set(CPACK_RPM_POST_INSTALL_SCRIPT_FILE "${CMAKE_SOURCE_DIR}/packaging/postinst")
include(CPack)