Skip to content

Commit

Permalink
CMake: improve handling of options (AMReX-Codes#946)
Browse files Browse the repository at this point in the history
* CMake: move general setup operations out of AMReX_Options.cmake

* CMake: better handling of option inter-dependencies via cmake_dependent_option

* CMake: refactor AMReX_Options.cmake

* Update Tools/CMake/AMReX_Options.cmake

Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja>

* Update CMakeLists.txt

Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja>

* Update Tools/CMake/AMReX_Options.cmake

Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja>

Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja>
  • Loading branch information
mic84 and ax3l authored Jun 1, 2020
1 parent 227bf82 commit af68380
Show file tree
Hide file tree
Showing 3 changed files with 143 additions and 163 deletions.
14 changes: 14 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,20 @@ if ( CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR AND CMAKE_INSTALL_PREFIX_INITI
CACHE PATH "AMReX installation directory" FORCE)
endif ()

message(STATUS "AMReX installation directory: ${CMAKE_INSTALL_PREFIX}")

#
# Check if CMAKE_BUILD_TYPE is given. If not, use default
#
if ( NOT CMAKE_BUILD_TYPE )
set(CMAKE_CONFIGURATION_TYPES "Release;Debug;MinSizeRel;RelWithDebInfo")
set(CMAKE_BUILD_TYPE Release
CACHE STRING
"Choose the build type, e.g. Release, Debug, or RelWithDebInfo." FORCE)
else ()
message(STATUS "Build type set by user to '${CMAKE_BUILD_TYPE}'.")
endif()

#
# Include options, utilities and other stuff we need
#
Expand Down
41 changes: 21 additions & 20 deletions Src/Extern/SUNDIALS4/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
if (ENABLE_FORTRAN_INTERFACES)
target_sources( amrex
PRIVATE
fsundials_types_mod.f90
fnvector_mod.f90
fnvector_serial_mod.f90
fsunmatrix_mod.f90
fsunmatrix_dense_mod.f90
fsunlinsol_mod.f90
fsunlinsol_dense_mod.f90
# ARKode interfaces
arkode_interface.f90
farkode_mod.f90
farkode_arkstep_mod.f90
# CVODE interfaces
cvode_interface.f90
fcvode_mod.f90
)
endif ()
#
# Fortran interfaces to SUNDIALS routines
#
target_sources( amrex
PRIVATE
fsundials_types_mod.f90
fnvector_mod.f90
fnvector_serial_mod.f90
fsunmatrix_mod.f90
fsunmatrix_dense_mod.f90
fsunlinsol_mod.f90
fsunlinsol_dense_mod.f90
# ARKode interfaces
arkode_interface.f90
farkode_mod.f90
farkode_arkstep_mod.f90
# CVODE interfaces
cvode_interface.f90
fcvode_mod.f90
)

#
# We link to libraries and always include nvecserial (in case app code needs it)
Expand All @@ -34,7 +35,7 @@ endif ()
find_package(SUNDIALS 4 REQUIRED COMPONENTS ${_sundials_components})

foreach (_comp ${_sundials_components})
target_link_libraries(amrex PUBLIC SUNDIALS::${_comp})
target_link_libraries(amrex PUBLIC SUNDIALS::${_comp})
endforeach ()

target_compile_definitions(amrex PUBLIC AMREX_USE_SUNDIALS_3x4x)
Loading

0 comments on commit af68380

Please sign in to comment.