CMakeLists.txt 3.18 KB
Newer Older
1
set(CMAKE_LEGACY_CYGWIN_WIN32 0)
2 3 4
cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
project(AMDiS)

5 6 7 8 9 10
set(AMDiS_VERSION "1.1.0")

set(BASE_DIR ${AMDiS_SOURCE_DIR})
set(SOURCE_DIR ${BASE_DIR}/src)

if (NOT CMAKE_BUILD_TYPE)
11 12
  set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING
      "Choose the type of build, options are: None Debug Release [RelWithDebInfo] MinSizeRel."
13 14 15 16 17 18
      FORCE)
endif ()

# ------------------------------------------------------------------------------

# some options to control the build process
19
option(ENABLE_PARALLEL_DOMAIN "Use parallel domain decomposition"     false)
20
option(ENABLE_MPI             "Compile with MPI compiler and library" false)
21 22 23 24
option(ENABLE_UMFPACK         "Enable support for the UMFPACK solver" true)
option(ENABLE_EXTENSIONS      "Use extensions for AMDiS"              false)
option(ENABLE_HYPRE           "Use HYPRE AMG solver"                  false)
option(ENABLE_PNG             "Use png reader/writer"                 false)
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41

include(CMakeDependentOption)
# additional options for parallel_domain
# {
cmake_dependent_option(ENABLE_ZOLTAN
  "Add support for the Parallel Partitioning suite Zoltan" false
  "ENABLE_PARALLEL_DOMAIN" false)

cmake_dependent_option(ENABLE_PARALLEL_SOLVERS
  "Add some problem dependent solver, e.g. Feti, Navier-Stokes and Cahn-Hilliard" true
  "ENABLE_PARALLEL_DOMAIN" false)

cmake_dependent_option(ENABLE_BDDCML
  "Add support for the BDDCML library" false
  "ENABLE_PARALLEL_DOMAIN" false)
# }

42 43 44 45 46 47 48 49 50 51 52

# enable/disable some more features
option(ENABLE_COMPRESSION "Use output compression for vtu and arh files" true)
mark_as_advanced(ENABLE_COMPRESSION)

option(ENABLE_REINIT "Compile reinit library" true)
mark_as_advanced(ENABLE_REINIT)

option(ENABLE_COMPOSITE_FEM "Compile compositeFEM library" true)
mark_as_advanced(ENABLE_COMPOSITE_FEM)

53 54 55 56 57 58
option(ENABLE_OPENMP "Compile with OpenMP flags. (Experimental)" false)
mark_as_advanced(ENABLE_OPENMP)

option(ENABLE_SEQ_PETSC "Use sequential PETSc solvers" false)
mark_as_advanced(ENABLE_SEQ_PETSC)

59 60 61 62 63 64 65
option(BUILD_SHARED_LIBS "Build all libraries as shared or static, default: shared" true)
mark_as_advanced(BUILD_SHARED_LIBS)

if (MSVC)
  set(BUILD_SHARED_LIBS false)
  mark_as_advanced(BUILD_SHARED_LIBS)
  message(WARNING "Currently we can only build static libraries with Visual Studio")
66 67

  add_definitions(-DNOMINMAX -D_CONSOLE -DSTRICT -D_SCL_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_WARNINGS)
68 69 70 71
endif (MSVC)

# parallel of sequential version
if (ENABLE_PARALLEL_DOMAIN)
72
  set(ENABLE_MPI CACHE BOOL "Compile with MPI compiler and library" FORCE)
73
  set(POSTFIX "-p")
74
else ()
75
  set(POSTFIX "-s")
76 77 78 79 80
endif ()

# ------------------------------------------------------------------------------

if (${CMAKE_VERSION} VERSION_LESS "3.2")
81 82
  # Fallback to classical CMakeLists file
  include(${AMDiS_SOURCE_DIR}/cmake/CMakeLists.txt)
83 84
else ()
  include(${AMDiS_SOURCE_DIR}/cmake3/CMakeLists.txt)
85
endif ()
86 87 88 89 90 91 92 93 94 95

# ------------------------------------------------------------------------------

include(CMakePackageConfigHelpers)
write_basic_package_version_file(
  ${AMDiS_BINARY_DIR}/AMDISConfigVersion.cmake
  VERSION ${AMDiS_VERSION}
  COMPATIBILITY SameMajorVersion
)
install(FILES ${AMDiS_BINARY_DIR}/AMDISConfigVersion.cmake DESTINATION share/amdis/)