Skip to content

Commit

Permalink
add ability to build fortran backend code without fortran. Useful for…
Browse files Browse the repository at this point in the history
… clang-sanitize builds, since flang is not super well supported yet
  • Loading branch information
jonahm-LANL committed Nov 29, 2024
1 parent 27b3a8a commit ec77b9d
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
13 changes: 13 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,14 @@ cmake_dependent_option(
"SINGULARITY_USE_SPINER" OFF)

option(SINGULARITY_USE_FORTRAN "Enable fortran bindings" ON)
# Optionally build these if you want to build/test the fortran
# infrastructure without invoking a fortran compiler If fortran is
# off, you can set this. If fortran is on, it's forced to ON and is
# not set-able.
cmake_dependent_option(SINGULARITY_BUILD_FORTRAN_BACKEND
"Build the C++ code to which the fortran bindings bind"
OFF "NOT SINGULARITY_USE_FORTRAN" ON)

option(SINGULARITY_USE_KOKKOS "Use Kokkos for portability" OFF)
option(SINGULARITY_USE_EOSPAC "Enable eospac backend" OFF)
option(SINGULARITY_EOSPAC_ENABLE_SHMEM
Expand Down Expand Up @@ -95,6 +103,7 @@ cmake_dependent_option(
# modify flags options
option(SINGULARITY_BETTER_DEBUG_FLAGS "Better debug flags for singularity" ON)
option(SINGULARITY_HIDE_MORE_WARNINGS "hide more warnings" OFF)
option(SINGULARITY_STRICT_WARNINGS "Make warnings strict" OFF)

# toggle code options
option(SINGULARITY_USE_TRUE_LOG_GRIDDING
Expand Down Expand Up @@ -552,6 +561,10 @@ target_compile_options(
> # release
> # cuda
)
if (SINGULARITY_STRICT_WARNINGS)
target_compile_options(singularity-eos_Interface INTERFACE
-Wall -Werror)
endif()

if(TARGET singularity-eos_Library)
target_compile_options(singularity-eos_Library PRIVATE ${xlfix})
Expand Down
4 changes: 2 additions & 2 deletions singularity-eos/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,13 @@ if (SINGULARITY_BUILD_CLOSURE)
closure/kinetic_phasetransition_utils.hpp
closure/kinetic_phasetransition_methods.hpp
)
if (SINGULARITY_USE_FORTRAN OR SINGULARITY_BUILD_TESTS)
if (SINGULARITY_BUILD_FORTRAN_BACKEND OR SINGULARITY_BUILD_TESTS)
# while these are C++ files, they
# are only needed for the fortran backend or unit testing
register_srcs(eos/singularity_eos.cpp)
register_headers(eos/singularity_eos.hpp)
endif()
if (SINGULARITY_USE_FORTRAN)
if (SINGULARITY_BUILD_FORTRAN_BACKEND)
register_srcs(eos/get_sg_eos.cpp)
if (SINGULARITY_USE_KOKKOS)
register_srcs(
Expand Down
2 changes: 1 addition & 1 deletion test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ if(SINGULARITY_BUILD_CLOSURE)
endif()
endif()
# disable fortran tests when using OpenMP due to segfaults
if(SINGULARITY_USE_KOKKOS AND SINGULARITY_USE_FORTRAN AND NOT Kokkos_ENABLE_OPENMP)
if(SINGULARITY_USE_KOKKOS AND SINGULARITY_BUILD_FORTRAN_BACKEND AND NOT Kokkos_ENABLE_OPENMP)
add_executable(test_get_sg_eos test_get_sg_eos.cpp)
target_link_libraries(test_get_sg_eos PRIVATE Catch2::Catch2
singularity-eos::singularity-eos)
Expand Down

0 comments on commit ec77b9d

Please sign in to comment.