forked from boeschf/oomph
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
122 lines (103 loc) · 4.79 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
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
117
118
119
120
121
122
cmake_minimum_required(VERSION 3.17)
# CMake version is set at 3.17 because of find_package(CUDAToolkit)
project(oomph VERSION 0.1 LANGUAGES CXX)
# ---------------------------------------------------------------------
# CMake setup, C++ version, build type, modules, etc
# ---------------------------------------------------------------------
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_EXTENSIONS OFF)
if(NOT CMAKE_BUILD_TYPE) # AND NOT CMAKE_CONFIGURATION_TYPES)
set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Choose the type of build." FORCE)
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
endif()
set(OOMPH_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
list(APPEND CMAKE_MODULE_PATH "${OOMPH_MODULE_PATH}")
# ---------------------------------------------------------------------
# Define main oomph library
# ---------------------------------------------------------------------
add_library(oomph INTERFACE)
add_library(oomph::oomph ALIAS oomph)
include(oomph_common)
# ---------------------------------------------------------------------
# MPI setup
# ---------------------------------------------------------------------
find_package(MPI REQUIRED COMPONENTS CXX)
target_link_libraries(oomph INTERFACE MPI::MPI_CXX)
# ---------------------------------------------------------------------
# HWMALLOC setup
# ---------------------------------------------------------------------
include(hwmalloc)
target_link_libraries(oomph INTERFACE hwmalloc)
# ---------------------------------------------------------------------
# Boost setup
# ---------------------------------------------------------------------
find_package(Boost REQUIRED)
target_link_libraries(oomph INTERFACE Boost::boost)
# ---------------------------------------------------------------------
# include paths
# ---------------------------------------------------------------------
target_include_directories(oomph INTERFACE
$<INSTALL_INTERFACE:include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>)
# ---------------------------------------------------------------------
# oomph MPI variant
# ---------------------------------------------------------------------
include(oomph_mpi)
# ---------------------------------------------------------------------
# oomph UCX variant
# ---------------------------------------------------------------------
include(oomph_ucx)
# ---------------------------------------------------------------------
# oomph LibFabric variant
# ---------------------------------------------------------------------
include(oomph_libfabric)
# ---------------------------------------------------------------------
# main src subdir
# ---------------------------------------------------------------------
add_subdirectory(src)
# ---------------------------------------------------------------------
# generate config file
# ---------------------------------------------------------------------
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/config.hpp.in
${CMAKE_CURRENT_BINARY_DIR}/include/oomph/config.hpp @ONLY)
install(FILES ${PROJECT_BINARY_DIR}/include/oomph/config.hpp
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/oomph)
# ---------------------------------------------------------------------
# testing
# ---------------------------------------------------------------------
set(OOMPH_WITH_TESTING OFF CACHE BOOL "True if tests shall be built")
if (OOMPH_WITH_TESTING)
enable_testing()
add_subdirectory(test)
endif()
# ---------------------------------------------------------------------
# benchmarks
# ---------------------------------------------------------------------
set(OOMPH_WITH_BENCHMARKS OFF CACHE BOOL "Build benchmarks")
if (OOMPH_WITH_BENCHMARKS)
add_subdirectory(benchmarks)
endif()
# ---------------------------------------------------------------------
# install rules
# ---------------------------------------------------------------------
install(EXPORT oomph-targets
FILE oomph-targets.cmake
NAMESPACE oomph::
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake)
configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/oomphConfig.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/oomphConfig.cmake
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake)
write_basic_package_version_file(oomphConfigVersion.cmake
VERSION ${PROJECT_VERSION} COMPATIBILITY SameMajorVersion)
install(
FILES
${CMAKE_CURRENT_BINARY_DIR}/oomphConfig.cmake
${CMAKE_CURRENT_BINARY_DIR}/oomphConfigVersion.cmake
${CMAKE_CURRENT_LIST_DIR}/cmake/FindLibfabric.cmake
${CMAKE_CURRENT_LIST_DIR}/cmake/FindUCP.cmake
${CMAKE_CURRENT_LIST_DIR}/cmake/FindPMIx.cmake
DESTINATION
${CMAKE_INSTALL_LIBDIR}/cmake)
export(EXPORT oomph-targets
FILE "${CMAKE_CURRENT_BINARY_DIR}/oomph-targets.cmake")