DAMASK_EICMD/CMakeLists.txt

437 lines
25 KiB
CMake
Raw Normal View History

########################################################################################
# CMAKE for build the Material subroutine for BVP solution
########################################################################################
cmake_minimum_required (VERSION 3.1.0 FATAL_ERROR)
project (DAMASK Fortran)
# The version number.
set (DAMASK_VERSION_MAJOR 1)
set (DAMASK_VERSION_MINOR ${DAMASK_V})
# PETSC and HDF5 is required
if (NOT DEFINED PETSC_DIR)
message (FATAL_ERROR "PETSC_DIR is not found!")
endif (NOT DEFINED PETSC_DIR)
if (NOT DEFINED HDF5_DIR)
message (FATAL_ERROR "HDF5_DIR is not found!" )
endif (NOT DEFINED HDF5_DIR)
2016-03-03 02:09:31 +05:30
# DAMASK DRIVER SELECTION
2016-03-02 20:07:12 +05:30
set (SPECTRAL OFF)
set (FEM OFF)
if (DAMASK_DRIVER STREQUAL "SPECTRAL")
set (SPECTRAL ON )
elseif (DAMASK_DRIVER STREQUAL "FEM")
set (FEM ON )
else (DAMASK_DRIVER STREQUAL "SPECTRAL")
2016-03-03 02:09:31 +05:30
message (FATAL_ERROR "Unknown driver detected, check build script!")
2016-03-02 20:07:12 +05:30
endif (DAMASK_DRIVER STREQUAL "SPECTRAL")
# COMPILE VARIABLES
add_definitions(-DDAMASKVERSION="${DAMASK_V}")
add_definitions(-DPETSc)
add_definitions(-DFLOAT=8)
add_definitions(-DINT=4)
if (SPECTRAL)
add_definitions(-DSpectral)
endif(SPECTRAL)
if (FEM)
add_definitions(-DFEM)
endif(FEM)
2016-03-03 02:09:31 +05:30
# BRUTAL FORCE TO FIND THE VARIABLES DEFINED IN PETSC
# ref:
# https://github.com/jedbrown/cmake-modules/blob/master/FindPETSc.cmake
set(petsc_conf_variables "${PETSC_DIR}/lib/petsc/conf/variables")
set(petsc_conf_rules "${PETSC_DIR}/lib/petsc/conf/rules" )
# A temporary makefile to probe the PETSc configuration
set (petsc_config_makefile "${PROJECT_BINARY_DIR}/Makefile.petsc")
file (WRITE "${petsc_config_makefile}"
2016-03-03 02:09:31 +05:30
"## This file was auto generated by CMake
# PETSC_DIR = ${PETSC_DIR}
# PETSC_ARCH = ${PETSC_ARCH}
2016-03-01 23:53:47 +05:30
SHELL = /bin/sh
include ${petsc_conf_rules}
include ${petsc_conf_variables}
2016-03-02 20:07:12 +05:30
INCLUDE_DIRS := \${PETSC_FC_INCLUDES}
2016-03-01 23:53:47 +05:30
LIBRARIES := \${PETSC_WITH_EXTERNAL_LIB}
COMPILERNAME ?= \${FC}
LINKERNAME ?= \${FLINKER}
includes:
\t@echo \${INCLUDE_DIRS}
2016-03-02 20:07:12 +05:30
2016-03-01 23:53:47 +05:30
extlibs:
\t@echo \${LIBRARIES}
2016-03-02 20:07:12 +05:30
2016-03-01 23:53:47 +05:30
compiler:
\t@echo \${COMPILERNAME}
linker:
\t@echo \${LINKERNAME}
")
2016-03-01 23:53:47 +05:30
find_program (MAKE_EXECUTABLE NAMES make gmake)
execute_process(COMMAND ${MAKE_EXECUTABLE} -f ${petsc_config_makefile} "includes"
RESULT_VARIABLE PETSC_INCLUDES_RETURN
2016-03-03 02:09:31 +05:30
OUTPUT_VARIABLE petsc_includes
2016-03-02 20:07:12 +05:30
OUTPUT_STRIP_TRAILING_WHITESPACE)
2016-03-01 23:53:47 +05:30
execute_process(COMMAND ${MAKE_EXECUTABLE} -f ${petsc_config_makefile} "extlibs"
RESULT_VARIABLE PETSC_EXTERNAL_LIB_RETURN
2016-03-03 02:09:31 +05:30
OUTPUT_VARIABLE petsc_external_lib
2016-03-02 20:07:12 +05:30
OUTPUT_STRIP_TRAILING_WHITESPACE)
2016-03-01 23:53:47 +05:30
execute_process(COMMAND ${MAKE_EXECUTABLE} -f ${petsc_config_makefile} "linker"
RESULT_VARIABLE PETSC_LINK_LIB_RETURN
2016-03-02 20:07:12 +05:30
OUTPUT_VARIABLE PETSC_LINK_LIB
OUTPUT_STRIP_TRAILING_WHITESPACE)
2016-03-01 23:53:47 +05:30
execute_process(COMMAND ${MAKE_EXECUTABLE} -f ${petsc_config_makefile} "compiler"
RESULT_VARIABLE MPIEXEC_RETURN
2016-03-02 20:07:12 +05:30
OUTPUT_VARIABLE MPIEXEC
OUTPUT_STRIP_TRAILING_WHITESPACE)
2016-03-01 23:53:47 +05:30
file (REMOVE ${petsc_config_makefile})
2016-03-03 02:09:31 +05:30
# remove duplicate flags for compiler and linking
string( REGEX MATCHALL "-I([^\" ]+)" TMP_LIST "${petsc_includes}")
list(REMOVE_DUPLICATES TMP_LIST)
foreach (dir ${TMP_LIST})
set(PETSC_INCLUDES "${PETSC_INCLUDES} ${dir}")
endforeach(dir)
string( REGEX MATCHALL "-[lLW]([^\" ]+)" TMP_LIST "${petsc_external_lib}")
list(REMOVE_DUPLICATES TMP_LIST)
foreach (exlib ${TMP_LIST})
set(PETSC_EXTERNAL_LIB "${PETSC_EXTERNAL_LIB} ${exlib}")
endforeach(exlib)
2016-03-02 20:07:12 +05:30
message("***Found PETSC_DIR:\n${PETSC_DIR}\n")
message("***Set PETSC_INCLUDES to:\n${PETSC_INCLUDES}\n")
message("***Set PETSC_EXTERNAL_LIB to:\n${PETSC_EXTERNAL_LIB}\n")
message("***Set PETSC_LINK_LIB to:\n${PETSC_LINK_LIB}\n")
2016-03-03 02:09:31 +05:30
message("***Use PETSC wrapped compiler:\n${MPIEXEC}\n")
# set system include directories
2016-03-03 02:09:31 +05:30
set (DAMASK_INCLUDE_FLAGS "${PETSC_INCLUDES} -I${PROJECT_SOURCE_DIR}/lib -I${HDF5_DIR}/include -lm")
2016-03-02 20:07:12 +05:30
set (DAMASK_LINK_FLAGS "${PETSC_LINK_LIB} ${PETSC_EXTERNAL_LIB} -L${HDF5_DIR}/lib")
##
# set compile and debug flags
if (OPENMP)
set (OPENMP_FLAG_ifort "-openmp -openmp-report0 -parallel")
set (OPENMP_FLAG_gfortran "-fopenmp")
else (OPENMP)
message("No openmp support specified")
set (OPENMP_FLAG_ifort "")
set (OPENMP_FLAG_gfortran "")
endif (OPENMP)
if (OPTIMIZATION STREQUAL "OFF")
set (OPTIMIZATION_ifort "-O0 -no-ip")
set (OPTIMIZATION_gfortran "-O0" )
elseif (OPTIMIZATION STREQUAL "DEFENSIVE")
set (OPTIMIZATION_ifort "-O2")
set (OPTIMIZATION_gfortran "-O2")
elseif (OPTIMIZATION STREQUAL "AGGRESSIVE")
set (OPTIMIZATION_ifort "-ipo -O3 -no-prec-div -fp-model fast=2 -xHost" ) #-fast = -ipo, -O3, -no-prec-div, -static, -fp-model fast=2, and -xHost"
set (OPTIMIZATION_gfortran "-O3 -ffast-math -funroll-loops -ftree-vectorize")
elseif (OPTIMIZATION STREQUAL "ULTRA")
set (OPTIMIZATION_ifort "-ipo -O3 -no-prec-div -fp-model fast=2 -xHost" ) #-fast = -ipo, -O3, -no-prec-div, -static, -fp-model fast=2, and -xHost"
set (OPTIMIZATION_gfortran "-O3 -ffast-math -funroll-loops -ftree-vectorize")
else (OPTIMIZATION STREQUAL "OFF")
set (OPTIMIZATION_ifort "-O2")
set (OPTIMIZATION_gfortran "-O2")
endif (OPTIMIZATION STREQUAL "OFF")
2016-03-02 20:07:12 +05:30
set (STANDARD_CHECK_ifort "-stand f08 -standard-semantics")
set (STANDARD_CHECK_gfortran "-std=f2008ts -pedantic-errors" )
###################################################################################################
# COMPILE SWITCHES
# -shared-intel: Link against shared Intel libraries instead of static ones
# -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)
# fpe_summary print list of floating point exceptions occured during execution
# -fimplicit-none: assume "implicit-none" even if not present in source
# -diag-disable: disables warnings, where
# warning ID 5268: the text exceeds right hand column allowed on the line (we have only comments there)
# -warn: enables warnings, where
# declarations: any undeclared names (alternative name: -implicitnone)
# general: warning messages and informational messages are issued by the compiler
# usage: questionable programming practices
# interfaces: checks the interfaces of all SUBROUTINEs called and FUNCTIONs invoked in your compilation against an external set of interface blocks
# ignore_loc: %LOC is stripped from an actual argument
# alignments: data that is not naturally aligned
# unused: declared variables that are never used
# stderrors: warnings about Fortran standard violations are changed to errors (STANDARD_CHECK)
#
###################################################################################################
# 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!
###################################################################################################
2016-03-01 00:27:15 +05:30
# -diag-disable 7410 should disable warning about directory statement in inquire function,
# but does not work. hence the other 2 statements
###################################################################################################
2016-02-29 21:20:35 +05:30
set (COMPILE_OPTIONS_ifort "${COMPILE_OPTIONS_ifort} -fpp" )
set (COMPILE_OPTIONS_ifort "${COMPILE_OPTIONS_ifort} -ftz" )
set (COMPILE_OPTIONS_ifort "${COMPILE_OPTIONS_ifort} -assume byterecl,fpe_summary")
set (COMPILE_OPTIONS_ifort "${COMPILE_OPTIONS_ifort} -diag-disable 5268" )
set (COMPILE_OPTIONS_ifort "${COMPILE_OPTIONS_ifort} -warn declarations" )
set (COMPILE_OPTIONS_ifort "${COMPILE_OPTIONS_ifort} -warn general" )
set (COMPILE_OPTIONS_ifort "${COMPILE_OPTIONS_ifort} -warn usage" )
set (COMPILE_OPTIONS_ifort "${COMPILE_OPTIONS_ifort} -warn interfaces" )
set (COMPILE_OPTIONS_ifort "${COMPILE_OPTIONS_ifort} -warn ignore_loc" )
set (COMPILE_OPTIONS_ifort "${COMPILE_OPTIONS_ifort} -warn alignments" )
set (COMPILE_OPTIONS_ifort "${COMPILE_OPTIONS_ifort} -warn unused" )
2016-03-01 00:27:15 +05:30
set (COMPILE_OPTIONS_ifort "${COMPILE_OPTIONS_ifort} -diag-remark 7410" )
set (COMPILE_OPTIONS_ifort "${COMPILE_OPTIONS_ifort} -warn nostderrors" )
###################################################################################################
# COMPILE SWITCHES FOR RUNTIME DEBUGGING
# -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.
# -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.
# -ftrapuv Trap uninitalized variables
# -check: checks at runtime, where
# bounds: check if an array index is too small (<1) or too large!
# format: Checking 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.
# pointers: Checking for certain disassociated or uninitialized pointers or unallocated allocatable objects.
# uninit: Checking for uninitialized variables.
# -fpe-all0 capture all floating-point exceptions, sets -ftz automatically
# -warn: enables warnings, where
# errors: warnings are changed to errors
# stderrors: warnings about Fortran standard violations are changed to errors
# information on http://software.intel.com/en-us/articles/determining-root-cause-of-sigsegv-or-sigbus-errors/
###################################################################################################
# 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
# -check: checks at runtime, where
# arg_temp_created: will cause a lot of warnings because we create a bunch of temporary arrays (performance?)
# stack:
###################################################################################################
set (DEBUG_OPTIONS_ifort "${DEBUG_OPTIONS_ifort} -g" )
set (DEBUG_OPTIONS_ifort "${DEBUG_OPTIONS_ifort} -traceback" )
set (DEBUG_OPTIONS_ifort "${DEBUG_OPTIONS_ifort} -gen-interfaces" )
set (DEBUG_OPTIONS_ifort "${DEBUG_OPTIONS_ifort} -fp-stack-check" )
set (DEBUG_OPTIONS_ifort "${DEBUG_OPTIONS_ifort} -fp-model strict" )
set (DEBUG_OPTIONS_ifort "${DEBUG_OPTIONS_ifort} -check bounds,format,output_conversion,pointers,uninit" )
set (DEBUG_OPTIONS_ifort "${DEBUG_OPTIONS_ifort} -ftrapuv" )
set (DEBUG_OPTIONS_ifort "${DEBUG_OPTIONS_ifort} -fpe-all0" )
set (DEBUG_OPTIONS_ifort "${DEBUG_OPTIONS_ifort} -warn errors" )
set (DEBUG_OPTIONS_ifort "${DEBUG_OPTIONS_ifort} -warn stderrors" )
set (DEBUG_OPTIONS_ifort "${DEBUG_OPTIONS_ifort} -debug-parameters all" )
set (LINK_OPTIONS_ifort "-shared-intel")
###################################################################################################
# COMPILE SWITCHES
# -shared
# -Wl,-undefined,dynamic_lookup:ensure to link against dynamic libraries
# -xf95-cpp-input: preprocessor
# -ffree-line-length-132: restrict line length to the standard 240 characters (lattice.f90 require larger)
# -ffpe-summary: print summary of floating point exeptions (invalid, zero, overflow, underflow, inexact and denormal)
# -fimplicit-none: assume "implicit-none" even if not present in source
# -fmodule-private: assume "private" even if not present in source
# -Wcharacter-truncation: warn if character expressions (strings) are truncated
# -Wunderflow: produce a warning when numerical constant expressions are encountered, which yield an UNDERFLOW during compilation
# -Wsuggest-attribute=pure:
# -Wsuggest-attribute=noreturn:
# -Wconversion-extra
# -Wimplicit-procedure
# -Wall: sets the following Fortran options:
# -Waliasing: warn about possible aliasing of dummy arguments. Specifically, it warns if the same actual argument is associated with a dummy argument with "INTENT(IN)" and a dummy argument with "INTENT(OUT)" in a call with an explicit interface.
# -Wampersand: checks if a character expression is continued proberly by an ampersand at the end of the line and at the beginning of the new line
# -Warray-bounds: checks if array reference is out of bounds at compile time. use -fcheck-bounds to also check during runtime
# -Wconversion: warn about implicit conversions between different type
# -Wsurprising: warn when "suspicious" code constructs are encountered. While technically legal these usually indicate that an error has been made.
# -Wc-binding-type:
# -Wintrinsics-std: only standard intrisics are available, e.g. "call flush(6)" will cause an error
# -Wno-tabs: do not allow tabs in source
# -Wintrinsic-shadow: warn if a user-defined procedure or module procedure has the same name as an intrinsic
# -Wline-truncation:
# -Wtarget-lifetime:
# -Wreal-q-constant: warn about real-literal-constants with 'q' exponent-letter
# -Wunused: a number of unused-xxx warnings
# these are general (non -Fortran options) implied by -Wall
# -Waddress
# -Warray-bounds (only with -O2)
# -Wc++11-compat
# -Wchar-subscripts
# -Wcomment
# -Wformat
# -Wmaybe-uninitialized
# -Wnonnull
# -Wparentheses
# -Wpointer-sign
# -Wreorder
# -Wreturn-type
# -Wsequence-point
# -Wstrict-aliasing
# -Wstrict-overflow=1
# -Wswitch
# -Wtrigraphs
# -Wuninitialized
# -Wunknown-pragmas
# -Wunused-function
# -Wunused-label
# -Wunused-value
# -Wunused-variable
# -Wvolatile-register-var
# -Wextra: sets the following Fortran options:
# -Wunuses-parameter:
# -Wcompare-reals:
# these are general (non -Fortran options) implied by -Wextra
# -Wclobbered
# -Wempty-body
# -Wignored-qualifiers
# -Wmissing-field-initializers
# -Woverride-init
# -Wsign-compare
# -Wtype-limits
# -Wuninitialized
# -Wunused-but-set-parameter (only with -Wunused or -Wall)
# -Wno-globals
# -ffpe-summary=all only for newer gfortran
###################################################################################################
# MORE OPTIONS FOR DEBUGGING DURING COMPILATION
# -Warray-temporarieswarnings: because we have many temporary arrays (performance issue?):
# -Wimplicit-interface: no interfaces for lapack routines
# -Wunsafe-loop-optimizations: warn if the loop cannot be optimized due to nontrivial assumptions.
# -Wstrict-overflow:
###################################################################################################
2016-03-01 00:27:15 +05:30
# fno-range-check: Disable range checking on results of simplification of constant expressions during compilation
# --> allows the definition of DAMASK_NaN
#-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 'isnan'
#-fno-fast-math:
# --> otherwise, when setting -ffast-math, isnan always evaluates to false (I would call it a bug)
###################################################################################################
set (COMPILE_OPTIONS_gfortran "${COMPILE_OPTIONS_gfortran} -xf95-cpp-input" )
set (COMPILE_OPTIONS_gfortran "${COMPILE_OPTIONS_gfortran} -ffree-line-length-240" )
set (COMPILE_OPTIONS_gfortran "${COMPILE_OPTIONS_gfortran} -fimplicit-none" )
set (COMPILE_OPTIONS_gfortran "${COMPILE_OPTIONS_gfortran} -fmodule-private" )
set (COMPILE_OPTIONS_gfortran "${COMPILE_OPTIONS_gfortran} -Wall" )
set (COMPILE_OPTIONS_gfortran "${COMPILE_OPTIONS_gfortran} -Wextra" )
set (COMPILE_OPTIONS_gfortran "${COMPILE_OPTIONS_gfortran} -Wcharacter-truncation" )
set (COMPILE_OPTIONS_gfortran "${COMPILE_OPTIONS_gfortran} -Wunderflow" )
set (COMPILE_OPTIONS_gfortran "${COMPILE_OPTIONS_gfortran} -Wsuggest-attribute=pure" )
set (COMPILE_OPTIONS_gfortran "${COMPILE_OPTIONS_gfortran} -Wsuggest-attribute=noreturn" )
set (COMPILE_OPTIONS_gfortran "${COMPILE_OPTIONS_gfortran} -Wconversion-extra" )
set (COMPILE_OPTIONS_gfortran "${COMPILE_OPTIONS_gfortran} -Wimplicit-procedure" )
set (COMPILE_OPTIONS_gfortran "${COMPILE_OPTIONS_gfortran} -Wno-unused-parameter" )
set (COMPILE_OPTIONS_gfortran "${COMPILE_OPTIONS_gfortran} -fno-range-check" )
set (COMPILE_OPTIONS_gfortran "${COMPILE_OPTIONS_gfortran} -fall-intrinsics" )
set (COMPILE_OPTIONS_gfortran "${COMPILE_OPTIONS_gfortran} -fno-fast-math" )
set (COMPILE_OPTIONS_gfortran "${COMPILE_OPTIONS_gfortran} -fall-intrinsics" )
###################################################################################################
# COMPILE SWITCHES FOR RUNTIME DEBUGGING
# -ffpe-trap=invalid,\ stop execution if floating point exception is detected (NaN is silent)
# zero,\
# overflow
# -fcheck=all: sets the following Fortran options:
# array-temps
# bounds
# do
# mem
# pointer
# recursion
###################################################################################################
# MORE OPTIONS FOR RUNTIME DEBUGGING
# -ffpe-trap=precision,\
# denormal, \
# underflow
###################################################################################################
set (DEBUG_OPTIONS_gfortran "${DEBUG_OPTIONS_gfortran} -g" )
set (DEBUG_OPTIONS_gfortran "${DEBUG_OPTIONS_gfortran} -fbacktrace" )
set (DEBUG_OPTIONS_gfortran "${DEBUG_OPTIONS_gfortran} -fdump-core" )
set (DEBUG_OPTIONS_gfortran "${DEBUG_OPTIONS_gfortran} -fcheck=all" )
set (DEBUG_OPTIONS_gfortran "${DEBUG_OPTIONS_gfortran} -ffpe-trap=invalid,zero,overflow")
set (LINK_OPTIONS_gfortran "-Wl,-undefined,dynamic_lookup")
###################################################################################################
#-real-size 32: set precision to one of those 32/64/128 (= 4/8/16 bytes) for standard real (=8 for pReal)
#-integer-size 16: set precision to one of those 16/32/64 (= 2/4/8 bytes) for standard integer (=4 for pInt)
###################################################################################################
2016-03-02 20:07:12 +05:30
set (PRECISION_ifort "-real-size 64 -integer-size 32")
###################################################################################################
#-fdefault-real-8: set precision to 8 bytes for standard real (=8 for pReal). Will set size of double to 16 bytes as long as -fdefault-double-8 is not set
#-fdefault-double-8: set precision to 8 bytes for double real, would be 16 bytes because -fdefault-real-8 is used
#-fdefault-integer-8: Use it to set precision to 8 bytes for integer, don't use it for the standard case of pInt=4 (there is no -fdefault-integer-4)
###################################################################################################
2016-03-02 20:07:12 +05:30
set (PRECISION_gfortran "-fdefault-real-8 -fdefault-double-8")
# set FLAGS
get_filename_component (Fortran_COMPILER_NAME ${CMAKE_Fortran_COMPILER} NAME)
if (Fortran_COMPILER_NAME MATCHES "ifort.*")
# need the PETSC wrapped version of ifort
2016-03-01 23:53:47 +05:30
set (CMAKE_Fortran_COMPILER "${MPIEXEC}")
# for RELEASE
set (CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE} ${OPENMP_FLAG_ifort}" )
set (CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE} ${STANDARD_CHECK_ifort}" )
set (CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE} ${OPTIMIZATION_ifort}" )
set (CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE} ${COMPILE_OPTIONS_ifort}")
set (CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE} ${PRECISION_ifort}" )
set (CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} ${LINK_OPTIONS_ifort}")
set (CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} ${OPTIMIZATION_ifort}")
# for DEBUG
set (CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG} ${COMPILE_OPTIONS_ifort}")
set (CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG} ${PRECISION_ifort}" )
set (CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG} ${DEBUG_OPTIONS_ifort}" )
set (CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} ${LINK_OPTIONS_ifort}" )
set (CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} ${DEBUG_OPTIONS_ifort}")
2016-03-01 00:27:15 +05:30
#
elseif (Fortran_COMPILER_NAME MATCHES "gfortran.*")
2016-03-01 23:53:47 +05:30
set (CMAKE_Fortran_COMPILER "${MPIEXEC}")
# for RELEASE
set (CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE} ${OPENMP_FLAG_gfortran}" )
set (CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE} ${STANDARD_CHECK_gfortran}" )
set (CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE} ${OPTIMIZATION_gfortran}" )
set (CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE} ${COMPILE_OPTIONS_gfortran}")
set (CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE} ${PRECISION_gfortran}" )
set (CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} ${LINK_OPTIONS_gfortran}" )
set (CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} ${OPTIMIZATION_ifort}" )
# for DEBUG
set (CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG} ${COMPILE_OPTIONS_gfortran}")
set (CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG} ${PRECISION_gfortran}" )
set (CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG} ${DEBUG_OPTIONS_gfortran}" )
set (CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} ${LINK_OPTIONS_gfortran}" )
set (CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} ${DEBUG_OPTIONS_gfortran}")
#
elseif (Fortran_COMPILER_NAME MATCHES "g77")
message (FATAL_ERROR "Fortran 77 is not supported.")
else (Fortran_COMPILER_NAME MATCHES "ifort.*")
message (FATAL_ERROR "Require Fortran90 from GNU or Intel.")
endif (Fortran_COMPILER_NAME MATCHES "ifort.*")
2016-03-02 20:07:12 +05:30
set (CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE} ${DAMASK_INCLUDE_FLAGS}")
set (CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG} ${DAMASK_INCLUDE_FLAGS}")
set (CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} ${DAMASK_LINK_FLAGS}" )
set (CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} ${DAMASK_LINK_FLAGS}" )
message("***COMPILE FLAGS:\n${CMAKE_Fortran_FLAGS_RELEASE}\n")
message("***LINK FLAGS:\n${CMAKE_EXE_LINKER_FLAGS_RELEASE}\n")
##
# ADD CODE DIRECTORY
add_subdirectory(code)
##
# ADD TESTING CASES
# add_test (SmokeTestRun
# DAMASK_spectral.exe -g test/test1.geom -l test/test.load)
# Enable Dashboard scripting
# include (CTest)
# set (CTEST_PROJECT_NAME "DAMASK")