16
16
# ##################################################################################################
17
17
# - libmrc -----------------------------------------------------------------------------------------
18
18
19
+ include (GenerateExportHeader)
20
+
21
+ # Generate the version header file
22
+ rapids_cmake_write_version_file(${CMAKE_CURRENT_BINARY_DIR} /autogenerated/include /mrc/version .hpp)
23
+
19
24
# Keep all source files sorted!!!
20
25
add_library (libmrc
21
26
src/internal /codable/codable_storage.cpp
@@ -125,6 +130,7 @@ add_library(libmrc
125
130
src/public /cuda/sync.cpp
126
131
src/public /edge/edge_adapter_registry.cpp
127
132
src/public /edge/edge_builder.cpp
133
+ src/public /exceptions/checks.cpp
128
134
src/public /exceptions/exception_catcher.cpp
129
135
src/public /manifold/manifold.cpp
130
136
src/public /memory/buffer_view.cpp
@@ -204,6 +210,47 @@ target_compile_features(libmrc PUBLIC cxx_std_20)
204
210
205
211
set_target_properties (libmrc PROPERTIES OUTPUT_NAME ${PROJECT_NAME} )
206
212
213
+ # Generates an include file for specifying external linkage since everything is hidden by default
214
+ generate_export_header(libmrc
215
+ NO_EXPORT_MACRO_NAME
216
+ MRC_LOCAL
217
+ EXPORT_FILE_NAME
218
+ "${CMAKE_CURRENT_BINARY_DIR} /autogenerated/include/mrc/export.h"
219
+ )
220
+
221
+ # ##################################################################################################
222
+ # - source information -----------------------------------------------------------------------------
223
+
224
+ # Ideally, we dont use glob here. But there is no good way to guarantee you dont miss anything like *.cpp
225
+ file (GLOB_RECURSE libmrc_public_headers
226
+ LIST_DIRECTORIES FALSE
227
+ CONFIGURE_DEPENDS
228
+ "${CMAKE_CURRENT_SOURCE_DIR} /include/mrc/*"
229
+ )
230
+
231
+ # Add headers to target sources file_set so they can be installed
232
+ # https://discourse.cmake.org/t/installing-headers-the-modern-way-regurgitated-and-revisited/3238/3
233
+ target_sources (libmrc
234
+ PUBLIC
235
+ FILE_SET public_headers
236
+ TYPE HEADERS
237
+ BASE_DIRS "${CMAKE_CURRENT_SOURCE_DIR} /include"
238
+ FILES
239
+ ${libmrc_public_headers}
240
+ )
241
+
242
+ # Add generated headers to fileset
243
+ target_sources (libmrc
244
+ PUBLIC
245
+ FILE_SET public_headers
246
+ TYPE HEADERS
247
+ BASE_DIRS
248
+ "${CMAKE_CURRENT_BINARY_DIR} /autogenerated/include"
249
+ FILES
250
+ "${CMAKE_CURRENT_BINARY_DIR} /autogenerated/include/mrc/version.hpp"
251
+ "${CMAKE_CURRENT_BINARY_DIR} /autogenerated/include/mrc/export.h"
252
+ )
253
+
207
254
# ##################################################################################################
208
255
# - install targets --------------------------------------------------------------------------------
209
256
rapids_cmake_install_lib_dir(lib_dir)
@@ -215,12 +262,7 @@ install(
215
262
DESTINATION ${lib_dir}
216
263
EXPORT ${PROJECT_NAME} -exports
217
264
COMPONENT Core
218
- )
219
-
220
- install (
221
- DIRECTORY include /
222
- DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
223
- COMPONENT Core
265
+ FILE_SET public_headers
224
266
)
225
267
226
268
# ##################################################################################################
@@ -234,37 +276,3 @@ endif()
234
276
if (MRC_BUILD_BENCHMARKS)
235
277
add_subdirectory (benchmarks)
236
278
endif ()
237
-
238
- # ##################################################################################################
239
- # - install export ---------------------------------------------------------------------------------
240
- set (doc_string
241
- [=[
242
- Provide targets for mrc.
243
- ]=])
244
-
245
- set (code_string "" )
246
-
247
- set (rapids_project_version_compat SameMinorVersion)
248
-
249
- # Need to explicitly set VERSION ${PROJECT_VERSION} here since rapids_cmake gets
250
- # confused with the `RAPIDS_VERSION` variable we use
251
- rapids_export(INSTALL ${PROJECT_NAME}
252
- EXPORT_SET ${PROJECT_NAME} -exports
253
- GLOBAL_TARGETS libmrc
254
- VERSION ${PROJECT_VERSION}
255
- NAMESPACE mrc::
256
- DOCUMENTATION doc_string
257
- FINAL_CODE_BLOCK code_string
258
- )
259
-
260
- # ##################################################################################################
261
- # - build export ----------------------------------------------------------------------------------
262
- rapids_export(BUILD ${PROJECT_NAME}
263
- EXPORT_SET ${PROJECT_NAME} -exports
264
- GLOBAL_TARGETS libmrc
265
- VERSION ${PROJECT_VERSION}
266
- LANGUAGES C CXX CUDA
267
- NAMESPACE mrc::
268
- DOCUMENTATION doc_string
269
- FINAL_CODE_BLOCK code_string
270
- )
0 commit comments