@@ -84,9 +84,11 @@ execute_process(COMMAND patch -N -s -V never
84
84
add_library (singularity-eos::flags INTERFACE IMPORTED GLOBAL )
85
85
add_library (singularity-eos::libs INTERFACE IMPORTED )
86
86
87
+ # TODO: Is this generator expression correct/needed?
87
88
target_include_directories (singularity-eos::flags
88
89
INTERFACE
89
- $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR} >)
90
+ $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR} >
91
+ $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR} /utils>)
90
92
91
93
# xl fix
92
94
target_compile_options (singularity-eos::flags INTERFACE
@@ -160,7 +162,10 @@ if (SINGULARITY_USE_KOKKOS)
160
162
set (Kokkos_ENABLE_CUDA_RELOCATABLE_DEVICE_CODE ON CACHE BOOL "" FORCE)
161
163
endif ()
162
164
add_subdirectory (${PROJECT_SOURCE_DIR} /utils/kokkos)
163
- #set(Kokkos_ROOT ${PROJECT_BINARY_DIR}/utils/kokkos)
165
+ install (DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR} /utils/kokkos"
166
+ DESTINATION "include"
167
+ FILES_MATCHING PATTERN "*.hpp"
168
+ )
164
169
endif ()
165
170
endif ()
166
171
# cuda specific flags
@@ -190,9 +195,6 @@ if (SINGULARITY_USE_KOKKOS)
190
195
endif ()
191
196
endif ()
192
197
target_link_libraries (singularity-eos::libs INTERFACE Kokkos::kokkos)
193
- else ()
194
- target_include_directories (singularity-eos::libs INTERFACE
195
- $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR} /utils/herumi-fmath>)
196
198
endif ()
197
199
198
200
# linear algebra library
@@ -248,8 +250,14 @@ if(SINGULARITY_USE_KOKKOSKERNELS)
248
250
SINGULARITY_USE_KOKKOSKERNELS)
249
251
else ()
250
252
# Eigen
251
- find_package (Eigen3 REQUIRED)
252
- target_link_libraries (singularity-eos::flags INTERFACE Eigen3::Eigen)
253
+ if (NOT TARGET Eigen3::Eigen)
254
+ find_package (Eigen3 REQUIRED)
255
+ target_link_libraries (singularity-eos::flags INTERFACE Eigen3::Eigen)
256
+ install (DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR} /utils/eigen"
257
+ DESTINATION "include"
258
+ FILES_MATCHING PATTERN "*.hpp"
259
+ )
260
+ endif ()
253
261
endif ()
254
262
255
263
if (SINGULARITY_USE_EOSPAC)
@@ -293,49 +301,77 @@ if(SINGULARITY_BUILD_TESTS)
293
301
include (${PROJECT_SOURCE_DIR} /utils/spiner/Catch2/contrib/Catch.cmake)
294
302
endif ()
295
303
296
- add_subdirectory (eos)
304
+ add_subdirectory (${PROJECT_SOURCE_DIR} /singularity-eos/ eos)
297
305
if (SINGULARITY_BUILD_TESTS)
298
306
add_subdirectory (test )
299
307
endif ()
300
- if (SINGULARITY_BUILD_SESAME2SPINER)
301
- add_subdirectory (utils)
302
- endif ()
303
- # create the libbedroom_door.a library
308
+ # create the libsingularity-eos.a library
304
309
if (SINGULARITY_USE_FORTRAN)
305
310
add_library (singularity-eos
306
311
$<TARGET_OBJECTS:eos_f>
307
312
$<TARGET_OBJECTS:eos_objs>)
313
+ install (DIRECTORY "${CMAKE_BINARY_DIR} /singularity-eos"
314
+ DESTINATION "include"
315
+ FILES_MATCHING PATTERN "*.mod" )
308
316
else ()
309
317
add_library (singularity-eos
310
318
$<TARGET_OBJECTS:eos_objs>)
311
319
endif ()
312
320
313
321
if (SINGULARITY_USE_HDF5 AND SINGULARITY_BUILD_STELLARCOLLAPSE2SPINER)
314
- add_subdirectory (${PROJECT_SOURCE_DIR} /utils/ stellarcollapse2spiner)
322
+ add_subdirectory (${PROJECT_SOURCE_DIR} /stellarcollapse2spiner)
315
323
install (TARGETS stellarcollapse2spiner DESTINATION bin)
316
324
endif ()
317
325
318
- # install
319
326
install (TARGETS eos singularity-eos DESTINATION lib)
320
327
if (SINGULARITY_BUILD_SESAME2SPINER)
321
328
if (SINGULARITY_USE_EOSPAC)
322
329
if (SINGULARITY_USE_HDF5)
330
+ add_subdirectory (${PROJECT_SOURCE_DIR} /sesame2spiner)
323
331
install (TARGETS sesame2spiner DESTINATION bin)
324
332
endif ()
325
333
endif ()
326
334
endif ()
327
335
328
- set (INSTALL_FILES
329
- ${CMAKE_CURRENT_SOURCE_DIR} /eos/eos.hpp
330
- ${CMAKE_CURRENT_SOURCE_DIR} /utils/sp5/singularity_eos_sp5.hpp)
331
- if (SINGULARITY_BUILD_CLOSURE)
332
- list (APPEND INSTALL_FILES
333
- ${CMAKE_CURRENT_SOURCE_DIR} /eos/singularity_eos.hpp
334
- ${CMAKE_CURRENT_SOURCE_DIR} /closure/mixed_cell_models.hpp)
335
- if (SINGULARITY_USE_FORTRAN)
336
- list (APPEND INSTALL_FILES
337
- ${CMAKE_BINARY_DIR} /eos/singularity_eos.mod
338
- ${CMAKE_BINARY_DIR} /eos/singularity_eos_types.mod)
339
- endif ()
340
- endif ()
341
- install (FILES ${INSTALL_FILES} DESTINATION include )
336
+ # These are always needed.
337
+ # TODO(JMM): Should always-needed utils be moved into a separate
338
+ # directory? Or the optional ones be moved to something like
339
+ # "external"?
340
+ # TODO(JMM): Should I write a function so I'm not repeating all these
341
+ # install calls? More cmake wizardry than I have is required for
342
+ # that, I think.
343
+ install (DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR} /singularity-eos"
344
+ DESTINATION "include"
345
+ FILES_MATCHING PATTERN "*.hpp"
346
+ )
347
+ install (DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR} /utils/fast-math"
348
+ DESTINATION "include"
349
+ FILES_MATCHING PATTERN "*.hpp"
350
+ )
351
+ install (DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR} /utils/herumi-fmath"
352
+ DESTINATION "include"
353
+ FILES_MATCHING PATTERN "*.hpp"
354
+ )
355
+ install (DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR} /utils/root-finding-1d"
356
+ DESTINATION "include"
357
+ FILES_MATCHING PATTERN "*.hpp"
358
+ )
359
+ install (DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR} /utils/sp5"
360
+ DESTINATION "include"
361
+ FILES_MATCHING PATTERN "*.hpp"
362
+ )
363
+ install (DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR} /utils/spiner"
364
+ DESTINATION "include"
365
+ FILES_MATCHING PATTERN "*.hpp"
366
+ )
367
+ install (DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR} /utils/variant"
368
+ DESTINATION "include"
369
+ FILES_MATCHING PATTERN "*.hpp"
370
+ )
371
+ install (CODE
372
+ "execute_process( \
373
+ COMMAND ${CMAKE_COMMAND} -E create_symlink \
374
+ ${CMAKE_INSTALL_PREFIX} /include/spiner/ports-of-call \
375
+ ${CMAKE_INSTALL_PREFIX} /include/ports-of-call \
376
+ )"
377
+ )
0 commit comments