got petsc related flags for CMake
This commit is contained in:
parent
22689c1053
commit
48da078bfe
|
@ -39,60 +39,67 @@ file (WRITE "${petsc_config_makefile}"
|
||||||
"## This file was autogenerated by FindPETSc.cmake
|
"## This file was autogenerated by FindPETSc.cmake
|
||||||
# PETSC_DIR = ${PETSC_DIR}
|
# PETSC_DIR = ${PETSC_DIR}
|
||||||
# PETSC_ARCH = ${PETSC_ARCH}
|
# PETSC_ARCH = ${PETSC_ARCH}
|
||||||
|
SHELL = /bin/sh
|
||||||
include ${petsc_conf_rules}
|
include ${petsc_conf_rules}
|
||||||
include ${petsc_conf_variables}
|
include ${petsc_conf_variables}
|
||||||
show:
|
INCLUDE_DIRS := \${PETSC_FC_INCLUDES} -DPETSc
|
||||||
\t-@echo -n \${\${VARIABLE}}
|
LIBRARIES := \${PETSC_WITH_EXTERNAL_LIB}
|
||||||
|
COMPILERNAME ?= \${FC}
|
||||||
|
LINKERNAME ?= \${FLINKER}
|
||||||
|
|
||||||
|
includes:
|
||||||
|
\t@echo \${INCLUDE_DIRS}
|
||||||
|
extlibs:
|
||||||
|
\t@echo \${LIBRARIES}
|
||||||
|
compiler:
|
||||||
|
\t@echo \${COMPILERNAME}
|
||||||
|
|
||||||
|
linker:
|
||||||
|
\t@echo \${LINKERNAME}
|
||||||
")
|
")
|
||||||
|
|
||||||
macro (PETSC_GET_VARIABLE name var)
|
find_program (MAKE_EXECUTABLE NAMES make gmake)
|
||||||
set (${var} "NOTFOUND" CACHE INTERNAL "Cleared" FORCE)
|
execute_process(COMMAND ${MAKE_EXECUTABLE} -f ${petsc_config_makefile} "includes"
|
||||||
execute_process (COMMAND ${MAKE_EXECUTABLE} --no-print-directory -f ${petsc_config_makefile}
|
RESULT_VARIABLE PETSC_INCLUDES_RETURN
|
||||||
show VARIABLE=${name}
|
OUTPUT_VARIABLE PETSC_INCLUDES)
|
||||||
OUTPUT_VARIABLE ${var}
|
execute_process(COMMAND ${MAKE_EXECUTABLE} -f ${petsc_config_makefile} "extlibs"
|
||||||
RESULT_VARIABLE petsc_return)
|
RESULT_VARIABLE PETSC_EXTERNAL_LIB_RETURN
|
||||||
endmacro (PETSC_GET_VARIABLE)
|
OUTPUT_VARIABLE PETSC_EXTERNAL_LIB)
|
||||||
petsc_get_variable (PETSC_LIB_DIR "PETSC_LIB_DIR" )
|
execute_process(COMMAND ${MAKE_EXECUTABLE} -f ${petsc_config_makefile} "linker"
|
||||||
petsc_get_variable (PETSC_EXTERNAL_LIB_BASIC "PETSC_LIBS_EXTERNAL")
|
RESULT_VARIABLE PETSC_LINK_LIB_RETURN
|
||||||
petsc_get_variable (PETSC_CCPPFLAGS "PETSC_CPP_LINE" )
|
OUTPUT_VARIABLE PETSC_LINK_LIB)
|
||||||
petsc_get_variable (PETSC_INCLUDE "PETSC_INCLUDE" )
|
execute_process(COMMAND ${MAKE_EXECUTABLE} -f ${petsc_config_makefile} "compiler"
|
||||||
petsc_get_variable (PCC "PETSC_CC" )
|
RESULT_VARIABLE MPIEXEC_RETURN
|
||||||
petsc_get_variable (PCC_FLAGS "PETSC_CC_FLAGS" )
|
OUTPUT_VARIABLE MPIEXEC)
|
||||||
petsc_get_variable (MPIEXEC "PETSC_MPIEXEC" )
|
file (REMOVE ${petsc_config_makefile})
|
||||||
# We are done with the temporary Makefile, calling PETSC_GET_VARIABLE after this point is invalid!
|
|
||||||
# file (REMOVE ${petsc_config_makefile})
|
|
||||||
|
|
||||||
message("${PETSC_DIR}")
|
message("\nFound PETSC_DIR:\n${PETSC_DIR}")
|
||||||
message("${PETSC_LIB_DIR}")
|
message("Set PETSC_INCLUDES to:\n${PETSC_INCLUDES}")
|
||||||
message("${PETSC_INCLUDE}")
|
message("Set PETSC_EXTERNAL_LIB to:\n${PETSC_EXTERNAL_LIB}")
|
||||||
|
message("Set PETSC_LINK_LIB to:\n${PETSC_LINK_LIB}")
|
||||||
|
message("Use PETSC wrapped compiler @: ${MPIEXEC}")
|
||||||
|
|
||||||
# OUTPUT TYPE
|
# OUTPUT TYPE
|
||||||
set (SPECTRAL OFF)
|
set (SPECTRAL OFF)
|
||||||
set (FEM OFF)
|
set (FEM OFF)
|
||||||
set (MARC OFF)
|
|
||||||
set (ABAQUS OFF)
|
|
||||||
if (DAMASK_DRIVER STREQUAL "SPECTRAL")
|
if (DAMASK_DRIVER STREQUAL "SPECTRAL")
|
||||||
set (SPECTRAL ON )
|
set (SPECTRAL ON )
|
||||||
elseif (DAMASK_DRIVER STREQUAL "FEM")
|
elseif (DAMASK_DRIVER STREQUAL "FEM")
|
||||||
set (FEM ON )
|
set (FEM ON )
|
||||||
elseif (DAMASK_DRIVER STREQUAL "MARC")
|
|
||||||
set (MARC ON )
|
|
||||||
elseif (DAMASK_DRIVER STREQUAL "ABAQUS")
|
|
||||||
set (ABAQUS ON )
|
|
||||||
else (DAMASK_DRIVER STREQUAL "SPECTRAL")
|
else (DAMASK_DRIVER STREQUAL "SPECTRAL")
|
||||||
message (FATAL_ERROR "Unknown output, check build script!")
|
message (FATAL_ERROR "Unknown output, check build script!")
|
||||||
endif (DAMASK_DRIVER STREQUAL "SPECTRAL")
|
endif (DAMASK_DRIVER STREQUAL "SPECTRAL")
|
||||||
|
|
||||||
|
|
||||||
# set system include directories
|
# set system include directories
|
||||||
include_directories(${CMAKE_SOURCE_DIR}/code
|
include_directories(${PETSC_INCLUDES}
|
||||||
${PETSC_DIR}/include
|
|
||||||
lib
|
lib
|
||||||
${HDF5_DIR}/include
|
${HDF5_DIR}/include
|
||||||
)
|
)
|
||||||
link_directories(${HDF5_DIR}/lib
|
link_directories(${HDF5_DIR}/lib
|
||||||
${PETSC_DIR}/lib
|
${PETSC_LINK_LIB}
|
||||||
${PETSC_EXTERNAL_LIB_BASIC})
|
${PETSC_EXTERNAL_LIB}
|
||||||
|
)
|
||||||
|
|
||||||
##
|
##
|
||||||
# set compile and debug flags
|
# set compile and debug flags
|
||||||
|
@ -356,7 +363,7 @@ get_filename_component (Fortran_COMPILER_NAME ${CMAKE_Fortran_COMPILER} NAME)
|
||||||
|
|
||||||
if (Fortran_COMPILER_NAME MATCHES "ifort.*")
|
if (Fortran_COMPILER_NAME MATCHES "ifort.*")
|
||||||
# need the PETSC wrapped version of ifort
|
# need the PETSC wrapped version of ifort
|
||||||
set (CMAKE_Fortran_COMPILER "${PETSC_DIR}/bin/mpif90")
|
set (CMAKE_Fortran_COMPILER "${MPIEXEC}")
|
||||||
# for RELEASE
|
# for RELEASE
|
||||||
set (CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE} ${OPENMP_FLAG_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} ${STANDARD_CHECK_ifort}" )
|
||||||
|
@ -375,7 +382,7 @@ if (Fortran_COMPILER_NAME MATCHES "ifort.*")
|
||||||
set (CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} ${DEBUG_OPTIONS_ifort}")
|
set (CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} ${DEBUG_OPTIONS_ifort}")
|
||||||
#
|
#
|
||||||
elseif (Fortran_COMPILER_NAME MATCHES "gfortran.*")
|
elseif (Fortran_COMPILER_NAME MATCHES "gfortran.*")
|
||||||
set (CMAKE_Fortran_COMPILER "${PETSC_DIR}/bin/mpif90")
|
set (CMAKE_Fortran_COMPILER "${MPIEXEC}")
|
||||||
# for RELEASE
|
# for RELEASE
|
||||||
set (CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE} ${OPENMP_FLAG_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} ${STANDARD_CHECK_gfortran}" )
|
||||||
|
@ -414,12 +421,6 @@ if (FEM)
|
||||||
set (CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} -DFEM")
|
set (CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} -DFEM")
|
||||||
endif (FEM)
|
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
|
# set default project compiler flags
|
||||||
# NOTE: some file might need different flags for compiling, DAMASK_$FLAGS
|
# NOTE: some file might need different flags for compiling, DAMASK_$FLAGS
|
||||||
# are essentially the swap for this purpose
|
# are essentially the swap for this purpose
|
||||||
|
|
42
Makefile_bk
42
Makefile_bk
|
@ -1,42 +0,0 @@
|
||||||
SHELL = /bin/sh
|
|
||||||
########################################################################################
|
|
||||||
# Makefile for the installation of DAMASK
|
|
||||||
########################################################################################
|
|
||||||
.PHONY: all
|
|
||||||
all: spectral marc processing
|
|
||||||
|
|
||||||
.PHONY: spectral
|
|
||||||
spectral:
|
|
||||||
$(MAKE) DAMASK_spectral.exe -C code
|
|
||||||
|
|
||||||
.PHONY: FEM
|
|
||||||
FEM:
|
|
||||||
$(MAKE) DAMASK_FEM.exe -C code
|
|
||||||
|
|
||||||
.PHONY: marc
|
|
||||||
marc:
|
|
||||||
@./installation/mods_MarcMentat/apply_DAMASK_modifications.sh ${MAKEFLAGS}
|
|
||||||
|
|
||||||
.PHONY: processing
|
|
||||||
processing:
|
|
||||||
@if hash cython 2>/dev/null; then \
|
|
||||||
cd ./lib/damask; \
|
|
||||||
CC=gcc python setup_corientation.py build_ext --inplace; \
|
|
||||||
rm -rv build; \
|
|
||||||
rm *.c; \
|
|
||||||
fi
|
|
||||||
@./installation/compile_CoreModule.py ${MAKEFLAGS}
|
|
||||||
|
|
||||||
.PHONY: tidy
|
|
||||||
tidy:
|
|
||||||
@$(MAKE) tidy -C code >/dev/null
|
|
||||||
|
|
||||||
.PHONY: clean
|
|
||||||
clean:
|
|
||||||
@$(MAKE) cleanDAMASK -C code >/dev/null
|
|
||||||
|
|
||||||
.PHONY: install
|
|
||||||
install:
|
|
||||||
@./installation/symlink_Code.py ${MAKEFLAGS}
|
|
||||||
@./installation/symlink_Processing.py ${MAKEFLAGS}
|
|
||||||
|
|
Loading…
Reference in New Issue