for spack, following DealII

https://spack.readthedocs.io/en/latest/build_systems/cmakepackage.html
'RelWithDebInfo' is not easy to remember
This commit is contained in:
Martin Diehl 2021-07-06 06:48:02 +02:00
parent 4e11fba643
commit 249365979f
1 changed files with 8 additions and 1 deletions

View File

@ -21,7 +21,7 @@ if (DAMASK_SOLVER STREQUAL "GRID")
elseif (DAMASK_SOLVER STREQUAL "MESH")
project (damask-mesh HOMEPAGE_URL https://damask.mpie.de LANGUAGES Fortran C)
else ()
message (FATAL_ERROR "Build target (DAMASK_SOLVER) is not defined")
message (FATAL_ERROR "Invalid solver: DAMASK_SOLVER=${DAMASK_SOLVER}")
endif ()
add_definitions ("-D${DAMASK_SOLVER}")
@ -35,6 +35,7 @@ add_definitions (-DDAMASKVERSION="${DAMASK_VERSION}")
if (CMAKE_BUILD_TYPE STREQUAL "")
set (CMAKE_BUILD_TYPE "RELEASE")
endif ()
string(TOUPPER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE)
# Predefined sets for OPTIMIZATION/OPENMP based on BUILD_TYPE
if (CMAKE_BUILD_TYPE STREQUAL "DEBUG" OR CMAKE_BUILD_TYPE STREQUAL "SYNTAXONLY")
@ -44,9 +45,15 @@ if (CMAKE_BUILD_TYPE STREQUAL "DEBUG" OR CMAKE_BUILD_TYPE STREQUAL "SYNTAXONLY")
elseif (CMAKE_BUILD_TYPE STREQUAL "RELEASE")
set (PARALLEL "ON")
set (OPTI "DEFENSIVE")
elseif (CMAKE_BUILD_TYPE STREQUAL "DEBUGRELEASE")
set (DEBUG_FLAGS "${DEBUG_FLAGS} -DDEBUG")
set (PARALLEL "ON")
set (OPTI "DEFENSIVE")
elseif (CMAKE_BUILD_TYPE STREQUAL "PERFORMANCE")
set (PARALLEL "ON")
set (OPTI "AGGRESSIVE")
else ()
message (FATAL_ERROR "Invalid build type: CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}")
endif ()
# $OPTIMIZATION takes precedence over $BUILD_TYPE defaults