-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
109 lines (88 loc) · 4.27 KB
/
CMakeLists.txt
File metadata and controls
109 lines (88 loc) · 4.27 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
cmake_minimum_required(VERSION 3.26)
cmake_policy(SET CMP0074 NEW) # ``find_package()`` uses ``<PackageName>_ROOT`` variables.
cmake_policy(SET CMP0077 NEW) # ``option()`` honors normal variables.
cmake_policy(SET CMP0080 NEW) # ``BundleUtilities`` cannot be included at configure time.
cmake_policy(SET CMP0167 NEW) # Suppress FindBoost deprecation warning (retained for EbsdLib compatibility)
# The ``FindPythonInterp`` and ``FindPythonLibs`` modules are removed.
# if(CMAKE_VERSION VERSION_GREATER "3.27.0")
# cmake_policy(SET CMP0148 NEW)
# endif()
# resolves symlinks before collapsing ../ components.
if(CMAKE_VERSION VERSION_GREATER "3.28.0")
cmake_policy(SET CMP0152 NEW)
endif()
include(${CMAKE_CURRENT_LIST_DIR}/cmake/Utility.cmake)
include(CMakeDependentOption)
project(MTRSim
VERSION 1.0.0
DESCRIPTION "Microtexture Region Simulator"
LANGUAGES CXX
)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
# ------------------------------------------------------------------------------
# is building unit tests enabled
# ------------------------------------------------------------------------------
option(MTRSIM_BUILD_TESTS "Enable buildingtests" ON)
enable_vcpkg_manifest_feature(TEST_VAR MTRSIM_BUILD_TESTS FEATURE "tests")
# ------------------------------------------------------------------------------
# are multithreading algorithms enabled
# ------------------------------------------------------------------------------
option(MTRSIM_ENABLE_MULTICORE "Enable multicore support" ON)
enable_vcpkg_manifest_feature(TEST_VAR MTRSIM_ENABLE_MULTICORE FEATURE "parallel")
# ------------------------------------------------------------------------------
# Python bindings (optional)
# ------------------------------------------------------------------------------
option(MTRSIM_BUILD_PYTHON_BINDINGS "Build Python bindings via pybind11" ON)
enable_vcpkg_manifest_feature(TEST_VAR MTRSIM_BUILD_PYTHON_BINDINGS FEATURE "python")
if(MTRSIM_BUILD_PYTHON_BINDINGS)
find_package(Python3 COMPONENTS Interpreter Development REQUIRED)
find_package(pybind11 CONFIG REQUIRED)
endif()
# ------------------------------------------------------------------------------
# Dependencies
# ------------------------------------------------------------------------------
find_package(Eigen3 CONFIG REQUIRED)
find_package(CLI11 CONFIG REQUIRED)
find_package(nlohmann_json CONFIG REQUIRED)
find_package(spdlog CONFIG REQUIRED)
find_package(Stb REQUIRED)
# -----------------------------------------------------------------------
# Find HDF5 and get the path to the DLL libraries and put that into a
# global property for later install, debugging and packaging
# -----------------------------------------------------------------------
find_package(HDF5 1.14 MODULE REQUIRED)
get_target_property(hdf5_dll_path hdf5::hdf5 IMPORTED_LOCATION_RELEASE)
get_filename_component(hdf5_dll_path "${hdf5_dll_path}" DIRECTORY)
get_property(MTRSim_EXTRA_LIBRARY_DIRS GLOBAL PROPERTY MTRSim_EXTRA_LIBRARY_DIRS)
set_property(GLOBAL PROPERTY MTRSim_EXTRA_LIBRARY_DIRS ${MTRSim_EXTRA_LIBRARY_DIRS} ${hdf5_dll_path})
# -----------------------------------------------------------------------
# Find oneTBB and get the path to the DLL libraries and put that into a
# global property for later install, debugging and packaging
# -----------------------------------------------------------------------
if(MTRSIM_ENABLE_MULTICORE)
find_package(TBB CONFIG REQUIRED)
get_target_property(tbb_dll_path TBB::tbb IMPORTED_LOCATION_RELEASE)
get_filename_component(tbb_dll_path "${tbb_dll_path}" DIRECTORY)
get_property(MTRSIM_EXTRA_LIBRARY_DIRS GLOBAL PROPERTY MTRSIM_EXTRA_LIBRARY_DIRS)
set_property(GLOBAL PROPERTY MTRSIM_EXTRA_LIBRARY_DIRS ${MTRSIM_EXTRA_LIBRARY_DIRS} ${tbb_dll_path})
endif()
find_package(H5Support REQUIRED)
find_package(EbsdLib REQUIRED)
if(MTRSIM_BUILD_TESTS)
find_package(Catch2 CONFIG REQUIRED)
include(CTest)
include(Catch)
endif()
# ------------------------------------------------------------------------------
# Sub-projects
# ------------------------------------------------------------------------------
add_subdirectory(src/libmtrsim)
add_subdirectory(app)
if(MTRSIM_BUILD_TESTS)
add_subdirectory(tests)
endif()
if(MTRSIM_BUILD_PYTHON_BINDINGS)
add_subdirectory(wrapping/python)
endif()