forked from DLR-AMR/t8code
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
68 lines (51 loc) · 2.23 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
cmake_minimum_required( VERSION 3.16 )
project( T8CODE DESCRIPTION "Parallel algorithms and data structures for tree-based AMR with arbitrary element shapes." LANGUAGES C CXX )
include( CTest )
option( T8CODE_BUILD_AS_SHARED_LIBRARY "Whether t8code should be built as a shared or a static library" ON )
option( T8CODE_BUILD_TESTS "Build t8code's automated tests" ON )
option( T8CODE_BUILD_TUTORIALS "Build t8code's tutorials" ON )
option( T8CODE_BUILD_EXAMPLES "Build t8code's examples" ON )
option( T8CODE_ENABLE_MPI "Enable t8code's features which rely on MPI" ON )
option( T8CODE_ENABLE_VTK "Enable t8code's features which rely on VTK" OFF )
if( NOT CMAKE_BUILD_TYPE )
set( CMAKE_BUILD_TYPE "Release" )
endif()
set( CMAKE_C_STANDARD 11 )
set( CMAKE_C_STANDARD_REQUIRED ON )
set( CMAKE_C_EXTENSIONS OFF )
list( APPEND CMAKE_C_FLAGS "-Wall" )
set( CMAKE_CXX_STANDARD 17 )
set( CMAKE_CXX_STANDARD_REQUIRED ON )
set( CMAKE_CXX_EXTENSIONS OFF )
list( APPEND CMAKE_CXX_FLAGS "-Wall" )
if( T8CODE_ENABLE_MPI )
find_package( MPI COMPONENTS C REQUIRED )
if( NOT MPIEXEC_EXECUTABLE )
message( FATAL_ERROR "MPIEXEC was not found" )
endif()
set( SC_ENABLE_MPI ON )
set( mpi ON ) # This is very dirty, we should consider fixing this in the p4est repo
endif()
if( T8CODE_ENABLE_VTK )
find_package( VTK REQUIRED )
endif()
# Override default for this libsc option
set( BUILD_SHARED_LIBS ON CACHE BOOL "Build libsc as a shared library" )
# Prevent `libsc` and `p4est` from overwriting the default install prefix.
set(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT FALSE)
# Rpath options necessary for shared library install to work correctly in user projects.
set(CMAKE_INSTALL_NAME_DIR ${CMAKE_INSTALL_PREFIX}/lib)
set(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/lib)
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH true)
add_subdirectory( ${CMAKE_CURRENT_LIST_DIR}/sc )
add_subdirectory( ${CMAKE_CURRENT_LIST_DIR}/p4est )
add_subdirectory( ${CMAKE_CURRENT_LIST_DIR}/src )
if ( T8CODE_BUILD_TESTS )
add_subdirectory( ${CMAKE_CURRENT_LIST_DIR}/test )
endif()
if ( T8CODE_BUILD_TUTORIALS )
add_subdirectory( ${CMAKE_CURRENT_LIST_DIR}/tutorials )
endif()
if ( T8CODE_BUILD_EXAMPLES )
add_subdirectory( ${CMAKE_CURRENT_LIST_DIR}/example )
endif()