still cannot link to petsc, but the rest is functioning properly
This commit is contained in:
parent
93d8c0045e
commit
fee445e1bd
|
@ -28,6 +28,44 @@ if (NOT DEFINED HDF5_DIR)
|
||||||
message (FATAL_ERROR "HDF5_DIR is not found!" )
|
message (FATAL_ERROR "HDF5_DIR is not found!" )
|
||||||
endif (NOT DEFINED HDF5_DIR)
|
endif (NOT DEFINED HDF5_DIR)
|
||||||
|
|
||||||
|
# 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}"
|
||||||
|
"## 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})
|
||||||
|
|
||||||
|
message("${PETSC_DIR}")
|
||||||
|
message("${PETSC_LIB_DIR}")
|
||||||
|
message("${PETSC_INCLUDE}")
|
||||||
|
|
||||||
# OUTPUT TYPE
|
# OUTPUT TYPE
|
||||||
set (SPECTRAL OFF)
|
set (SPECTRAL OFF)
|
||||||
set (FEM OFF)
|
set (FEM OFF)
|
||||||
|
@ -52,7 +90,9 @@ include_directories(${CMAKE_SOURCE_DIR}/code
|
||||||
lib
|
lib
|
||||||
${HDF5_DIR}/include
|
${HDF5_DIR}/include
|
||||||
)
|
)
|
||||||
link_directories(${HDF5_DIR}/lib)
|
link_directories(${HDF5_DIR}/lib
|
||||||
|
${PETSC_DIR}/lib
|
||||||
|
${PETSC_EXTERNAL_LIB_BASIC})
|
||||||
|
|
||||||
##
|
##
|
||||||
# set compile and debug flags
|
# set compile and debug flags
|
||||||
|
@ -254,7 +294,7 @@ set (LINK_OPTIONS_ifort "-shared-intel")
|
||||||
#-fno-fast-math:
|
#-fno-fast-math:
|
||||||
# --> otherwise, when setting -ffast-math, isnan always evaluates to false (I would call it a bug)
|
# --> otherwise, when setting -ffast-math, isnan always evaluates to false (I would call it a bug)
|
||||||
###################################################################################################
|
###################################################################################################
|
||||||
set (COMPILE_OPTIONS_gfortran "${COMPILE_OPTIONS_gfortran} -DDAMASKVERSION=${DAMASKVERSION}")
|
set (COMPILE_OPTIONS_gfortran "${COMPILE_OPTIONS_gfortran} -DDAMASKVERSION=\\\"${DAMASKVERSION}\\\"")
|
||||||
set (COMPILE_OPTIONS_gfortran "${COMPILE_OPTIONS_gfortran} -xf95-cpp-input" )
|
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} -ffree-line-length-240" )
|
||||||
set (COMPILE_OPTIONS_gfortran "${COMPILE_OPTIONS_gfortran} -fimplicit-none" )
|
set (COMPILE_OPTIONS_gfortran "${COMPILE_OPTIONS_gfortran} -fimplicit-none" )
|
||||||
|
|
Loading…
Reference in New Issue