try to prevent make msg mess up cmake config
This commit is contained in:
parent
94f87ec723
commit
2135aaa83c
|
@ -1,23 +1,28 @@
|
||||||
########################################################################################
|
########################################################################################
|
||||||
# CMAKE for build the Material subroutine for BVP solution
|
# CMAKE for build the Material subroutine for BVP solution
|
||||||
########################################################################################
|
########################################################################################
|
||||||
|
project (DAMASK Fortran)
|
||||||
cmake_minimum_required (VERSION 2.8.0 FATAL_ERROR)
|
cmake_minimum_required (VERSION 2.8.0 FATAL_ERROR)
|
||||||
# PROJECT DEFINITION HAS TO BE ON TOP
|
|
||||||
# //The rest of the script relies on it to figure out relative position
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------------
|
||||||
# Find PETSc from environment
|
# Find PETSc from system environment
|
||||||
set(PETSC_DIR $ENV{PETSC_DIR})
|
set(PETSC_DIR $ENV{PETSC_DIR})
|
||||||
|
if ("${PETSC_DIR}" STREQUAL "")
|
||||||
|
message (FATAL_ERROR "PETSC_DIR is not defined in system!")
|
||||||
|
endif ("${PETSC_DIR}" STREQUAL "")
|
||||||
|
|
||||||
# if (NOT DEFINED PETSC_DIR)
|
# Find DAMASK version (DAMASK_V) in DAMASK_ROOT
|
||||||
# message (FATAL_ERROR "PETSC_DIR is not found!")
|
find_program (CAT_EXECUTABLE NAMES cat)
|
||||||
# endif (NOT DEFINED PETSC_DIR)
|
execute_process(COMMAND ${CAT_EXECUTABLE} ../../VERSION
|
||||||
|
RESULT_VARIABLE DAMASK_VERSION_RETURN
|
||||||
exec_program(mktemp ARGS -d OUTPUT_VARIABLE PETSC_TEMP)
|
OUTPUT_VARIABLE DAMASK_V
|
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
|
|
||||||
# BRUTAL FORCE TO FIND THE VARIABLES DEFINED IN PETSC
|
# BRUTAL FORCE TO FIND THE VARIABLES DEFINED IN PETSC
|
||||||
# ref:
|
# ref:
|
||||||
# https://github.com/jedbrown/cmake-modules/blob/master/FindPETSc.cmake
|
# https://github.com/jedbrown/cmake-modules/blob/master/FindPETSc.cmake
|
||||||
|
exec_program(mktemp ARGS -d OUTPUT_VARIABLE PETSC_TEMP)
|
||||||
|
|
||||||
set(petsc_conf_variables "${PETSC_DIR}/lib/petsc/conf/variables")
|
set(petsc_conf_variables "${PETSC_DIR}/lib/petsc/conf/variables")
|
||||||
set(petsc_conf_rules "${PETSC_DIR}/lib/petsc/conf/rules" )
|
set(petsc_conf_rules "${PETSC_DIR}/lib/petsc/conf/rules" )
|
||||||
# Generate a temporary makerfile to probe the PETSc configuration
|
# Generate a temporary makerfile to probe the PETSc configuration
|
||||||
|
@ -34,42 +39,30 @@ INCLUDE_DIRS := \${PETSC_FC_INCLUDES}
|
||||||
LIBRARIES := \${PETSC_WITH_EXTERNAL_LIB}
|
LIBRARIES := \${PETSC_WITH_EXTERNAL_LIB}
|
||||||
COMPILERF ?= \${FC}
|
COMPILERF ?= \${FC}
|
||||||
LINKERNAME ?= \${FLINKER}
|
LINKERNAME ?= \${FLINKER}
|
||||||
|
|
||||||
includes:
|
includes:
|
||||||
\t@echo \${INCLUDE_DIRS}
|
\t@echo \${INCLUDE_DIRS}
|
||||||
|
|
||||||
extlibs:
|
extlibs:
|
||||||
\t@echo \${LIBRARIES}
|
\t@echo \${LIBRARIES}
|
||||||
|
|
||||||
compilerf:
|
compilerf:
|
||||||
\t@echo \${COMPILERF}
|
\t@echo \${COMPILERF}
|
||||||
|
|
||||||
compilerc:
|
compilerc:
|
||||||
\t@echo \${COMPILERC}
|
\t@echo \${COMPILERC}
|
||||||
|
|
||||||
linker:
|
linker:
|
||||||
\t@echo \${LINKERNAME}")
|
\t@echo \${LINKERNAME}")
|
||||||
|
|
||||||
# Find DAMASK version (DAMASK_V) in DAMASK_ROOT
|
|
||||||
find_program (CAT_EXECUTABLE NAMES cat)
|
|
||||||
execute_process(COMMAND ${CAT_EXECUTABLE} ../../VERSION
|
|
||||||
RESULT_VARIABLE DAMASK_VERSION_RETURN
|
|
||||||
OUTPUT_VARIABLE DAMASK_V
|
|
||||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
||||||
|
|
||||||
# CMake will execute each target in the ${petsc_config_makefile}
|
# CMake will execute each target in the ${petsc_config_makefile}
|
||||||
# to acquire corresponding PETSc Variables.
|
# to acquire corresponding PETSc Variables.
|
||||||
# The include path and linking libraries in PETSc usually contains
|
# The include path and linking libraries in PETSc usually contains
|
||||||
# duplicated entries, which is cleaned up later using CMake list.
|
# duplicated entries, which is cleaned up later using CMake list.
|
||||||
find_program (MAKE_EXECUTABLE NAMES make gmake)
|
find_program (MAKE_EXECUTABLE NAMES make gmake)
|
||||||
# Find the PETSc includes directory settings
|
# Find the PETSc includes directory settings
|
||||||
execute_process(COMMAND ${MAKE_EXECUTABLE} -f ${petsc_config_makefile} "includes"
|
execute_process(COMMAND ${MAKE_EXECUTABLE} -f --no-print-directory ${petsc_config_makefile} "includes"
|
||||||
RESULT_VARIABLE PETSC_INCLUDES_RETURN
|
RESULT_VARIABLE PETSC_INCLUDES_RETURN
|
||||||
OUTPUT_VARIABLE petsc_includes
|
OUTPUT_VARIABLE petsc_includes
|
||||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
# Find the PETSc external linking directory settings
|
# Find the PETSc external linking directory settings
|
||||||
# //required for final linking, must be appended after the executable
|
# //required for final linking, must be appended after the executable
|
||||||
execute_process(COMMAND ${MAKE_EXECUTABLE} -f ${petsc_config_makefile} "extlibs"
|
execute_process(COMMAND ${MAKE_EXECUTABLE} -f --no-print-directory ${petsc_config_makefile} "extlibs"
|
||||||
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)
|
||||||
|
@ -79,12 +72,12 @@ execute_process(COMMAND ${MAKE_EXECUTABLE} -f ${petsc_config_makefile} "extlibs"
|
||||||
# //e.g. for PETSc configured with INTEL FORTRAN compiler
|
# //e.g. for PETSc configured with INTEL FORTRAN compiler
|
||||||
# // >>${MPIFC} -v
|
# // >>${MPIFC} -v
|
||||||
# // ifort version 14.0.3 --> This line is captured and parsed by CMake
|
# // ifort version 14.0.3 --> This line is captured and parsed by CMake
|
||||||
execute_process(COMMAND ${MAKE_EXECUTABLE} -f ${petsc_config_makefile} "compilerf"
|
execute_process(COMMAND ${MAKE_EXECUTABLE} -f --no-print-directory ${petsc_config_makefile} "compilerf"
|
||||||
RESULT_VARIABLE MPIFC_RETURN
|
RESULT_VARIABLE MPIFC_RETURN
|
||||||
OUTPUT_VARIABLE MPIFC
|
OUTPUT_VARIABLE MPIFC
|
||||||
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} -f ${petsc_config_makefile} "linker"
|
execute_process(COMMAND ${MAKE_EXECUTABLE} -f --no-print-directory ${petsc_config_makefile} "linker"
|
||||||
RESULT_VARIABLE PETSC_LINKER_RETURN
|
RESULT_VARIABLE PETSC_LINKER_RETURN
|
||||||
OUTPUT_VARIABLE PETSC_LINKER
|
OUTPUT_VARIABLE PETSC_LINKER
|
||||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
|
@ -104,7 +97,7 @@ foreach (exlib ${TMP_LIST})
|
||||||
endforeach(exlib)
|
endforeach(exlib)
|
||||||
|
|
||||||
set(CMAKE_Fortran_COMPILER "${MPIFC}")
|
set(CMAKE_Fortran_COMPILER "${MPIFC}")
|
||||||
project (DAMASK Fortran)
|
|
||||||
|
|
||||||
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" )
|
||||||
|
@ -127,6 +120,9 @@ option(OPENMP "Use OpenMP libaries for DAMASK"
|
||||||
option(OPTIMIZATION "DAMASK optimization level [OFF,DEFENSIVE,AGGRESSIVE]" "DEFENSIVE" )
|
option(OPTIMIZATION "DAMASK optimization level [OFF,DEFENSIVE,AGGRESSIVE]" "DEFENSIVE" )
|
||||||
option(SPECTRAL "Build spectral sovler for DAMASAK" OFF )
|
option(SPECTRAL "Build spectral sovler for DAMASAK" OFF )
|
||||||
option(FEM "Build FEM solver for DAMASK" OFF )
|
option(FEM "Build FEM solver for DAMASK" OFF )
|
||||||
|
option(BUILDCMD_PRE "Prefix for build CMD" "" )
|
||||||
|
option(BUILDCMD_POST "Postfix for build CMD" "" )
|
||||||
|
|
||||||
|
|
||||||
# COMPILE VARIABLES
|
# COMPILE VARIABLES
|
||||||
add_definitions(-DDAMASKVERSION="${DAMASK_V}")
|
add_definitions(-DDAMASKVERSION="${DAMASK_V}")
|
||||||
|
|
14
Makefile
14
Makefile
|
@ -6,12 +6,18 @@ SHELL = /bin/sh
|
||||||
all: spectral FEM
|
all: spectral FEM
|
||||||
|
|
||||||
|
|
||||||
spectral: build
|
spectral: build/spectral
|
||||||
@if [ ! -d build/spectral ]; then mkdir build/spectral; fi
|
@(cd build/spectral; make )
|
||||||
(cd build/spectral; cmake ../../ ;)
|
|
||||||
|
|
||||||
|
build/spectral: build
|
||||||
|
@mkdir build/spectral
|
||||||
|
@(cd build/spectral; cmake -DDAMASK_DRIVER=SPECTRAL ../..;)
|
||||||
|
|
||||||
|
|
||||||
build:
|
build:
|
||||||
mkdir build
|
@mkdir build
|
||||||
|
|
||||||
|
|
||||||
.PHONY: FEM
|
.PHONY: FEM
|
||||||
FEM:
|
FEM:
|
||||||
|
|
Loading…
Reference in New Issue