-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
83 lines (71 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# Must be min. 3.19 because of nanobind
cmake_minimum_required(VERSION 3.19...3.29)
project(geodepot-api VERSION 1.0.4)
option(GD_BUILD_APPS "Build applications in addition to library" ON)
option(GD_BUILD_TESTING "Enable tests for geodepot" OFF)
option(GD_BUILD_BINDINGS "Build python bindings with pybind" ON)
option(BUILD_SHARED_LIBS "Build libraries as shared as opposed to static" ON)
# Set variables for building the bindings
if(GD_BUILD_BINDINGS)
message(
STATUS
"Configuring static library for Geodepot because GD_BUILD_BINDINGS is ON")
set(BUILD_SHARED_LIBS OFF)
endif()
if(NOT BUILD_SHARED_LIBS)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}")
endif()
# Global CMake variables are set here We use C++20, with the assumption that we
# only implement features that are supported by GCC, Clang, MSVC, Apple Clang
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Don't use extensions, because they might affect compiler compatibility
set(CMAKE_CXX_EXTENSIONS OFF)
# CMake modules, like the documentation module, go in here
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/")
add_compile_options(-Wno-dev)
# EXTERNAL LIBRARIES
include(CPM)
set(CPM_USE_LOCAL_PACKAGES ON)
find_package(CURL 8 REQUIRED)
find_package(nlohmann_json 3.7)
if (NOT nlohmann_json_FOUND)
CPMAddPackage("gh:nlohmann/[email protected]")
endif()
find_package(libarchive 3 QUIET)
if(NOT LibArchive_FOUND)
CPMAddPackage(
NAME
libarchive
VERSION
3.7.6
GITHUB_REPOSITORY
libarchive/libarchive
OPTIONS
"ENABLE_TAR ON"
"ENABLE_TAR_SHARED OFF"
"ENABLE_TEST OFF"
"ENABLE_CPIO OFF"
"ENABLE_XATTR OFF"
"ENABLE_ACL OFF")
endif()
# PROJECT LIBRARY
set(GEODEPOT_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include")
add_subdirectory(src)
# PROJECT EXECUTABLES
if(GD_BUILD_APPS)
add_subdirectory(apps)
endif()
# PROJECT PYTHON BINDINGS
if(GD_BUILD_BINDINGS)
add_subdirectory(geodepot-py)
# add_subdirectory(geodepot-cmake)
endif()
# PROJECT TESTS
if(GD_BUILD_TESTING)
# Must enable_testing() before add_subdirectory(tests)
enable_testing()
add_subdirectory(tests)
endif()