@@ -7,38 +7,29 @@ cmake_minimum_required(VERSION 3.14)
7
7
8
8
project (
9
9
ygm
10
- VERSION 0.6
10
+ VERSION 0.7
11
11
DESCRIPTION "HPC Communication Library"
12
12
LANGUAGES CXX
13
13
)
14
14
15
- if (CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME )
16
- set (YGM_MAIN_PROJECT ON )
17
- endif ()
18
-
19
- # Controls whether to set up install boilerplate for project and depencencies.
20
- # Expects CMAKE_INSTALL_PREFIX to be set to a suitable directory.
21
- option (YGM_INSTALL "Generate the install target" ${YGM_MAIN_PROJECT} )
22
-
23
- # Only do these if this is the main project, and not if it is included through
24
- # add_subdirectory
25
- if (YGM_MAIN_PROJECT )
15
+ list (APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR} /cmake" )
26
16
27
- # Let's nicely support folders in IDE's
28
- set_property (GLOBAL PROPERTY USE_FOLDERS ON )
29
-
30
- # Testing only available if this is the main app Note this needs to be done
31
- # in the main CMakeLists since it calls enable_testing, which must be in the
32
- # main CMakeLists.
33
- include (CTest )
17
+ #
18
+ # Configuration options for YGM
19
+ #
20
+ option (JUST_INSTALL_YGM_HEADERS "Install YGM header files without building anything" OFF )
21
+ option (YGM_BUILD_TESTS "Build tests" OFF )
22
+ option (YGM_BUILD_TOOLS "Build tools" OFF )
23
+ option (YGM_DOXYGEN "Adds targets for generating Doxygen documentation" OFF )
24
+ option (YGM_RTD_ONLY "Run Cmake for only generating documentation for Read the Docs" OFF )
25
+ option (YGM_REQUIRE_PARQUET "YGM requires Arrow Parquet." OFF )
26
+ option (YGM_INSTALL_PARQUET "YGM installs Arrow Parquet if it is not found." OFF )
34
27
35
- # Docs only available if this is the main app
36
- find_package (Doxygen )
37
- if (Doxygen_FOUND )
38
- # add_subdirectory(docs)
39
- else ()
40
- message (STATUS "Doxygen not found, not building docs" )
41
- endif ()
28
+ #
29
+ # Early exit if only installing headers
30
+ #
31
+ if (JUST_INSTALL_YGM_HEADERS )
32
+ return ()
42
33
endif ()
43
34
44
35
# Require out-of-source builds
@@ -73,7 +64,7 @@ if (NOT cereal_FOUND)
73
64
FetchContent_Declare (
74
65
cereal
75
66
GIT_REPOSITORY https://github.com/USCiLab/cereal.git
76
- GIT_TAG af0700efb25e7dc7af637b9e6f970dbb94813bff
67
+ GIT_TAG v1.3.2
77
68
)
78
69
FetchContent_GetProperties (cereal )
79
70
if (cereal_POPULATED )
@@ -85,7 +76,7 @@ if (NOT cereal_FOUND)
85
76
# Do not compile any cereal tests
86
77
set (JUST_INSTALL_CEREAL ON )
87
78
# Install cereal at ${CMAKE_INSTALL_PREFIX}
88
- set (CEREAL_INSTALL ${YGM_INSTALL} )
79
+ set (CEREAL_INSTALL ON )
89
80
# Populate cereal
90
81
FetchContent_Populate (cereal )
91
82
# Include cereal root cmake boilerplate
@@ -134,125 +125,73 @@ endif ()
134
125
# Arrow
135
126
#
136
127
#
137
- find_package (Arrow 8.0 QUIET )
138
- if (NOT Arrow_FOUND )
139
- find_package (Arrow 9.0 QUIET )
140
- endif ()
141
- if (NOT Arrow_FOUND )
142
- find_package (Arrow 10.0 QUIET )
143
- endif ()
144
- if (NOT Arrow_FOUND )
145
- find_package (Arrow 11.0 QUIET )
146
- endif ()
147
- if (NOT Arrow_FOUND )
148
- find_package (Arrow 12.0 QUIET )
149
- endif ()
150
- if (NOT Arrow_FOUND )
151
- find_package (Arrow 13.0 QUIET )
152
- endif ()
153
- if (NOT Arrow_FOUND )
154
- find_package (Arrow 14.0 QUIET )
155
- endif ()
156
- if (NOT Arrow_FOUND )
157
- find_package (Arrow 15.0 QUIET )
158
- endif ()
159
- if (Arrow_FOUND )
160
- message (STATUS ${PROJECT_NAME} " found Arrow " )
161
- message (STATUS "Arrow version: ${ARROW_VERSION} " )
162
- message (STATUS "Arrow SO version: ${ARROW_FULL_SO_VERSION} " )
163
- set (ARROW_CMAKE_DIR ${Arrow_DIR} )
164
- find_package (Parquet PATHS ${ARROW_CMAKE_DIR} )
165
- if (Parquet_FOUND )
166
- message (STATUS ${PROJECT_NAME} " found Parquet " )
167
- message (STATUS "Parquet version: ${PARQUET_VERSION} " )
168
- message (STATUS "Parquet SO version: ${PARQUET_FULL_SO_VERSION} " )
169
- else ()
170
- message (WARNING ${PROJECT_NAME} " did not find Parquet. Building without Parquet." )
171
- endif ()
172
- else ()
173
- message (WARNING ${PROJECT_NAME} " did not find Arrow >= 8.0. Building without Arrow." )
174
- if (YGM_REQUIRE_ARROW )
175
- message (FATAL_ERROR "YGM configured to require Arrow, but Arrow could not be found" )
176
- endif ()
177
- endif ()
128
+ include (FindArrowParquet )
129
+ find_or_install_arrow_parquet ()
178
130
179
131
#
180
132
# Create the YGM target library
181
133
#
182
134
add_library (ygm INTERFACE )
183
135
add_library (ygm::ygm ALIAS ygm )
184
- target_compile_features (ygm INTERFACE cxx_std_17 )
136
+ target_compile_features (ygm INTERFACE cxx_std_20 )
185
137
target_include_directories (
186
138
ygm INTERFACE $< BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR} /include>
187
139
$< INSTALL_INTERFACE:include>
188
140
)
189
141
target_link_libraries (
190
- ygm INTERFACE MPI::MPI_CXX Threads::Threads stdc++fs ${YGM_CEREAL_TARGET}
142
+ ygm INTERFACE MPI::MPI_CXX Threads::Threads stdc++fs rt ${YGM_CEREAL_TARGET}
191
143
)
192
144
193
145
option (TEST_WITH_SLURM "Run tests with Slurm" OFF )
194
146
195
147
# Install ygm. Expects CMAKE_INSTALL_PREFIX to be set to a suitable directory.
196
- if (${YGM_INSTALL} )
197
- include (GNUInstallDirs )
198
- include (CMakePackageConfigHelpers )
199
-
200
- # List libraries to be installed
201
- set (YGM_EXPORT_TARGETS ygm )
202
-
203
- install (
204
- TARGETS ${PROJECT_NAME}
205
- EXPORT ${PROJECT_NAME} Targets
206
- ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
207
- LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
208
- RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
209
- )
210
-
211
- install (
212
- EXPORT ${PROJECT_NAME} Targets
213
- FILE ${PROJECT_NAME} Targets.cmake
214
- NAMESPACE ${PROJECT_NAME} ::
215
- DESTINATION ${CMAKE_INSTALL_DATAROOTDIR} /${PROJECT_NAME}/cmake
216
- )
217
-
218
- install (DIRECTORY ${PROJECT_SOURCE_DIR} /include/ygm
219
- DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
220
- )
221
-
222
- # create version file
223
- write_basic_package_version_file (
224
- "${PROJECT_NAME} ConfigVersion.cmake"
225
- VERSION ${PROJECT_VERSION}
226
- COMPATIBILITY ExactVersion
227
- )
148
+ include (GNUInstallDirs )
149
+ include (CMakePackageConfigHelpers )
150
+
151
+ # List libraries to be installed
152
+ set (YGM_EXPORT_TARGETS ygm )
153
+
154
+ install (
155
+ TARGETS ${PROJECT_NAME}
156
+ EXPORT ${PROJECT_NAME} Targets
157
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
158
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
159
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
160
+ )
228
161
229
- # create config file
230
- configure_package_config_file (
231
- " ${PROJECT_SOURCE_DIR} /cmake/ ${ PROJECT_NAME}Config .cmake.in"
232
- " ${PROJECT_BINARY_DIR} / ${ PROJECT_NAME}Config.cmake"
233
- INSTALL_DESTINATION ${CMAKE_INSTALL_DATAROOTDIR} /${PROJECT_NAME}/cmake
234
- )
162
+ install (
163
+ EXPORT ${PROJECT_NAME} Targets
164
+ FILE ${ PROJECT_NAME}Targets .cmake
165
+ NAMESPACE ${ PROJECT_NAME}::
166
+ DESTINATION ${CMAKE_INSTALL_DATAROOTDIR} /${PROJECT_NAME}/cmake
167
+ )
235
168
236
- install (FILES "${PROJECT_BINARY_DIR} /${PROJECT_NAME} Config.cmake"
237
- "${PROJECT_BINARY_DIR} /${PROJECT_NAME} ConfigVersion.cmake"
238
- DESTINATION ${CMAKE_INSTALL_DATAROOTDIR} /${PROJECT_NAME}/cmake
239
- )
169
+ install (DIRECTORY ${PROJECT_SOURCE_DIR} /include/ygm
170
+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
171
+ )
240
172
241
- endif ()
173
+ # create version file
174
+ write_basic_package_version_file (
175
+ "${PROJECT_NAME} ConfigVersion.cmake"
176
+ VERSION ${PROJECT_VERSION}
177
+ COMPATIBILITY ExactVersion
178
+ )
242
179
243
- option (JUST_INSTALL_YGM "Skip executable compilation" OFF )
244
- if (JUST_INSTALL_YGM )
245
- return ()
246
- endif ()
180
+ # create config file
181
+ configure_package_config_file (
182
+ "${PROJECT_SOURCE_DIR} /cmake/${PROJECT_NAME} Config.cmake.in"
183
+ "${PROJECT_BINARY_DIR} /${PROJECT_NAME} Config.cmake"
184
+ INSTALL_DESTINATION ${CMAKE_INSTALL_DATAROOTDIR} /${PROJECT_NAME}/cmake
185
+ )
247
186
248
- if ( NOT CMAKE_BUILD_TYPE )
249
- set ( CMAKE_BUILD_TYPE Release )
250
- message ( STATUS "CMAKE_BUILD_TYPE is set as Release" )
251
- endif ( )
187
+ install ( FILES " ${PROJECT_BINARY_DIR} / ${PROJECT_NAME} Config.cmake"
188
+ " ${PROJECT_BINARY_DIR} / ${PROJECT_NAME} ConfigVersion.cmake"
189
+ DESTINATION ${CMAKE_INSTALL_DATAROOTDIR} /${PROJECT_NAME}/cmake
190
+ )
252
191
253
- # Testing & examples are only available if this is the main app
254
- if (YGM_MAIN_PROJECT )
192
+ if (YGM_BUILD_TESTS )
255
193
add_subdirectory (test )
256
- # Example codes are here.
257
- add_subdirectory (examples )
194
+ endif ()
195
+ if (YGM_BUILD_TOOLS )
196
+ add_subdirectory (tools )
258
197
endif ()
0 commit comments