finally get prec.f90 to compile, now damask_interface
This commit is contained in:
parent
13d608fbb6
commit
018668f474
113
CMakeLists.txt
113
CMakeLists.txt
|
@ -13,7 +13,7 @@
|
|||
# SUFFIX = arbitrary suffix (after file to compile)
|
||||
# STANDARD_CHECK = checking for Fortran 2008, compiler dependend
|
||||
########################################################################################
|
||||
cmake_minimum_required (VERSION 3.1.0)
|
||||
cmake_minimum_required (VERSION 3.1.0 FATAL_ERROR)
|
||||
project (DAMASK Fortran)
|
||||
|
||||
# The version number.
|
||||
|
@ -28,6 +28,38 @@ if (NOT DEFINED HDF5_DIR)
|
|||
message (FATAL_ERROR "HDF5_DIR is not found!" )
|
||||
endif (NOT DEFINED HDF5_DIR)
|
||||
|
||||
# Work around to probe PETSc configuration
|
||||
# set (petsc_conf_rules "${PETSC_DIR}/lib/petsc/conf/rules")
|
||||
# set (petsc_conf_variables "${PETSC_DIR}/lib/petsc/conf/variables")
|
||||
|
||||
# set (petsc_config_makefile "${DAMASK_SOURCE_DIR}/Makefile.petsc")
|
||||
# file (WRITE "${petsc_config_makefile}"
|
||||
# "## This file was autogenerated by FindPETSc.cmake
|
||||
# # PETSC_DIR = ${PETSC_DIR}
|
||||
# # PETSC_ARCH = ${PETSC_ARCH}
|
||||
# include ${petsc_conf_rules}
|
||||
# include ${petsc_conf_variables}
|
||||
# show :
|
||||
# \t-@echo -n \${\${VARIABLE}}
|
||||
# " )
|
||||
|
||||
# macro (PETSC_GET_VARIABLE name var)
|
||||
# set (${var} "NOTFOUND" CACHE INTERNAL "Cleared" FORCE)
|
||||
# execute_process (COMMAND ${MAKE_EXECUTABLE} --no-print-directory -f ${petsc_config_makefile} show VARIABLE=${name}
|
||||
# OUTPUT_VARIABLE ${var}
|
||||
# RESULT_VARIABLE petsc_return)
|
||||
# endmacro (PETSC_GET_VARIABLE)
|
||||
|
||||
# petsc_get_variable (PETSC_LIB_DIR petsc_lib_dir)
|
||||
# petsc_get_variable (PETSC_EXTERNAL_LIB_BASIC petsc_libs_external)
|
||||
# petsc_get_variable (PETSC_CCPPFLAGS petsc_cpp_line)
|
||||
# petsc_get_variable (PETSC_INCLUDE petsc_include)
|
||||
# petsc_get_variable (PCC petsc_cc)
|
||||
# petsc_get_variable (PCC_FLAGS petsc_cc_flags)
|
||||
# petsc_get_variable (MPIEXEC petsc_mpiexec)
|
||||
# # We are done with the temporary Makefile, calling PETSC_GET_VARIABLE after this point is invalid!
|
||||
# file (REMOVE ${petsc_config_makefile})
|
||||
|
||||
# OUTPUT TYPE
|
||||
set (SPECTRAL OFF)
|
||||
set (FEM OFF)
|
||||
|
@ -47,10 +79,8 @@ endif (DAMASK_DRIVER STREQUAL "SPECTRAL")
|
|||
|
||||
|
||||
# set system include directories
|
||||
include_directories(
|
||||
${PETSC_DIR}/lib/petsc/conf/variables
|
||||
${PETSC_DIR}/lib/petsc/conf/rules
|
||||
../lib
|
||||
include_directories(${PETSC_DIR}/include
|
||||
lib
|
||||
${HDF5_DIR}/include
|
||||
)
|
||||
link_directories(${HDF5_DIR}/lib)
|
||||
|
@ -114,18 +144,18 @@ set (STANDARD_CHECK_gfortran "-std=f2008ts -pedantic-errors" )
|
|||
# all:
|
||||
# -name as_is: case sensitive Fortran!
|
||||
###################################################################################################
|
||||
set (COMPILE_OPTIONS_ifort "${COMPILE_OPTIONS_ifort} -DDAMASKVERSION=${DAMASK_V}" )
|
||||
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" )
|
||||
set (COMPILE_OPTIONS_ifort "${COMPILE_OPTIONS_ifort} -DDAMASKVERSION=\"${DAMASK_V}\"" )
|
||||
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" )
|
||||
|
||||
###################################################################################################
|
||||
# COMPILE SWITCHES FOR RUNTIME DEBUGGING
|
||||
|
@ -301,22 +331,41 @@ get_filename_component (Fortran_COMPILER_NAME ${CMAKE_Fortran_COMPILER} NAME)
|
|||
|
||||
if (Fortran_COMPILER_NAME MATCHES "ifort.*")
|
||||
# need the PETSC wrapped version of ifort
|
||||
set (CMAKE_Fortran_COMPILER "${PETSC_DIR}/bin/mpifort")
|
||||
set (CMAKE_Fortran_COMPILER "${PETSC_DIR}/bin/mpif90")
|
||||
# for RELEASE
|
||||
set (CMAKE_Fortran_FLAGS_RELEASE "${COMPILE_OPTIONS_ifort}")
|
||||
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 "${COMPILE_OPTIONS_ifort} ${DEBUG_OPTIONS_ifort}")
|
||||
set (CMAKE_EXE_LINKER_FLAGS_DEBUG "${LINK_OPTIONS_ifort} ${DEBUG_OPTIONS_ifort}")
|
||||
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}")
|
||||
elseif (Fortran_COMPILER_NAME MATCHES "gfortran.*")
|
||||
set (CMAKE_Fortran_COMPILER "${PETSC_DIR}/bin/mpif90")
|
||||
# for RELEASE
|
||||
set (CMAKE_Fortran_FLAGS_RELEASE "${COMPILE_OPTIONS_gfortran}")
|
||||
set (CMAKE_EXE_LINKER_FLAGS_RELEASE "${LINK_OPTIONS_gfortran} ${OPTIMIZATION_gfortran}")
|
||||
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 "${COMPILE_OPTIONS_gfortran} ${DEBUG_OPTIONS_gfortran}")
|
||||
set (CMAKE_EXE_LINKER_FLAGS_DEBUG "${LINK_OPTIONS_gfortran} ${DEBUG_OPTIONS_gfortran}")
|
||||
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.")
|
||||
|
@ -327,18 +376,26 @@ endif (Fortran_COMPILER_NAME MATCHES "ifort.*")
|
|||
# additional flag for SPECTRAL solver
|
||||
if (SPECTRAL)
|
||||
set (CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE} -DSpectral")
|
||||
set (CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG} -DSpectral")
|
||||
set (CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} -DSpectral")
|
||||
set (CMAKE_EXE_LINKER_FLAGS_DEBUG "${LINK_OPTIONS_ifort} -DSpectral")
|
||||
set (CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} -DSpectral")
|
||||
endif (SPECTRAL)
|
||||
# additional flags for FEM solver
|
||||
if (FEM)
|
||||
set (CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE} -DFEM")
|
||||
set (CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG} -DFEM")
|
||||
set (CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} -DFEM")
|
||||
set (CMAKE_EXE_LINKER_FLAGS_DEBUG "${LINK_OPTIONS_ifort} -DFEM")
|
||||
set (CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} -DFEM")
|
||||
endif (FEM)
|
||||
|
||||
# set PETSC flags
|
||||
set (CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE} -DPETSc")
|
||||
set (CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG} -DPETSc")
|
||||
set (CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} -DPETSc")
|
||||
set (CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} -DPETSc")
|
||||
|
||||
# set default project compiler flags
|
||||
# NOTE: some file requires different flags for compiling, DAMASK_$FLAGS
|
||||
# NOTE: some file might need different flags for compiling, DAMASK_$FLAGS
|
||||
# are essentially the swap for this purpose
|
||||
set (DAMASK_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE}" )
|
||||
set (DAMASK_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE}")
|
||||
|
|
Loading…
Reference in New Issue