Skip to content

Commit 54c5730

Browse files
authored
Merge pull request #17 from lanl/feature/reorg
first pass at reorganziing singularity-eos
2 parents 255632d + debec4c commit 54c5730

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+336
-238
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
bin
12
.spack*
23
spack.lock
4+
utils/variant
35
*__pycache__*

CMakeLists.txt

Lines changed: 64 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,11 @@ execute_process(COMMAND patch -N -s -V never
8484
add_library (singularity-eos::flags INTERFACE IMPORTED GLOBAL)
8585
add_library (singularity-eos::libs INTERFACE IMPORTED)
8686

87+
# TODO: Is this generator expression correct/needed?
8788
target_include_directories(singularity-eos::flags
8889
INTERFACE
89-
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}>)
90+
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}>
91+
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/utils>)
9092

9193
# xl fix
9294
target_compile_options(singularity-eos::flags INTERFACE
@@ -160,7 +162,10 @@ if (SINGULARITY_USE_KOKKOS)
160162
set(Kokkos_ENABLE_CUDA_RELOCATABLE_DEVICE_CODE ON CACHE BOOL "" FORCE)
161163
endif()
162164
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+
)
164169
endif()
165170
endif()
166171
# cuda specific flags
@@ -190,9 +195,6 @@ if (SINGULARITY_USE_KOKKOS)
190195
endif()
191196
endif()
192197
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>)
196198
endif ()
197199

198200
# linear algebra library
@@ -248,8 +250,14 @@ if(SINGULARITY_USE_KOKKOSKERNELS)
248250
SINGULARITY_USE_KOKKOSKERNELS)
249251
else()
250252
# 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()
253261
endif()
254262

255263
if (SINGULARITY_USE_EOSPAC)
@@ -293,49 +301,77 @@ if(SINGULARITY_BUILD_TESTS)
293301
include(${PROJECT_SOURCE_DIR}/utils/spiner/Catch2/contrib/Catch.cmake)
294302
endif()
295303

296-
add_subdirectory(eos)
304+
add_subdirectory(${PROJECT_SOURCE_DIR}/singularity-eos/eos)
297305
if (SINGULARITY_BUILD_TESTS)
298306
add_subdirectory(test)
299307
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
304309
if(SINGULARITY_USE_FORTRAN)
305310
add_library(singularity-eos
306311
$<TARGET_OBJECTS:eos_f>
307312
$<TARGET_OBJECTS:eos_objs>)
313+
install(DIRECTORY "${CMAKE_BINARY_DIR}/singularity-eos"
314+
DESTINATION "include"
315+
FILES_MATCHING PATTERN "*.mod")
308316
else()
309317
add_library(singularity-eos
310318
$<TARGET_OBJECTS:eos_objs>)
311319
endif()
312320

313321
if (SINGULARITY_USE_HDF5 AND SINGULARITY_BUILD_STELLARCOLLAPSE2SPINER)
314-
add_subdirectory(${PROJECT_SOURCE_DIR}/utils/stellarcollapse2spiner)
322+
add_subdirectory(${PROJECT_SOURCE_DIR}/stellarcollapse2spiner)
315323
install(TARGETS stellarcollapse2spiner DESTINATION bin)
316324
endif()
317325

318-
# install
319326
install(TARGETS eos singularity-eos DESTINATION lib)
320327
if(SINGULARITY_BUILD_SESAME2SPINER)
321328
if(SINGULARITY_USE_EOSPAC)
322329
if(SINGULARITY_USE_HDF5)
330+
add_subdirectory(${PROJECT_SOURCE_DIR}/sesame2spiner)
323331
install(TARGETS sesame2spiner DESTINATION bin)
324332
endif()
325333
endif()
326334
endif()
327335

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+
)
File renamed without changes.

utils/sesame2spiner/CMakeLists.txt renamed to sesame2spiner/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,10 @@ add_executable(sesame2spiner
2121
)
2222

2323
target_include_directories(sesame2spiner PUBLIC
24-
${CMAKE_CURRENT_SOURCE_DIR}/../spiner
2524
${CMAKE_CURRENT_BINARY_DIR}
2625
${CMAKE_CURRENT_SOURCE_DIR}
2726
)
2827

2928
target_link_libraries(sesame2spiner nlohmann_json::nlohmann_json singularity-eos::libs singularity-eos::flags)
29+
30+
# TODO: Add tests for sesame2spiner here.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)