CMakeLists.txt 2.42 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
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
      FORCE)
endif ()

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

# some options to control the build process
option(ENABLE_PARALLEL_DOMAIN "Use parallel domain decomposition"     false)
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)
option(ENABLE_SEQ_PETSC       "Use sequential PETSc solvers"          false)

# 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)

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")
43
44

  add_definitions(-DNOMINMAX -D_CONSOLE -DSTRICT -D_SCL_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_WARNINGS)
45
46
47
48
endif (MSVC)

# parallel of sequential version
if (ENABLE_PARALLEL_DOMAIN)
49
  set(POSTFIX "-p")
50
else ()
51
  set(POSTFIX "-s")
52
53
54
55
56
endif ()

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

if (${CMAKE_VERSION} VERSION_LESS "3.2")
57
58
  # Fallback to classical CMakeLists file
  include(${AMDiS_SOURCE_DIR}/cmake/CMakeLists.txt)
59
60
else ()
  include(${AMDiS_SOURCE_DIR}/cmake3/CMakeLists.txt)
61
endif ()
62
63
64
65
66
67
68
69
70
71

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

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/)