using different CMAKE projects for FEM/Spectral

This commit is contained in:
Martin Diehl 2016-05-20 11:51:50 +02:00
parent 5ef9c65cbe
commit 475c864ea3
2 changed files with 18 additions and 23 deletions

View File

@ -86,7 +86,17 @@ foreach (exlib ${TMP_LIST})
endforeach(exlib)
set(CMAKE_Fortran_COMPILER "${MPIFC}")
project (DAMASK Fortran)
# DAMASK DRIVER SELECTION
if ("${DAMASK_DRIVER}" STREQUAL "SPECTRAL")
project(DAMASK_spectral Fortran)
add_definitions(-DSpectral)
message("***Configuring Spectral Solver\n")
elseif ("${DAMASK_DRIVER}" STREQUAL "FEM")
project(DAMASK_FEM Fortran)
add_definitions(-DFEM)
message("***Configuring FEM Solver\n")
endif()
# Find DAMASK version (DAMASK_V) in DAMASK_ROOT
find_program (CAT_EXECUTABLE NAMES cat)
@ -114,8 +124,6 @@ set (DAMASK_VERSION_MINOR ${DAMASK_V})
# -> can be overwritten from commandline/install_script
option(OPENMP "Use OpenMP libaries for DAMASK" ON )
option(OPTIMIZATION "DAMASK optimization level [OFF,DEFENSIVE,AGGRESSIVE]" "DEFENSIVE" )
option(SPECTRAL "Build spectral sovler for DAMASAK" OFF )
option(FEM "Build FEM solver for DAMASK" OFF )
if (NOT DEFINED CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
@ -135,18 +143,6 @@ else(DEFINED DAMASK_INSTALL)
endif(DEFINED DAMASK_INSTALL)
message("\n***The binary will be installed at\n${CMAKE_INSTALL_PREFIX}\n")
# DAMASK DRIVER SELECTION
if ("${DAMASK_DRIVER}" STREQUAL "SPECTRAL")
set (SPECTRAL ON )
add_definitions(-DSpectral)
set (FEM OFF)
message("***Configuring Spectral Solver\n")
elseif ("${DAMASK_DRIVER}" STREQUAL "FEM")
set (FEM ON )
add_definitions(-DFEM)
set (SPECTRAL OFF)
message("***Configuring FEM Solver\n")
endif("${DAMASK_DRIVER}" STREQUAL "SPECTRAL")
set (DAMASK_INCLUDE_FLAGS "${DAMASK_INCLUDE_FLAGS} ${PETSC_INCLUDES}" )
set (DAMASK_INCLUDE_FLAGS "${DAMASK_INCLUDE_FLAGS} -I${PROJECT_SOURCE_DIR}/lib")

View File

@ -29,11 +29,11 @@ endif()
add_library(DAMASK_PREC "prec.f90")
if (SPECTRAL)
if ("${PROJECT_NAME}" STREQUAL "DAMASK_spectral")
add_library(DAMASK_INTERFACE "spectral_interface.f90")
elseif(FEM)
elseif ("${PROJECT_NAME}" STREQUAL "DAMASK_FEM")
add_library(DAMASK_INTERFACE "DAMASK_FEM_interface.f90")
endif(SPECTRAL)
endif()
target_link_libraries(DAMASK_INTERFACE DAMASK_PREC)
add_library(DAMASK_IO "IO.f90")
@ -56,16 +56,15 @@ target_link_libraries(DAMASK_MATH DAMASK_FEsolving)
# SPECTRAL solver and FEM solver use different mesh
# source files
if (SPECTRAL)
if ("${PROJECT_NAME}" STREQUAL "DAMASK_spectral")
add_library(DAMASK_MESH "mesh.f90")
target_link_libraries(DAMASK_MESH DAMASK_MATH)
endif(SPECTRAL)
if (FEM)
elseif ("${PROJECT_NAME}" STREQUAL "DAMASK_FEM")
add_library(DAMASK_FEZoo "FEZoo.f90")
target_link_libraries(DAMASK_FEZoo DAMASK_MATH)
add_library(DAMASK_MESH "meshFEM.f90")
target_link_libraries(DAMASK_MESH DAMASK_FEZoo)
endif(FEM)
endif()
add_library(DAMASK_MATERIAL "material.f90")
@ -194,4 +193,4 @@ if (SPECTRAL)
add_executable(DAMASK_spectral "DAMASK_spectral.f90")
target_link_libraries(DAMASK_spectral DAMASK_EXE)
endif(SPECTRAL)
endif(SPECTRAL)