Merge branch 'cmake' of magit1.mpie.de:damask/DAMASK into cmake

Conflicts:
	CMakeLists.txt
This commit is contained in:
Martin Diehl 2016-05-21 12:37:05 +02:00
commit 6023f64eff
2 changed files with 19 additions and 25 deletions

View File

@ -86,7 +86,16 @@ foreach (exlib ${TMP_LIST})
endforeach(exlib) endforeach(exlib)
set(CMAKE_Fortran_COMPILER "${MPIFC}") 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 DAMASK version (DAMASK_V) in DAMASK_ROOT
find_program (CAT_EXECUTABLE NAMES cat) find_program (CAT_EXECUTABLE NAMES cat)
@ -108,10 +117,8 @@ message("***Found FORTRAN MPI COMPILER:\n${MPIFC}\n" )
# Built-in options for DAMASK build system # Built-in options for DAMASK build system
# -> can be overwritten from commandline/install_script # -> can be overwritten from commandline/install_script
option(OPENMP "Use OpenMP libaries for DAMASK" ON ) option(OPENMP "Use OpenMP libaries for DAMASK" ON )
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(FEM "Build FEM solver for DAMASK" OFF )
if (NOT DEFINED CMAKE_BUILD_TYPE) if (NOT DEFINED CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release) set(CMAKE_BUILD_TYPE Release)
@ -131,18 +138,6 @@ else(DEFINED DAMASK_INSTALL)
endif(DEFINED DAMASK_INSTALL) endif(DEFINED DAMASK_INSTALL)
message("\n***The binary will be installed at\n${CMAKE_INSTALL_PREFIX}\n") 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} ${PETSC_INCLUDES}" )
set (DAMASK_INCLUDE_FLAGS "${DAMASK_INCLUDE_FLAGS} -I${PROJECT_SOURCE_DIR}/lib") 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") add_library(DAMASK_PREC "prec.f90")
if (SPECTRAL) if ("${PROJECT_NAME}" STREQUAL "DAMASK_spectral")
add_library(DAMASK_INTERFACE "spectral_interface.f90") add_library(DAMASK_INTERFACE "spectral_interface.f90")
elseif(FEM) elseif ("${PROJECT_NAME}" STREQUAL "DAMASK_FEM")
add_library(DAMASK_INTERFACE "DAMASK_FEM_interface.f90") add_library(DAMASK_INTERFACE "DAMASK_FEM_interface.f90")
endif(SPECTRAL) endif()
target_link_libraries(DAMASK_INTERFACE DAMASK_PREC) target_link_libraries(DAMASK_INTERFACE DAMASK_PREC)
add_library(DAMASK_IO "IO.f90") 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 # SPECTRAL solver and FEM solver use different mesh
# source files # source files
if (SPECTRAL) if ("${PROJECT_NAME}" STREQUAL "DAMASK_spectral")
add_library(DAMASK_MESH "mesh.f90") add_library(DAMASK_MESH "mesh.f90")
target_link_libraries(DAMASK_MESH DAMASK_MATH) target_link_libraries(DAMASK_MESH DAMASK_MATH)
endif(SPECTRAL) elseif ("${PROJECT_NAME}" STREQUAL "DAMASK_FEM")
if (FEM)
add_library(DAMASK_FEZoo "FEZoo.f90") add_library(DAMASK_FEZoo "FEZoo.f90")
target_link_libraries(DAMASK_FEZoo DAMASK_MATH) target_link_libraries(DAMASK_FEZoo DAMASK_MATH)
add_library(DAMASK_MESH "meshFEM.f90") add_library(DAMASK_MESH "meshFEM.f90")
target_link_libraries(DAMASK_MESH DAMASK_FEZoo) target_link_libraries(DAMASK_MESH DAMASK_FEZoo)
endif(FEM) endif()
add_library(DAMASK_MATERIAL "material.f90") add_library(DAMASK_MATERIAL "material.f90")
@ -194,4 +193,4 @@ if (SPECTRAL)
add_executable(DAMASK_spectral "DAMASK_spectral.f90") add_executable(DAMASK_spectral "DAMASK_spectral.f90")
target_link_libraries(DAMASK_spectral DAMASK_EXE) target_link_libraries(DAMASK_spectral DAMASK_EXE)
endif(SPECTRAL) endif(SPECTRAL)