-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
117 lines (87 loc) · 3.67 KB
/
Copy pathCMakeLists.txt
File metadata and controls
117 lines (87 loc) · 3.67 KB
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
#------------------------------------------------------------------------------#
# Set the minimum CMake version
#------------------------------------------------------------------------------#
cmake_minimum_required(VERSION 3.18)
#------------------------------------------------------------------------------#
# Setup the project
#------------------------------------------------------------------------------#
project(ASAUM VERSION 0.1.0)
set(default_build_type "Debug")
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "Setting build type to '${default_build_type}' as none was specified.")
set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE
STRING "Choose the type of build." FORCE)
# Set the possible values of build type for cmake-gui
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
"Debug" "Release" "MinSizeRel" "RelWithDebInfo")
endif()
# cmake module path
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/cmake")
# We need C++ 17
add_library( asaum )
set_property(TARGET asaum PROPERTY CXX_STANDARD 14)
set_property(TARGET asaum PROPERTY CXX_STANDARD_REQUIRED on)
set_property(TARGET asaum PROPERTY CXX_EXTENSIONS off)
include(CTest) # note: this adds a BUILD_TESTING which defaults to ON
set( ASAUM_TEST_TOLERANCE 2e-14 CACHE INTERNAL "")
set( ASAUM_TOOL_DIR "${PROJECT_SOURCE_DIR}/tools" CACHE INTERNAL "")
#------------------------------------------------------------------------------#
# Setup third party packages
#------------------------------------------------------------------------------#
find_package(Threads QUIET)
option(HAVE_THREADS "Have the pthreads library" ${Threads_FOUND})
if (HAVE_THREADS)
target_link_libraries(asaum PUBLIC Threads::Threads)
endif()
find_package(EXODUSII QUIET)
option(HAVE_EXODUS "Have the exodus library" ${EXODUSII_FOUND})
if(HAVE_EXODUS)
target_include_directories(asaum PUBLIC ${EXODUSII_INCLUDE_DIRS})
target_link_libraries(asaum PUBLIC ${EXODUSII_LIBRARIES})
else()
# set_target_properties(exogen PROPERTIES EXCLUDE_FROM_ALL true)
endif()
find_package(MPI COMPONENTS C CXX)
if (MPI_FOUND)
target_link_libraries(asaum PUBLIC MPI::MPI_C MPI::MPI_CXX)
endif()
find_package(ParMetis 4.0 QUIET)
option(HAVE_PARMETIS "Have the parmetis library" ${ParMetis_FOUND})
if (HAVE_PARMETIS)
find_package(METIS 5.1)
target_include_directories(asaum PUBLIC ${METIS_INCLUDE_DIRS})
target_link_libraries(asaum PUBLIC ${METIS_LIBRARIES})
target_include_directories(asaum PUBLIC ${ParMetis_INCLUDE_DIRS})
target_link_libraries(asaum PUBLIC ${ParMetis_LIBRARIES})
endif()
find_package(Lua 5.4 QUIET)
if (NOT Lua_FOUND)
find_package(Lua 5.2 REQUIRED)
endif()
target_include_directories(asaum PUBLIC ${LUA_INCLUDE_DIR})
target_link_libraries(asaum PUBLIC ${LUA_LIBRARIES} ${CMAKE_DL_LIBS})
# vtk
find_package(ZLIB QUIET)
option(HAVE_ZLIB "Have the zlib library" ${ZLIB_FOUND})
if (HAVE_ZLIB)
target_link_libraries(asaum PUBLIC ZLIB::ZLIB)
endif()
option(ENABLE_FP_EXCEPTIONS "Enable GNU floating point exceptions" off)
option(ENABLE_TRACE "Enable tracing" off)
#------------------------------------------------------------------------------#
# configure library
#------------------------------------------------------------------------------#
add_subdirectory(libsrc)
add_subdirectory(example)
#if (HAVE_EXODUS)
# add_subdirectory(exogen)
#endif()
#------------------------------------------------------------------------------#
# Add testing
#------------------------------------------------------------------------------#
if (BUILD_TESTING)
include(regression)
# find python for running regression tests
find_package (Python COMPONENTS Interpreter REQUIRED)
add_subdirectory(tests)
endif()