currently, only BUILD_CMD_TYPE release works

This commit is contained in:
Martin Diehl 2016-05-21 15:06:01 +02:00
parent 0810295fe9
commit e3d8d48990
3 changed files with 200 additions and 210 deletions

View File

@ -30,8 +30,9 @@ include ${petsc_conf_rules}
include ${petsc_conf_variables} include ${petsc_conf_variables}
INCLUDE_DIRS := \${PETSC_FC_INCLUDES} INCLUDE_DIRS := \${PETSC_FC_INCLUDES}
LIBRARIES := \${PETSC_WITH_EXTERNAL_LIB} LIBRARIES := \${PETSC_WITH_EXTERNAL_LIB}
COMPILERF ?= \${FC} COMPILERF := \${FC}
LINKERNAME ?= \${FLINKER} COMPILERC := \${CC}
LINKERNAME := \${FLINKER}
includes: includes:
\t@echo \${INCLUDE_DIRS} \t@echo \${INCLUDE_DIRS}
extlibs: extlibs:
@ -60,10 +61,15 @@ execute_process(COMMAND ${MAKE_EXECUTABLE} --no-print-directory -f ${petsc_confi
RESULT_VARIABLE PETSC_EXTERNAL_LIB_RETURN RESULT_VARIABLE PETSC_EXTERNAL_LIB_RETURN
OUTPUT_VARIABLE petsc_external_lib OUTPUT_VARIABLE petsc_external_lib
OUTPUT_STRIP_TRAILING_WHITESPACE) OUTPUT_STRIP_TRAILING_WHITESPACE)
# PETSc specified compiler # PETSc specified fortran compiler
execute_process(COMMAND ${MAKE_EXECUTABLE} --no-print-directory -f ${petsc_config_makefile} "compilerf" execute_process(COMMAND ${MAKE_EXECUTABLE} --no-print-directory -f ${petsc_config_makefile} "compilerf"
RESULT_VARIABLE MPIFC_RETURN RESULT_VARIABLE PETSC_MPIFC_RETURN
OUTPUT_VARIABLE MPIFC OUTPUT_VARIABLE PETSC_MPIFC
OUTPUT_STRIP_TRAILING_WHITESPACE)
# PETSc specified C compiler
execute_process(COMMAND ${MAKE_EXECUTABLE} --no-print-directory -f ${petsc_config_makefile} "compilerc"
RESULT_VARIABLE PETSC_MPICC_RETURN
OUTPUT_VARIABLE PETSC_MPICC
OUTPUT_STRIP_TRAILING_WHITESPACE) OUTPUT_STRIP_TRAILING_WHITESPACE)
# PETSc specified linker (MPIF90 + PETSc linking flags) # PETSc specified linker (MPIF90 + PETSc linking flags)
execute_process(COMMAND ${MAKE_EXECUTABLE} --no-print-directory -f ${petsc_config_makefile} "linker" execute_process(COMMAND ${MAKE_EXECUTABLE} --no-print-directory -f ${petsc_config_makefile} "linker"
@ -85,51 +91,37 @@ foreach (exlib ${TMP_LIST})
set(PETSC_EXTERNAL_LIB "${PETSC_EXTERNAL_LIB} ${exlib}") set(PETSC_EXTERNAL_LIB "${PETSC_EXTERNAL_LIB} ${exlib}")
endforeach(exlib) endforeach(exlib)
set(CMAKE_Fortran_COMPILER "${MPIFC}") # https://cmake.org/Wiki/CMake_FAQ#How_do_I_use_a_different_compiler.3F
# DAMASK DRIVER SELECTION set(CMAKE_Fortran_COMPILER "${PETSC_MPIFC}")
if ("${DAMASK_DRIVER}" STREQUAL "SPECTRAL") set(CMAKE_C_COMPILER "${PETSC_MPICC}")
project(DAMASK_spectral Fortran) set(CMAKE_LINKER "${PETSC_LINKER}")
add_definitions(-DSpectral)
message("***Configuring Spectral Solver\n")
elseif ("${DAMASK_DRIVER}" STREQUAL "FEM")
project(DAMASK_FEM Fortran)
add_definitions(-DFEM)
message("***Configuring FEM Solver\n")
endif()
# Find DAMASK version (DAMASK_V) in DAMASK_ROOT
find_program (CAT_EXECUTABLE NAMES cat)
execute_process(COMMAND ${CAT_EXECUTABLE} ${PROJECT_SOURCE_DIR}/VERSION
RESULT_VARIABLE DAMASK_VERSION_RETURN
OUTPUT_VARIABLE DAMASK_V
OUTPUT_STRIP_TRAILING_WHITESPACE)
message("***Found PETSC_DIR:\n${PETSC_DIR}\n" ) message("***Found PETSC_DIR:\n${PETSC_DIR}\n" )
message("***Found PETSC_INCLUDES:\n${PETSC_INCLUDES}\n" ) message("***Found PETSC_INCLUDES:\n${PETSC_INCLUDES}\n" )
message("***Found PETSC_EXTERNAL_LIB:\n${PETSC_EXTERNAL_LIB}\n") message("***Found PETSC_EXTERNAL_LIB:\n${PETSC_EXTERNAL_LIB}\n")
message("***Found PETSC_LINKER:\n${PETSC_LINKER}\n" ) message("***Found PETSC_LINKER:\n${PETSC_LINKER}\n" )
message("***Found FORTRAN MPI COMPILER:\n${MPIFC}\n" ) message("***Found MPI FORTRAN COMPILER:\n${PETSC_MPIFC}\n" )
message("***Found MPI C COMPILER:\n${PETSC_MPICC}\n" )
# # https://cmake.org/Wiki/CMake_FAQ#How_do_I_use_a_different_compiler.3F
#--------------------------------------------------------------------------------------- #---------------------------------------------------------------------------------------
# Now start to care about DAMASK # Now start to care about DAMASK
# DAMASK Solver selection
if ("${DAMASK_DRIVER}" STREQUAL "SPECTRAL")
project(DAMASK_spectral Fortran C)
add_definitions(-DSpectral)
message("***Configuring Spectral Solver\n")
elseif ("${DAMASK_DRIVER}" STREQUAL "FEM")
project(DAMASK_FEM Fortran C)
add_definitions(-DFEM)
message("***Configuring FEM Solver\n")
endif()
# Built-in options for DAMASK build system # Built-in options for DAMASK build system
# -> can be overwritten from commandline/install_script # -> can be overwritten from commandline/install_script
option(OPENMP "Use OpenMP libaries for DAMASK" ON ) option(OPENMP "Use OpenMP libaries for DAMASK" ON )
option(OPTIMIZATION "DAMASK optimization level [OFF,DEFENSIVE,AGGRESSIVE]" "DEFENSIVE" ) option(OPTIMIZATION "DAMASK optimization level [OFF,DEFENSIVE,AGGRESSIVE]" "DEFENSIVE" )
if (NOT DEFINED CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif(NOT DEFINED CMAKE_BUILD_TYPE)
# COMPILE VARIABLES
add_definitions(-DDAMASKVERSION="${DAMASK_V}")
add_definitions(-DPETSc)
add_definitions(-DFLOAT=8)
add_definitions(-DINT=4)
# Setting installation prefix # Setting installation prefix
if (DEFINED DAMASK_INSTALL) if (DEFINED DAMASK_INSTALL)
set (CMAKE_INSTALL_PREFIX "${DAMASK_INSTALL}") set (CMAKE_INSTALL_PREFIX "${DAMASK_INSTALL}")
@ -138,6 +130,23 @@ else(DEFINED DAMASK_INSTALL)
endif(DEFINED DAMASK_INSTALL) endif(DEFINED DAMASK_INSTALL)
message("\n***The binary will be installed at\n${CMAKE_INSTALL_PREFIX}\n") message("\n***The binary will be installed at\n${CMAKE_INSTALL_PREFIX}\n")
# Set build options
if (NOT DEFINED CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif(NOT DEFINED CMAKE_BUILD_TYPE)
# Find DAMASK version (DAMASK_V) in DAMASK_ROOT
find_program (CAT_EXECUTABLE NAMES cat)
execute_process(COMMAND ${CAT_EXECUTABLE} ${PROJECT_SOURCE_DIR}/VERSION
RESULT_VARIABLE DAMASK_VERSION_RETURN
OUTPUT_VARIABLE DAMASK_V
OUTPUT_STRIP_TRAILING_WHITESPACE)
add_definitions(-DDAMASKVERSION="${DAMASK_V}")
# definition of other macros
add_definitions(-DPETSc)
add_definitions(-DFLOAT=8)
add_definitions(-DINT=4)
set (DAMASK_INCLUDE_FLAGS "${DAMASK_INCLUDE_FLAGS} ${PETSC_INCLUDES}" ) set (DAMASK_INCLUDE_FLAGS "${DAMASK_INCLUDE_FLAGS} ${PETSC_INCLUDES}" )
set (DAMASK_INCLUDE_FLAGS "${DAMASK_INCLUDE_FLAGS} -I${PROJECT_SOURCE_DIR}/lib") set (DAMASK_INCLUDE_FLAGS "${DAMASK_INCLUDE_FLAGS} -I${PROJECT_SOURCE_DIR}/lib")
@ -164,8 +173,6 @@ if(${CMAKE_Fortran_COMPILER_ID} STREQUAL "Intel")
#------------------------------------------------------------------------------------------------ #------------------------------------------------------------------------------------------------
# COMPILE SWITCHES # COMPILE SWITCHES
# -fpp: preprocessor
# -ftz: flush unterflow to zero, automatically set if O<0,1,2,3> >0
# -assume byterecl record length is given in bytes (also set by -standard-semantics) # -assume byterecl record length is given in bytes (also set by -standard-semantics)
# fpe_summary print list of floating point exceptions occured during execution # fpe_summary print list of floating point exceptions occured during execution
# -fimplicit-none: assume "implicit-none" even if not present in source # -fimplicit-none: assume "implicit-none" even if not present in source
@ -181,14 +188,9 @@ if(${CMAKE_Fortran_COMPILER_ID} STREQUAL "Intel")
# unused: declared variables that are never used # unused: declared variables that are never used
# stderrors: warnings about Fortran standard violations are changed to errors (STANDARD_CHECK) # stderrors: warnings about Fortran standard violations are changed to errors (STANDARD_CHECK)
# #
# MORE OPTIONS FOR DEBUGGING DURING COMPILATION
# -warn: enables warnings, where set (COMPILE_FLAGS "${COMPILE_FLAGS} -fpp" )# preprocessor
# truncated_source: Determines whether warnings occur when source exceeds the maximum column width in fixed-format files. (too many warnings because we have comments beyond character 132) set (COMPILE_FLAGS "${COMPILE_FLAGS} -ftz" )# flush unterflow to zero, automatically set if O<0,1,2,3> >0
# uncalled: Determines whether warnings occur when a statement function is never called
# all:
# -name as_is: case sensitive Fortran!
set (COMPILE_FLAGS "${COMPILE_FLAGS} -fpp" )
set (COMPILE_FLAGS "${COMPILE_FLAGS} -ftz" )
set (COMPILE_FLAGS "${COMPILE_FLAGS} -assume byterecl,fpe_summary") set (COMPILE_FLAGS "${COMPILE_FLAGS} -assume byterecl,fpe_summary")
set (COMPILE_FLAGS "${COMPILE_FLAGS} -diag-disable 5268" ) set (COMPILE_FLAGS "${COMPILE_FLAGS} -diag-disable 5268" )
set (COMPILE_FLAGS "${COMPILE_FLAGS} -warn declarations" ) set (COMPILE_FLAGS "${COMPILE_FLAGS} -warn declarations" )
@ -198,42 +200,37 @@ if(${CMAKE_Fortran_COMPILER_ID} STREQUAL "Intel")
set (COMPILE_FLAGS "${COMPILE_FLAGS} -warn ignore_loc" ) set (COMPILE_FLAGS "${COMPILE_FLAGS} -warn ignore_loc" )
set (COMPILE_FLAGS "${COMPILE_FLAGS} -warn alignments" ) set (COMPILE_FLAGS "${COMPILE_FLAGS} -warn alignments" )
set (COMPILE_FLAGS "${COMPILE_FLAGS} -warn unused" ) set (COMPILE_FLAGS "${COMPILE_FLAGS} -warn unused" )
# MORE OPTIONS FOR DEBUGGING DURING COMPILATION
# -warn: enables warnings, where
# truncated_source: Determines whether warnings occur when source exceeds the maximum column width in fixed-format files. (too many warnings because we have comments beyond character 132)
# uncalled: Determines whether warnings occur when a statement function is never called
# all:
# -name as_is: case sensitive Fortran!
#------------------------------------------------------------------------------------------------ #------------------------------------------------------------------------------------------------
# COMPILE SWITCHES FOR RUNTIME DEBUGGING # COMPILE SWITCHES FOR RUNTIME DEBUGGING
# -g: Generate symbolic debugging information in the object file set (DEBUG_FLAGS "${DEBUG_FLAGS} -g" )# Generate symbolic debugging information in the object file
# -traceback: Generate extra information in the object file to provide source file traceback information when a severe error occurs at run time. set (DEBUG_FLAGS "${DEBUG_FLAGS} -traceback" )# Generate extra information in the object file to provide source file traceback information when a severe error occurs at run time.
# -gen-interfaces: Generate an interface block for each routine. http://software.intel.com/en-us/blogs/2012/01/05/doctor-fortran-gets-explicit-again/ set (DEBUG_FLAGS "${DEBUG_FLAGS} -gen-interfaces" )# Generate an interface block for each routine. http://software.intel.com/en-us/blogs/2012/01/05/doctor-fortran-gets-explicit-again/
# -fp-stack-check: Generate extra code after every function call to ensure that the floating-point (FP) stack is in the expected state. set (DEBUG_FLAGS "${DEBUG_FLAGS} -fp-stack-check" )# Generate extra code after every function call to ensure that the floating-point (FP) stack is in the expected state.
# -ftrapuv Trap uninitalized variables set (DEBUG_FLAGS "${DEBUG_FLAGS} -fp-model strict" )# Trap uninitalized variables
# -check: checks at runtime, where set (DEBUG_FLAGS "${DEBUG_FLAGS} -check bounds,format,output_conversion,pointers,uninit" )# Checks at runtime, where
# bounds: check if an array index is too small (<1) or too large! # bounds: if an array index is too small (<1) or too large!
# format: Checking for the data type of an item being formatted for output. # format: for the data type of an item being formatted for output.
# output_conversion: Checking for the fit of data items within a designated format descriptor field. # output_conversion: for the fit of data items within a designated format descriptor field.
# pointers: Checking for certain disassociated or uninitialized pointers or unallocated allocatable objects. # pointers: for certain disassociated or uninitialized pointers or unallocated allocatable objects.
# uninit: Checking for uninitialized variables. # uninit: for uninitialized variables.
# -fpe-all0 capture all floating-point exceptions, sets -ftz automatically set (DEBUG_FLAGS "${DEBUG_FLAGS} -ftrapuv" )
# -warn: enables warnings, where set (DEBUG_FLAGS "${DEBUG_FLAGS} -fpe-all0" )# Capture all floating-point exceptions, sets -ftz automatically
# errors: warnings are changed to errors set (DEBUG_FLAGS "${DEBUG_FLAGS} -warn errors,stderrors" )# Configures warnings, where
# stderrors: warnings about Fortran standard violations are changed to errors # errors: warnings are changed to errors
# information on http://software.intel.com/en-us/articles/determining-root-cause-of-sigsegv-or-sigbus-errors/ # stderrors: warnings about Fortran standard violations are changed to errors
# set (DEBUG_FLAGS "${DEBUG_FLAGS} -debug-parameters all" )
# MORE OPTIONS FOR RUNTIME DEBUGGING # MORE OPTIONS FOR RUNTIME DEBUGGING
# -heap-arrays: should not be done for OpenMP, but set "ulimit -s unlimited" on shell. Probably it helps also to unlimit other limits # -heap-arrays: Should not be done for OpenMP, but set "ulimit -s unlimited" on shell. Probably it helps also to unlimit other limits
# -check: checks at runtime, where # -check: Checks at runtime, where
# arg_temp_created: will cause a lot of warnings because we create a bunch of temporary arrays (performance?) # arg_temp_created: will cause a lot of warnings because we create a bunch of temporary arrays (performance?)
# stack: # stack:
set (DEBUG_FLAGS "${DEBUG_FLAGS} -g" )
set (DEBUG_FLAGS "${DEBUG_FLAGS} -traceback" )
set (DEBUG_FLAGS "${DEBUG_FLAGS} -gen-interfaces" )
set (DEBUG_FLAGS "${DEBUG_FLAGS} -fp-stack-check" )
set (DEBUG_FLAGS "${DEBUG_FLAGS} -fp-model strict" )
set (DEBUG_FLAGS "${DEBUG_FLAGS} -check bounds,format,output_conversion,pointers,uninit" )
set (DEBUG_FLAGS "${DEBUG_FLAGS} -ftrapuv" )
set (DEBUG_FLAGS "${DEBUG_FLAGS} -fpe-all0" )
set (DEBUG_FLAGS "${DEBUG_FLAGS} -warn errors" )
set (DEBUG_FLAGS "${DEBUG_FLAGS} -warn stderrors" )
set (DEBUG_FLAGS "${DEBUG_FLAGS} -debug-parameters all" )
#------------------------------------------------------------------------------------------------ #------------------------------------------------------------------------------------------------
# PRECISION SETTINGS # PRECISION SETTINGS
@ -384,12 +381,12 @@ elseif(${CMAKE_Fortran_COMPILER_ID} STREQUAL "GNU")
endif() endif()
set (CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE} ${OPENMP_FLAGS}") set (CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE} ${OPENMP_FLAGS}")
set (CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE} ${STANDARD_CHECK}") set (CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE} ${STANDARD_CHECK}")
set (CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE} ${OPTIMIZATION_FLAGS}") set (CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE} ${OPTIMIZATION_FLAGS}")
set (CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE} ${COMPILE_FLAGS}") set (CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE} ${COMPILE_FLAGS}")
set (CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE} ${PRECISION_FLAGS}") set (CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE} ${PRECISION_FLAGS}")
set (CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} ${OPENMP_FLAGS}" ) set (CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} ${OPENMP_FLAGS}" )
set (CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} ${STANDARD_CHECK}") set (CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} ${STANDARD_CHECK}")
set (CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} ${OPTIMIZATION_FLAGS}" ) set (CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} ${OPTIMIZATION_FLAGS}" )
@ -400,7 +397,7 @@ set (CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG} ${DEBUG_FLAGS
set (CMAKE_Fortran_FLAGS_RELEASE "${BUILDCMD_PRE} ${CMAKE_Fortran_FLAGS_RELEASE} ${DAMASK_INCLUDE_FLAGS} ${BUILDCMD_POST}") set (CMAKE_Fortran_FLAGS_RELEASE "${BUILDCMD_PRE} ${CMAKE_Fortran_FLAGS_RELEASE} ${DAMASK_INCLUDE_FLAGS} ${BUILDCMD_POST}")
set (CMAKE_Fortran_FLAGS_DEBUG "${BUILDCMD_PRE} ${CMAKE_Fortran_FLAGS_DEBUG} ${DAMASK_INCLUDE_FLAGS} ${BUILDCMD_POST}") set (CMAKE_Fortran_FLAGS_DEBUG "${BUILDCMD_PRE} ${CMAKE_Fortran_FLAGS_DEBUG} ${DAMASK_INCLUDE_FLAGS} ${BUILDCMD_POST}")
set (CMAKE_LINKER "${PETSC_LINKER}")
if ("${CMAKE_BUILD_TYPE}" STREQUAL "RELEASE") if ("${CMAKE_BUILD_TYPE}" STREQUAL "RELEASE")
set (CMAKE_Fortran_LINK_EXECUTABLE set (CMAKE_Fortran_LINK_EXECUTABLE
@ -417,11 +414,10 @@ message("***LINKER:\n${CMAKE_Fortran_LINK_EXECUTABLE}\n")
add_subdirectory(src) add_subdirectory(src)
# INSTALL BUILT BINARIES # INSTALL BUILT BINARIES
if (SPECTRAL) if ("${PROJECT_NAME}" STREQUAL "DAMASK_spectral")
INSTALL(PROGRAMS ${PROJECT_BINARY_DIR}/src/DAMASK_spectral INSTALL(PROGRAMS ${PROJECT_BINARY_DIR}/src/DAMASK_spectral
DESTINATION ${CMAKE_INSTALL_PREFIX}) DESTINATION ${CMAKE_INSTALL_PREFIX})
elseif (FEM) elseif ("${PROJECT_NAME}" STREQUAL "DAMASK_FEM")
INSTALL(PROGRAMS ${PROJECT_BINARY_DIR}/src/DAMASK_FEM INSTALL(PROGRAMS ${PROJECT_BINARY_DIR}/src/DAMASK_FEM
DESTINATION ${CMAKE_INSTALL_PREFIX}) DESTINATION ${CMAKE_INSTALL_PREFIX})
endif(SPECTRAL) endif("${PROJECT_NAME}" STREQUAL "DAMASK_spectral")

View File

@ -10,7 +10,7 @@ spectral: build/spectral
build/spectral: build build/spectral: build
@mkdir build/spectral @mkdir build/spectral
@(cd build/spectral; cmake -Wno-dev -DCMAKE_BUILD_TYPE=RELEASE -DDAMASK_DRIVER=SPECTRAL ../..;) @(cd build/spectral; cmake -Wno-dev -DDAMASK_DRIVER=SPECTRAL ../..;)
build: bin build: bin
@mkdir build @mkdir build
@ -23,7 +23,7 @@ FEM: build/FEM
build/FEM: build build/FEM: build
@mkdir build @mkdir build
@(cd build/FEM; cmake -Wno-dev -DCMAKE_BUILD_TYPE=RELEASE -DDAMASK_DRIVER=FEM ../..;) @(cd build/FEM; cmake -Wno-dev -DDAMASK_DRIVER=FEM ../..;)
.PHONY: clean .PHONY: clean
clean: clean:

View File

@ -1,13 +1,5 @@
# The dependency detection in CMake is not functioning for Fortran
# !!! EXPLICIT DEPENDENCY DECLARATION !!!
# SOME FILES REQUIRE SPECIAL FLAGS # SOME FILES REQUIRE SPECIAL FLAGS
if (${CMAKE_Fortran_COMPILER_ID} STREQUAL "Intel") if (${CMAKE_Fortran_COMPILER_ID} STREQUAL "GNU")
# -diag-disable 7410 should disable warning about directory statement
# in inquire function, but does not work. hence the other 2 statements
SET_SOURCE_FILES_PROPERTIES( "spectral_interface.f90" PROPERTIES
COMPILE_FLAGS "-diag-remark 7410 -stand none -warn nostderrors" )
elseif (${CMAKE_Fortran_COMPILER_ID} STREQUAL "GNU")
# fno-range-check: Disable range checking on results of simplification of constant expressions during compilation # fno-range-check: Disable range checking on results of simplification of constant expressions during compilation
# --> allows the definition of DAMASK_NaN # --> allows the definition of DAMASK_NaN
#-fall-intrinsics: all intrinsic procedures (including the GNU-specific extensions) are accepted. -Wintrinsics-std will be ignored #-fall-intrinsics: all intrinsic procedures (including the GNU-specific extensions) are accepted. -Wintrinsics-std will be ignored
@ -17,138 +9,165 @@ elseif (${CMAKE_Fortran_COMPILER_ID} STREQUAL "GNU")
# --> otherwise, when setting -ffast-math, isnan always evaluates to false (I would call it a bug) # --> otherwise, when setting -ffast-math, isnan always evaluates to false (I would call it a bug)
SET_SOURCE_FILES_PROPERTIES( "prec.f90" PROPERTIES SET_SOURCE_FILES_PROPERTIES( "prec.f90" PROPERTIES
COMPILE_FLAGS "-fno-range-check -fall-intrinsics -fno-fast-math") COMPILE_FLAGS "-fno-range-check -fall-intrinsics -fno-fast-math")
#-fall-intrinsics: all intrinsic procedures (including the GNU-specific extensions) are accepted. -Wintrinsics-std will be ignored
# and no user-defined procedure with the same name as any intrinsic will be called except when it is explicitly declared external
# --> allows the use of 'getcwd'
SET_SOURCE_FILES_PROPERTIES( "spectral_interface.f90" PROPERTIES
COMPILE_FLAGS "-fall-intrinsics")
# long lines for interaction matrix # long lines for interaction matrix
SET_SOURCE_FILES_PROPERTIES( "lattice.f90" PROPERTIES SET_SOURCE_FILES_PROPERTIES( "lattice.f90" PROPERTIES
COMPILE_FLAGS "-ffree-line-length-240") COMPILE_FLAGS "-ffree-line-length-240")
endif() endif()
add_library(DAMASK_PREC "prec.f90") # The dependency detection in CMake is not functioning for Fortran,
# hence we declare the dependencies from top to bottom in the following
add_library(C_ROUTINES "C_routines.c")
add_library(SYSTEM_ROUTINES "system_routines.f90")
target_link_libraries(SYSTEM_ROUTINES C_ROUTINES)
add_library(PREC "prec.f90")
target_link_libraries(PREC SYSTEM_ROUTINES)
if ("${PROJECT_NAME}" STREQUAL "DAMASK_spectral") if ("${PROJECT_NAME}" STREQUAL "DAMASK_spectral")
add_library(DAMASK_INTERFACE "spectral_interface.f90") add_library(DAMASK_INTERFACE "spectral_interface.f90")
elseif ("${PROJECT_NAME}" STREQUAL "DAMASK_FEM") elseif ("${PROJECT_NAME}" STREQUAL "DAMASK_FEM")
add_library(DAMASK_INTERFACE "DAMASK_FEM_interface.f90") add_library(DAMASK_INTERFACE "DAMASK_FEM_interface.f90")
endif() endif()
target_link_libraries(DAMASK_INTERFACE DAMASK_PREC) target_link_libraries(DAMASK_INTERFACE PREC)
add_library(DAMASK_IO "IO.f90") add_library(IO "IO.f90")
target_link_libraries(DAMASK_IO DAMASK_INTERFACE) target_link_libraries(IO DAMASK_INTERFACE)
add_library(DAMASK_LIBS "libs.f90") add_library(EXTERNALLIBS "libs.f90")
target_link_libraries(DAMASK_LIBS DAMASK_IO) target_link_libraries(EXTERNALLIBS IO)
add_library(DAMASK_NUMERICS "numerics.f90") add_library(NUMERICS "numerics.f90")
target_link_libraries(DAMASK_NUMERICS DAMASK_LIBS) target_link_libraries(NUMERICS EXTERNALLIBS)
add_library(DAMASK_DEBUG "debug.f90") add_library(DEBUG "debug.f90")
target_link_libraries(DAMASK_DEBUG DAMASK_NUMERICS) target_link_libraries(DEBUG NUMERICS)
add_library(DAMASK_FEsolving "FEsolving.f90") add_library(FEsolving "FEsolving.f90")
target_link_libraries(DAMASK_FEsolving DAMASK_DEBUG) target_link_libraries(FEsolving DEBUG)
add_library(DAMASK_MATH "math.f90") add_library(DAMASK_MATH "math.f90")
target_link_libraries(DAMASK_MATH DAMASK_FEsolving) target_link_libraries(DAMASK_MATH FEsolving)
# SPECTRAL solver and FEM solver use different mesh # SPECTRAL solver and FEM solver use different mesh
# source files # source files
if ("${PROJECT_NAME}" STREQUAL "DAMASK_spectral") if ("${PROJECT_NAME}" STREQUAL "DAMASK_spectral")
add_library(DAMASK_MESH "mesh.f90") add_library(MESH "mesh.f90")
target_link_libraries(DAMASK_MESH DAMASK_MATH) target_link_libraries(MESH DAMASK_MATH)
elseif ("${PROJECT_NAME}" STREQUAL "DAMASK_FEM") elseif ("${PROJECT_NAME}" STREQUAL "DAMASK_FEM")
add_library(DAMASK_FEZoo "FEZoo.f90") add_library(FEZoo "FEZoo.f90")
target_link_libraries(DAMASK_FEZoo DAMASK_MATH) target_link_libraries(FEZoo DAMASK_MATH)
add_library(DAMASK_MESH "meshFEM.f90") add_library(MESH "meshFEM.f90")
target_link_libraries(DAMASK_MESH DAMASK_FEZoo) target_link_libraries(MESH FEZoo)
endif() endif()
add_library(MATERIAL "material.f90")
target_link_libraries(MATERIAL MESH)
add_library(DAMASK_MATERIAL "material.f90") add_library(LATTICE "lattice.f90")
target_link_libraries(DAMASK_MATERIAL DAMASK_MESH) target_link_libraries(LATTICE MATERIAL)
add_library(DAMASK_HELPERS ALIAS LATTICE)
add_library(DAMASK_LATTICE "lattice.f90")
target_link_libraries(DAMASK_LATTICE DAMASK_MATERIAL)
add_library(DAMASK_DRIVERS ALIAS DAMASK_LATTICE)
# For each modular section # For each modular section
add_library (DAMASK_PLASTIC "plastic_dislotwin.f90" add_library (PLASTIC
"plastic_disloUCLA.f90" "plastic_dislotwin.f90"
"plastic_isotropic.f90" "plastic_disloUCLA.f90"
"plastic_phenopowerlaw.f90" "plastic_isotropic.f90"
"plastic_titanmod.f90" "plastic_phenopowerlaw.f90"
"plastic_nonlocal.f90" "plastic_titanmod.f90"
"plastic_none.f90" "plastic_nonlocal.f90"
"plastic_phenoplus.f90") "plastic_none.f90"
target_link_libraries(DAMASK_PLASTIC DAMASK_DRIVERS) "plastic_phenoplus.f90")
target_link_libraries(PLASTIC DAMASK_HELPERS)
add_library (DAMASK_KINEMATICS "kinematics_cleavage_opening.f90" add_library (KINEMATICS
"kinematics_slipplane_opening.f90" "kinematics_cleavage_opening.f90"
"kinematics_thermal_expansion.f90" "kinematics_slipplane_opening.f90"
"kinematics_vacancy_strain.f90" "kinematics_thermal_expansion.f90"
"kinematics_hydrogen_strain.f90") "kinematics_vacancy_strain.f90"
target_link_libraries(DAMASK_KINEMATICS DAMASK_DRIVERS) "kinematics_hydrogen_strain.f90")
target_link_libraries(KINEMATICS DAMASK_HELPERS)
add_library (DAMASK_SOURCE "source_thermal_dissipation.f90" add_library (SOURCE
"source_thermal_externalheat.f90" "source_thermal_dissipation.f90"
"source_damage_isoBrittle.f90" "source_thermal_externalheat.f90"
"source_damage_isoDuctile.f90" "source_damage_isoBrittle.f90"
"source_damage_anisoBrittle.f90" "source_damage_isoDuctile.f90"
"source_damage_anisoDuctile.f90" "source_damage_anisoBrittle.f90"
"source_vacancy_phenoplasticity.f90" "source_damage_anisoDuctile.f90"
"source_vacancy_irradiation.f90" "source_vacancy_phenoplasticity.f90"
"source_vacancy_thermalfluc.f90") "source_vacancy_irradiation.f90"
target_link_libraries(DAMASK_SOURCE DAMASK_DRIVERS) "source_vacancy_thermalfluc.f90")
target_link_libraries(SOURCE DAMASK_HELPERS)
add_library(DAMASK_CONSTITUTIVE "constitutive.f90") add_library(CONSTITUTIVE "constitutive.f90")
target_link_libraries(DAMASK_CONSTITUTIVE DAMASK_PLASTIC ) target_link_libraries(CONSTITUTIVE PLASTIC)
target_link_libraries(DAMASK_CONSTITUTIVE DAMASK_KINEMATICS) target_link_libraries(CONSTITUTIVE KINEMATICS)
target_link_libraries(DAMASK_CONSTITUTIVE DAMASK_SOURCE ) target_link_libraries(CONSTITUTIVE SOURCE)
add_library(DAMASK_CRYSTALLITE "crystallite.f90") add_library(CRYSTALLITE "crystallite.f90")
target_link_libraries(DAMASK_CRYSTALLITE DAMASK_CONSTITUTIVE) target_link_libraries(CRYSTALLITE CONSTITUTIVE)
add_library(DAMASK_HOMOGENIZATION "homogenization_RGC.f90" add_library(HOMOGENIZATION
"homogenization_isostrain.f90" "homogenization_RGC.f90"
"homogenization_none.f90") "homogenization_isostrain.f90"
target_link_libraries(DAMASK_HOMOGENIZATION DAMASK_CRYSTALLITE) "homogenization_none.f90")
target_link_libraries(HOMOGENIZATION CRYSTALLITE)
add_library(DAMASK_HYDROGENFLUX "hydrogenflux_isoconc.f90" add_library(HYDROGENFLUX
"hydrogenflux_cahnhilliard.f90") "hydrogenflux_isoconc.f90"
target_link_libraries(DAMASK_HYDROGENFLUX DAMASK_CRYSTALLITE) "hydrogenflux_cahnhilliard.f90")
target_link_libraries(HYDROGENFLUX CRYSTALLITE)
add_library(DAMASK_POROSITY "porosity_none.f90" add_library(POROSITY
"porosity_phasefield.f90") "porosity_none.f90"
target_link_libraries(DAMASK_POROSITY DAMASK_CRYSTALLITE) "porosity_phasefield.f90")
target_link_libraries(POROSITY CRYSTALLITE)
add_library(DAMASK_VACANCYFLUX "vacancyflux_isoconc.f90" add_library(VACANCYFLUX
"vacancyflux_isochempot.f90" "vacancyflux_isoconc.f90"
"vacancyflux_cahnhilliard.f90") "vacancyflux_isochempot.f90"
target_link_libraries(DAMASK_VACANCYFLUX DAMASK_CRYSTALLITE) "vacancyflux_cahnhilliard.f90")
target_link_libraries(VACANCYFLUX CRYSTALLITE)
add_library(DAMASK_DAMAGE "damage_none.f90" add_library(DAMAGE
"damage_local.f90" "damage_none.f90"
"damage_nonlocal.f90") "damage_local.f90"
target_link_libraries(DAMASK_DAMAGE DAMASK_CRYSTALLITE) "damage_nonlocal.f90")
target_link_libraries(DAMAGE CRYSTALLITE)
add_library(DAMASK_THERMAL "thermal_isothermal.f90" add_library(THERMAL
"thermal_adiabatic.f90" "thermal_isothermal.f90"
"thermal_conduction.f90") "thermal_adiabatic.f90"
target_link_libraries(DAMASK_THERMAL DAMASK_CRYSTALLITE) "thermal_conduction.f90")
target_link_libraries(THERMAL CRYSTALLITE)
add_library(DAMASK_ENGINE "homogenization.f90") add_library(DAMASK_ENGINE "homogenization.f90")
target_link_libraries(DAMASK_ENGINE DAMASK_THERMAL ) target_link_libraries(DAMASK_ENGINE THERMAL )
target_link_libraries(DAMASK_ENGINE DAMASK_DAMAGE ) target_link_libraries(DAMASK_ENGINE DAMAGE )
target_link_libraries(DAMASK_ENGINE DAMASK_VACANCYFLUX ) target_link_libraries(DAMASK_ENGINE VACANCYFLUX )
target_link_libraries(DAMASK_ENGINE DAMASK_POROSITY ) target_link_libraries(DAMASK_ENGINE POROSITY )
target_link_libraries(DAMASK_ENGINE DAMASK_HYDROGENFLUX ) target_link_libraries(DAMASK_ENGINE HYDROGENFLUX )
target_link_libraries(DAMASK_ENGINE DAMASK_HOMOGENIZATION) target_link_libraries(DAMASK_ENGINE HOMOGENIZATION)
if (FEM) if ("${PROJECT_NAME}" STREQUAL "DAMASK_spectral")
add_library(DAMASK_CPFE "CPFEM2.f90")
target_link_libraries(DAMASK_CPFE DAMASK_ENGINE)
add_library(SPECTRAL_UTILITIES spectral_utilities.f90)
target_link_libraries(SPECTRAL_UTILITIES DAMASK_CPFE)
add_library(SPECTRAL_SOLVER "spectral_thermal.f90"
"spectral_damage.f90"
"spectral_mech_AL.f90"
"spectral_mech_Polarisation.f90"
"spectral_mech_Basic.f90")
target_link_libraries(SPECTRAL_SOLVER SPECTRAL_UTILITIES)
add_executable(DAMASK_spectral "DAMASK_spectral.f90")
target_link_libraries(DAMASK_spectral SPECTRAL_SOLVER)
elseif ("${PROJECT_NAME}" STREQUAL "DAMASK_FEM")
add_library(DAMASK_CPFE "CPFEM.f90") add_library(DAMASK_CPFE "CPFEM.f90")
target_link_libraries(DAMASK_CPFE DAMASK_ENGINE) target_link_libraries(DAMASK_CPFE DAMASK_ENGINE)
@ -167,30 +186,5 @@ if (FEM)
target_link_libraries(DAMASK_FEM_DRIVER DAMASK_FEM_BASE) target_link_libraries(DAMASK_FEM_DRIVER DAMASK_FEM_BASE)
add_executable(DAMASK_FEM "DAMASK_FEM_driver.f90") add_executable(DAMASK_FEM "DAMASK_FEM_driver.f90")
target_link_libraries(DAMASK_FEM DAMASK_FEM_DRIVER) target_link_libraries(DAMASK_FEM DAMASK_FEM_EXE)
endif(FEM) endif()
if (SPECTRAL)
add_library(DAMASK_CPFE "CPFEM2.f90")
target_link_libraries(DAMASK_CPFE DAMASK_ENGINE)
add_library(DAMASK_SPECTRAL_UTILITY spectral_utilities.f90)
target_link_libraries(DAMASK_SPECTRAL_UTILITY DAMASK_CPFE)
add_library(DAMASK_SPECTRAL_BASE "spectral_thermal.f90"
"spectral_damage.f90")
target_link_libraries(DAMASK_SPECTRAL_BASE DAMASK_SPECTRAL_UTILITY)
add_library(DAMASK_SPECTRAL_MECH "spectral_mech_AL.f90"
"spectral_mech_Polarisation.f90"
"spectral_mech_Basic.f90")
target_link_libraries(DAMASK_SPECTRAL_MECH DAMASK_SPECTRAL_UTILITY)
add_library(DAMASK_EXE "DAMASK_spectral.f90")
target_link_libraries(DAMASK_EXE DAMASK_CPFE )
target_link_libraries(DAMASK_EXE DAMASK_SPECTRAL_BASE)
target_link_libraries(DAMASK_EXE DAMASK_SPECTRAL_MECH)
add_executable(DAMASK_spectral "DAMASK_spectral.f90")
target_link_libraries(DAMASK_spectral DAMASK_EXE)
endif(SPECTRAL)