location depends on PETSC_ARCH (if set)
This commit is contained in:
parent
f6684a0692
commit
67352d9ec7
|
@ -1,11 +1,11 @@
|
||||||
cmake_minimum_required (VERSION 3.10.0)
|
cmake_minimum_required (VERSION 3.10.0)
|
||||||
include (FindPkgConfig REQUIRED)
|
include (FindPkgConfig REQUIRED)
|
||||||
|
|
||||||
set(PETSC_DIR $ENV{PETSC_DIR})
|
if (DEFINED ENV{PETSC_DIR})
|
||||||
if (PETSC_DIR STREQUAL "")
|
message ("PETSC_DIR:\n$ENV{PETSC_DIR}\n")
|
||||||
|
else ()
|
||||||
message (FATAL_ERROR "PETSc location (PETSC_DIR) is not defined")
|
message (FATAL_ERROR "PETSc location (PETSC_DIR) is not defined")
|
||||||
endif ()
|
endif ()
|
||||||
message ("PETSC_DIR:\n${PETSC_DIR}\n")
|
|
||||||
|
|
||||||
# Dummy project to determine compiler names and version
|
# Dummy project to determine compiler names and version
|
||||||
project (Prerequisites LANGUAGES)
|
project (Prerequisites LANGUAGES)
|
||||||
|
@ -79,13 +79,13 @@ else ()
|
||||||
message (FATAL_ERROR "Compiler type (CMAKE_Fortran_COMPILER_ID) not recognized")
|
message (FATAL_ERROR "Compiler type (CMAKE_Fortran_COMPILER_ID) not recognized")
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
file (STRINGS "${PETSC_DIR}/lib/petsc/conf/petscvariables" PETSC_EXTERNAL_LIB REGEX "PETSC_WITH_EXTERNAL_LIB = .*$?")
|
file (STRINGS "$ENV{PETSC_DIR}/$ENV{PETSC_ARCH}/lib/petsc/conf/petscvariables" PETSC_EXTERNAL_LIB REGEX "PETSC_WITH_EXTERNAL_LIB = .*$?")
|
||||||
string (REGEX MATCHALL "-[lLW]([^\" ]+)" PETSC_EXTERNAL_LIB "${PETSC_EXTERNAL_LIB}")
|
string (REGEX MATCHALL "-[lLW]([^\" ]+)" PETSC_EXTERNAL_LIB "${PETSC_EXTERNAL_LIB}")
|
||||||
list (REMOVE_DUPLICATES PETSC_EXTERNAL_LIB)
|
list (REMOVE_DUPLICATES PETSC_EXTERNAL_LIB)
|
||||||
string (REPLACE ";" " " PETSC_EXTERNAL_LIB "${PETSC_EXTERNAL_LIB}")
|
string (REPLACE ";" " " PETSC_EXTERNAL_LIB "${PETSC_EXTERNAL_LIB}")
|
||||||
message ("PETSC_EXTERNAL_LIB:\n${PETSC_EXTERNAL_LIB}\n")
|
message ("PETSC_EXTERNAL_LIB:\n${PETSC_EXTERNAL_LIB}\n")
|
||||||
|
|
||||||
file (STRINGS "${PETSC_DIR}/lib/petsc/conf/petscvariables" PETSC_INCLUDES REGEX "PETSC_FC_INCLUDES = .*$?")
|
file (STRINGS "$ENV{PETSC_DIR}/$ENV{PETSC_ARCH}/lib/petsc/conf/petscvariables" PETSC_INCLUDES REGEX "PETSC_FC_INCLUDES = .*$?")
|
||||||
string (REGEX MATCHALL "-I([^\" ]+)" PETSC_INCLUDES "${PETSC_INCLUDES}")
|
string (REGEX MATCHALL "-I([^\" ]+)" PETSC_INCLUDES "${PETSC_INCLUDES}")
|
||||||
list (REMOVE_DUPLICATES PETSC_INCLUDES)
|
list (REMOVE_DUPLICATES PETSC_INCLUDES)
|
||||||
string (REPLACE ";" " " PETSC_INCLUDES "${PETSC_INCLUDES}")
|
string (REPLACE ";" " " PETSC_INCLUDES "${PETSC_INCLUDES}")
|
||||||
|
|
|
@ -16,15 +16,15 @@ if (PROJECT_NAME STREQUAL "damask-grid")
|
||||||
|
|
||||||
file(GLOB grid-sources grid/*.f90)
|
file(GLOB grid-sources grid/*.f90)
|
||||||
|
|
||||||
if(NOT CMAKE_BUILD_TYPE STREQUAL "SYNTAXONLY")
|
if (NOT CMAKE_BUILD_TYPE STREQUAL "SYNTAXONLY")
|
||||||
add_executable(DAMASK_grid ${damask-sources} ${grid-sources})
|
add_executable(DAMASK_grid ${damask-sources} ${grid-sources})
|
||||||
install (TARGETS DAMASK_grid RUNTIME DESTINATION bin)
|
install (TARGETS DAMASK_grid RUNTIME DESTINATION bin)
|
||||||
else()
|
else ()
|
||||||
add_library(DAMASK_grid OBJECT ${damask-sources} ${grid-sources})
|
add_library(DAMASK_grid OBJECT ${damask-sources} ${grid-sources})
|
||||||
exec_program (mktemp OUTPUT_VARIABLE nothing)
|
exec_program (mktemp OUTPUT_VARIABLE nothing)
|
||||||
exec_program (mktemp ARGS -d OUTPUT_VARIABLE black_hole)
|
exec_program (mktemp ARGS -d OUTPUT_VARIABLE black_hole)
|
||||||
install (PROGRAMS ${nothing} DESTINATION ${black_hole})
|
install (PROGRAMS ${nothing} DESTINATION ${black_hole})
|
||||||
endif()
|
endif ()
|
||||||
|
|
||||||
elseif (PROJECT_NAME STREQUAL "damask-mesh")
|
elseif (PROJECT_NAME STREQUAL "damask-mesh")
|
||||||
|
|
||||||
|
@ -33,4 +33,4 @@ elseif (PROJECT_NAME STREQUAL "damask-mesh")
|
||||||
add_executable(DAMASK_mesh ${damask-sources} ${mesh-sources})
|
add_executable(DAMASK_mesh ${damask-sources} ${mesh-sources})
|
||||||
install (TARGETS DAMASK_mesh RUNTIME DESTINATION bin)
|
install (TARGETS DAMASK_mesh RUNTIME DESTINATION bin)
|
||||||
|
|
||||||
endif()
|
endif ()
|
||||||
|
|
Loading…
Reference in New Issue