Default cases seem to work

This commit is contained in:
Martin Diehl 2017-02-04 01:01:42 +01:00
parent 3e7ab76582
commit b67f4dd324
3 changed files with 48 additions and 29 deletions

View File

@ -115,16 +115,33 @@ set(CMAKE_Fortran_COMPILER "${PETSC_MPIFC}")
set(CMAKE_C_COMPILER "${PETSC_MPICC}") set(CMAKE_C_COMPILER "${PETSC_MPICC}")
set(CMAKE_LINKER "${PETSC_LINKER}") set(CMAKE_LINKER "${PETSC_LINKER}")
# Built-in options for DAMASK build system # Predefined sets for OPTIMIZATION/OPENMP based on BUILD_TYPE
# -> can be overwritten from commandline/install_script if("${CMAKE_BUILD_TYPE}" STREQUAL "DEBUG" OR "${CMAKE_BUILD_TYPE}" STREQUAL "SYNTAXONLY" )
option(OPENMP "Use OpenMP libaries for DAMASK" ON ) set (PARALLEL "OFF")
option(OPTIMIZATION "DAMASK optimization level [OFF,DEFENSIVE,AGGRESSIVE]" "DEFENSIVE" ) set (OPTI "OFF")
set (BUILDCMD_POST "${BUILDCMD_POST} -fsyntax-only")
if("${CMAKE_BUILD_TYPE}" STREQUAL "DEBUG") elseif("${CMAKE_BUILD_TYPE}" STREQUAL "RELEASE")
set (OPENMP "OFF") set (PARALLEL "ON")
set (OPTIMIZATION "OFF") set (OPTI "DEFENSIVE")
elseif("${CMAKE_BUILD_TYPE}" STREQUAL "PERFORMANCE")
set (PARALLEL "ON")
set (OPTI "AGGRESSIVE")
endif("${CMAKE_BUILD_TYPE}" STREQUAL "DEBUG") endif("${CMAKE_BUILD_TYPE}" STREQUAL "DEBUG")
# overwrite optimization if given
if("${OPTIMIZATION}" STREQUAL "")
set(OPTIMIZATION "${OPTI}")
else("${OPTIMIZATION}" STREQUAL "")
set(OPTIMIZATION "${OPTIMIZATION}")
endif("${OPTIMIZATION}" STREQUAL "")
# overwrite optimization if given
if("${OPENMP}" STREQUAL "")
set(OPENMP "${PARALLEL}")
else("${OPENMP}" STREQUAL "")
set(OPENMP "${OPENMP}")
endif("${OPENMP}" STREQUAL "")
# Parse DAMASK_BIN from CONFIG file # Parse DAMASK_BIN from CONFIG file
file(READ "CONFIG" CONFIGFILE) file(READ "CONFIG" CONFIGFILE)
STRING(REGEX REPLACE ";" "\\\\;" CONFIGFILE "${CONFIGFILE}") STRING(REGEX REPLACE ";" "\\\\;" CONFIGFILE "${CONFIGFILE}")
@ -132,13 +149,9 @@ STRING(REGEX REPLACE "\n" ";" CONFIGFILE "${CONFIGFILE}")
FOREACH(item ${CONFIGFILE}) FOREACH(item ${CONFIGFILE})
STRING(REGEX MATCH ".+DAMASK_BIN.+" item ${item}) STRING(REGEX MATCH ".+DAMASK_BIN.+" item ${item})
IF(item) IF(item)
message("${item}")
string(REGEX REPLACE "set" "" item "${item}") string(REGEX REPLACE "set" "" item "${item}")
message("${item}")
string(REGEX REPLACE "=" " " item "${item}") string(REGEX REPLACE "=" " " item "${item}")
message("${item}") string(REGEX REPLACE "\\\${DAMASK_ROOT}" "${PROJECT_SOURCE_DIR}" item "${item}")
string(REGEX REPLACE "\\\${DAMASK_ROOT}" "${CMAKE_CURRENT_SOURCE_DIR}" item "${item}")
message("${item}")
string(REPLACE "DAMASK_BIN" ";" STRING_LIST ${item}) string(REPLACE "DAMASK_BIN" ";" STRING_LIST ${item})
list(GET STRING_LIST 1 item) list(GET STRING_LIST 1 item)
string(STRIP "${item}" CMAKE_INSTALL_PREFIX) string(STRIP "${item}" CMAKE_INSTALL_PREFIX)
@ -387,9 +400,9 @@ elseif(${CMAKE_Fortran_COMPILER_ID} STREQUAL "GNU")
# stop execution if floating point exception is detected (NaN is silent) # stop execution if floating point exception is detected (NaN is silent)
set (DEBUG_FLAGS "${DEBUG_FLAGS} -g") set (DEBUG_FLAGS "${DEBUG_FLAGS} -g")
# Generate symbolic debugging information in the object file # Generate symbolic debugging information in the object file
set (DEBUG_FLAGS "${DEBUG_FLAGS} -fbacktrace" ) set (DEBUG_FLAGS "${DEBUG_FLAGS} -fbacktrace")
set (DEBUG_FLAGS "${DEBUG_FLAGS} -fdump-core" ) set (DEBUG_FLAGS "${DEBUG_FLAGS} -fdump-core")
set (DEBUG_FLAGS "${DEBUG_FLAGS} -fcheck=all" ) set (DEBUG_FLAGS "${DEBUG_FLAGS} -fcheck=all")
# checks for (array-temps,bounds,do,mem,pointer,recursion) # checks for (array-temps,bounds,do,mem,pointer,recursion)
# Additional options # Additional options
@ -425,10 +438,16 @@ message("Linker Flags (Fortran):\n${CMAKE_Fortran_LINK_EXECUTABLE}\n")
add_subdirectory(src) add_subdirectory(src)
# INSTALL BUILT BINARIES # INSTALL BUILT BINARIES
if ("${PROJECT_NAME}" STREQUAL "DAMASK_spectral") if ("${BUILD_TYPE}" STREQUAL SYNTAXONLY)
INSTALL(PROGRAMS ${PROJECT_BINARY_DIR}/src/DAMASK_spectral if ("${PROJECT_NAME}" STREQUAL DAMASK_spectral)
DESTINATION ${CMAKE_INSTALL_PREFIX}) INSTALL(PROGRAMS ${PROJECT_BINARY_DIR}/src/DAMASK_spectral
elseif ("${PROJECT_NAME}" STREQUAL "DAMASK_FEM") DESTINATION ${CMAKE_INSTALL_PREFIX})
INSTALL(PROGRAMS ${PROJECT_BINARY_DIR}/src/DAMASK_FEM elseif ("${PROJECT_NAME}" STREQUAL DAMASK_FEM)
DESTINATION ${CMAKE_INSTALL_PREFIX}) INSTALL(PROGRAMS ${PROJECT_BINARY_DIR}/src/DAMASK_FEM
endif("${PROJECT_NAME}" STREQUAL "DAMASK_spectral") DESTINATION ${CMAKE_INSTALL_PREFIX})
endif("${PROJECT_NAME}" STREQUAL DAMASK_spectral)
else("${BUILD_TYPE}" STREQUAL SYNTAXONLY)
exec_program(mktemp ARGS -d OUTPUT_VARIABLE BLACK_HOLE)
INSTALL(PROGRAMS ${PROJECT_BINARY_DIR}/src/prec.mod
DESTINATION ${BLACK_HOLE})
endif()

