remove duplicated flags
This commit is contained in:
parent
7335c27b3a
commit
aa2a738ccc
|
@ -1,18 +1,6 @@
|
|||
########################################################################################
|
||||
# CMAKE for build the Material subroutine for BVP solution
|
||||
########################################################################################
|
||||
# OPTIONS = standard (alternative): meaning
|
||||
#-------------------------------------------------------------
|
||||
# F90 = ifort (gfortran): compiler type, choose Intel or GNU
|
||||
# COMPILERNAME = name of the compiler executable (if not the same as the ype), e.g. using mpich-g90 instead of ifort
|
||||
# PORTABLE = TRUE (FALSE): decision, if executable is optimized for the machine on which it was built.
|
||||
# OPTIMIZATION = DEFENSIVE (OFF,AGGRESSIVE,ULTRA): Optimization mode: O2, O0, O3 + further options for most files, O3 + further options for all files
|
||||
# OPENMP = TRUE (FALSE): OpenMP multiprocessor support
|
||||
# PREFIX = arbitrary prefix (before compilername)
|
||||
# OPTION = arbitrary option (just before file to compile)
|
||||
# SUFFIX = arbitrary suffix (after file to compile)
|
||||
# STANDARD_CHECK = checking for Fortran 2008, compiler dependend
|
||||
########################################################################################
|
||||
cmake_minimum_required (VERSION 3.1.0 FATAL_ERROR)
|
||||
project (DAMASK Fortran)
|
||||
|
||||
|
@ -28,7 +16,7 @@ if (NOT DEFINED HDF5_DIR)
|
|||
message (FATAL_ERROR "HDF5_DIR is not found!" )
|
||||
endif (NOT DEFINED HDF5_DIR)
|
||||
|
||||
# OUTPUT TYPE
|
||||
# DAMASK DRIVER SELECTION
|
||||
set (SPECTRAL OFF)
|
||||
set (FEM OFF)
|
||||
if (DAMASK_DRIVER STREQUAL "SPECTRAL")
|
||||
|
@ -36,7 +24,7 @@ if (DAMASK_DRIVER STREQUAL "SPECTRAL")
|
|||
elseif (DAMASK_DRIVER STREQUAL "FEM")
|
||||
set (FEM ON )
|
||||
else (DAMASK_DRIVER STREQUAL "SPECTRAL")
|
||||
message (FATAL_ERROR "Unknown output, check build script!")
|
||||
message (FATAL_ERROR "Unknown driver detected, check build script!")
|
||||
endif (DAMASK_DRIVER STREQUAL "SPECTRAL")
|
||||
|
||||
# COMPILE VARIABLES
|
||||
|
@ -51,7 +39,7 @@ if (FEM)
|
|||
add_definitions(-DFEM)
|
||||
endif(FEM)
|
||||
|
||||
# brutal force to find the variables defined in PETSC
|
||||
# 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")
|
||||
|
@ -59,7 +47,7 @@ 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}"
|
||||
"## This file was autogenerated by FindPETSc.cmake
|
||||
"## This file was auto generated by CMake
|
||||
# PETSC_DIR = ${PETSC_DIR}
|
||||
# PETSC_ARCH = ${PETSC_ARCH}
|
||||
SHELL = /bin/sh
|
||||
|
@ -86,11 +74,11 @@ linker:
|
|||
find_program (MAKE_EXECUTABLE NAMES make gmake)
|
||||
execute_process(COMMAND ${MAKE_EXECUTABLE} -f ${petsc_config_makefile} "includes"
|
||||
RESULT_VARIABLE PETSC_INCLUDES_RETURN
|
||||
OUTPUT_VARIABLE PETSC_INCLUDES
|
||||
OUTPUT_VARIABLE petsc_includes
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
execute_process(COMMAND ${MAKE_EXECUTABLE} -f ${petsc_config_makefile} "extlibs"
|
||||
RESULT_VARIABLE PETSC_EXTERNAL_LIB_RETURN
|
||||
OUTPUT_VARIABLE PETSC_EXTERNAL_LIB
|
||||
OUTPUT_VARIABLE petsc_external_lib
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
execute_process(COMMAND ${MAKE_EXECUTABLE} -f ${petsc_config_makefile} "linker"
|
||||
RESULT_VARIABLE PETSC_LINK_LIB_RETURN
|
||||
|
@ -102,14 +90,27 @@ execute_process(COMMAND ${MAKE_EXECUTABLE} -f ${petsc_config_makefile} "compiler
|
|||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
file (REMOVE ${petsc_config_makefile})
|
||||
|
||||
# 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)
|
||||
|
||||
|
||||
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")
|
||||
message("***Use PETSC wrapped compiler @: ${MPIEXEC}\n")
|
||||
message("***Use PETSC wrapped compiler:\n${MPIEXEC}\n")
|
||||
|
||||
# set system include directories
|
||||
set (DAMASK_INCLUDE_FLAGS "${DAMASK_INCLUDE_FLAGS} ${PETSC_INCLUDES} -I${PROJECT_SOURCE_DIR}/lib -I${HDF5_DIR}/include")
|
||||
set (DAMASK_INCLUDE_FLAGS "${PETSC_INCLUDES} -I${PROJECT_SOURCE_DIR}/lib -I${HDF5_DIR}/include -lm")
|
||||
set (DAMASK_LINK_FLAGS "${PETSC_LINK_LIB} ${PETSC_EXTERNAL_LIB} -L${HDF5_DIR}/lib")
|
||||
|
||||
##
|
||||
|
@ -186,7 +187,6 @@ 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} -diag-remark 7410" )
|
||||
set (COMPILE_OPTIONS_ifort "${COMPILE_OPTIONS_ifort} -stand none" )
|
||||
set (COMPILE_OPTIONS_ifort "${COMPILE_OPTIONS_ifort} -warn nostderrors" )
|
||||
###################################################################################################
|
||||
# COMPILE SWITCHES FOR RUNTIME DEBUGGING
|
||||
|
|
Loading…
Reference in New Issue