-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
75 lines (58 loc) · 2.57 KB
/
CMakeLists.txt
File metadata and controls
75 lines (58 loc) · 2.57 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
cmake_minimum_required(VERSION 3.25)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}
"${CMAKE_CURRENT_SOURCE_DIR}/support/cmake"
)
# Import `CMakeExtraUtils` or bundle `DynamicVersion.cmake` from there
cmake_policy(SET CMP0140 NEW)
include(DynamicVersion)
include(CompileOptions)
# Set ${PROJECT_VERSION} according to git tag or `.git_archival.txt`
dynamic_version(PROJECT_PREFIX GNCPP_)
project(${SKBUILD_PROJECT_NAME} VERSION ${PROJECT_VERSION})
option(GNCPP_VERSION "Version of the c++ backend (without the v prefix) for release builds")
set(GNCPP_BRANCH "master" CACHE STRING "Branch of the c++ backend for debug builds")
set(GNCPP_EIGEN_VERSION "3.4.0" CACHE STRING "Version of Eigen to use when compiling the interface and backend")
set(CMAKE_CXX_STANDARD 20)
set(CXX_STANDARD_REQUIRED ON)
message(STATUS "CMake version: ${CMAKE_VERSION}")
message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
message(STATUS "Wrapping GNCPy version: ${PROJECT_VERSION}")
# -----------------------------------------------------------------
# -------------------- C++ dependency stuff -----------------------
# -----------------------------------------------------------------
include(FetchContent)
if(CMAKE_BUILD_TYPE MATCHES "^[Rr]elease")
message(STATUS "Fetching gncpp (version: ${GNCPP_VERSION})...")
FetchContent_Declare(
gncpp
GIT_REPOSITORY https://github.com/drjdlarson/gncpp.git
GIT_TAG "v${GNCPP_VERSION}"
)
else()
message(STATUS "Fetching gncpp (branch: ${GNCPP_BRANCH})...")
FetchContent_Declare(
gncpp
GIT_REPOSITORY https://github.com/drjdlarson/gncpp.git
GIT_TAG ${GNCPP_BRANCH}
)
endif()
set(GNCPY_DOC OFF CACHE INTERNAL "Skip building docs")
set(GNCPY_TEST OFF CACHE INTERNAL "Skip building tests")
set(GNCPY_INSTALL ON CACHE INTERNAL "Generate the install target")
FetchContent_MakeAvailable(gncpp)
# -----------------------------------------------------------------
# ----------------- wrapper dependency stuff ----------------------
# -----------------------------------------------------------------
find_package(pybind11 CONFIG REQUIRED)
message(STATUS "Fetching Eigen3 dependency...")
FetchContent_Declare(
eigen
GIT_REPOSITORY https://gitlab.com/libeigen/eigen.git
GIT_TAG ${GNCPY_EIGEN_VERSION}
)
set(BUILD_TESTING OFF CACHE INTERNAL "Disable Eigen tests")
FetchContent_MakeAvailable(eigen)
# -----------------------------------------------------------------
# ------------------- create wrapper modules ----------------------
# -----------------------------------------------------------------
add_subdirectory(interface)