View File

@ -11,15 +11,14 @@ FEM: build/FEM
@(cd build/FEM; make --no-print-directory -ws all install;) @(cd build/FEM; make --no-print-directory -ws all install;)
OPTIONS="-Wno-dev -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DBUILDCMD_POST=${BUILDCMD_POST} -DBUILDCMD_PRE={BUILDCMD_PRE} -DOPTIMIZATION=${OPTIMIZATION} -DOPENMP=${OPENMP}"
build/spectral: build build/spectral: build
@mkdir -p build/spectral @mkdir -p build/spectral
@(cd build/spectral; cmake -DDAMASK_SOLVER=SPECTRAL ${OPTIONS} ../..;) @(cd build/spectral; cmake -Wno-dev -DDAMASK_SOLVER=SPECTRAL -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DBUILDCMD_POST=${BUILDCMD_POST} -DBUILDCMD_PRE=${BUILDCMD_PRE} -DOPTIMIZATION=${OPTIMIZATION} -DOPENMP=${OPENMP} ../../;)
build/FEM: build build/FEM: build
@mkdir -p build/FEM @mkdir -p build/FEM
@(cd build/FEM; cmake -DDAMASK_SOLVER=FEM ${OPTIONS} ../..;) @(cd build/FEM; cmake -Wno-dev -DDAMASK_SOLVER=FEM -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DBUILDCMD_POST=${BUILDCMD_POST} -DBUILDCMD_PRE=${BUILDCMD_PRE} -DOPTIMIZATION=${OPTIMIZATION} -DOPENMP=${OPENMP} ../../;)
build: build:

View File

@ -185,9 +185,10 @@ if ("${PROJECT_NAME}" STREQUAL "DAMASK_spectral")
"spectral_mech_Basic.f90") "spectral_mech_Basic.f90")
add_dependencies(SPECTRAL_SOLVER SPECTRAL_UTILITIES) add_dependencies(SPECTRAL_SOLVER SPECTRAL_UTILITIES)
list(APPEND OBJECTFILES $<TARGET_OBJECTS:SPECTRAL_SOLVER>) list(APPEND OBJECTFILES $<TARGET_OBJECTS:SPECTRAL_SOLVER>)
if(NOT "${CMAKE_BUILD_TYPE}" STREQUAL SYNTAXONLY)
add_executable(DAMASK_spectral "DAMASK_spectral.f90" ${OBJECTFILES}) add_executable(DAMASK_spectral "DAMASK_spectral.f90" ${OBJECTFILES})
add_dependencies(DAMASK_spectral SPECTRAL_SOLVER) add_dependencies(DAMASK_spectral SPECTRAL_SOLVER)
endif()
elseif ("${PROJECT_NAME}" STREQUAL "DAMASK_FEM") elseif ("${PROJECT_NAME}" STREQUAL "DAMASK_FEM")
add_library(FEM_UTILITIES OBJECT "FEM_utilities.f90") add_library(FEM_UTILITIES OBJECT "FEM_utilities.f90")
add_dependencies(FEM_UTILITIES DAMASK_CPFE) add_dependencies(FEM_UTILITIES DAMASK_CPFE)