-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
201 lines (158 loc) · 6.11 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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
cmake_minimum_required(VERSION 3.14)
set(CMAKE_C_COMPILER "${CMAKE_SOURCE_DIR}/llvm-project/build/bin/clang" CACHE PATH "clang")
set(CMAKE_CXX_COMPILER "${CMAKE_SOURCE_DIR}/llvm-project/build/bin/clang++" CACHE PATH "clang++")
enable_language(CXX)
message(STATUS "System name: ${CMAKE_SYSTEM_NAME}")
if(CMAKE_CXX_COMPILER_LOADED)
message(STATUS "Compiler path: ${CMAKE_CXX_COMPILER}")
message(STATUS "Compiler ID: ${CMAKE_CXX_COMPILER_ID}")
message(STATUS "Compiler version: ${CMAKE_CXX_COMPILER_VERSION}")
message(STATUS "Compiler is part of GCC: ${CMAKE_COMPILER_IS_GNUCXX}")
endif()
message(STATUS "ID: ${CMAKE_CXX_COMPILER_VERSION}")
set(CMAKE_EXPORT_COMPILE_COMMANDS ON )
include(cmake/prelude.cmake)
include(FetchContent)
project(
cppless
VERSION 0.1.0
DESCRIPTION "Short description"
HOMEPAGE_URL "https://spcl.inf.ethz.ch"
LANGUAGES CXX
)
include(cmake/project-is-top-level.cmake)
include(cmake/variables.cmake)
# ---- Download Dependencies ----
list(APPEND CMAKE_MODULE_PATH ${CMAKE_BINARY_DIR})
list(APPEND CMAKE_PREFIX_PATH ${CMAKE_BINARY_DIR})
add_definitions("-std=c++20")
if(NOT EXISTS "${CMAKE_BINARY_DIR}/conan.cmake")
message(STATUS "Downloading conan.cmake from https://github.com/conan-io/cmake-conan")
file(DOWNLOAD "https://raw.githubusercontent.com/lukasmoellerch/cmake-conan/lukasmoellerch-patch-2/conan.cmake"
"${CMAKE_BINARY_DIR}/conan.cmake"
TLS_VERIFY ON)
endif()
include(${CMAKE_BINARY_DIR}/conan.cmake)
# openssl is overriden to the latest version
# libcurl is needed
conan_cmake_configure(REQUIRES cereal/1.3.1
nlohmann_json/3.10.5
libnghttp2/1.47.0
boost-ext-ut/1.1.8
zlib/1.2.12
openssl/3.0.3
libcurl/7.80.0
argparse/2.3
boost/1.78.0
GENERATORS cmake_find_package
OPTIONS libnghttp2:with_asio=True
boost:without_locale=True
boost:without_iostreams=True
boost:without_log=True
boost:without_context=True
boost:without_coroutine=True
boost:without_fiber=True
boost:without_stacktrace=True
boost:without_contract=True
boost:without_filesystem=True
boost:without_json=True
boost:without_nowide=True
boost:without_test=True
boost:without_timer=True
boost:without_type_erasure=True
boost:without_wave=True
openssl:no_async=True)
# The find-package conan generator uses the variables which are not necessarily defined
set(_out_libraries "")
set(_out_libraries_target "")
set(0 1)
set(xcode_sysroot_option "")
# Use auto-detection for host settings (will use our custom cpp compiler)
conan_cmake_autodetect(CONAN_SETTINGS)
include(cmake/conan-utils.cmake)
# We need some setting for the build system to force cross compilation
conan_utils_host_system_name(CONAN_HOST_OS)
# Construct host compilation environment
set(ENV_HOST "")
if (DEFINED CMAKE_C_COMPILER)
list(APPEND ENV_HOST "CC=${CMAKE_C_COMPILER}")
endif()
if (DEFINED CMAKE_CXX_COMPILER)
list(APPEND ENV_HOST "CXX=${CMAKE_CXX_COMPILER}")
endif()
if (DEFINED AR)
list(APPEND ENV_HOST "AR=${AR}")
endif()
if (DEFINED RANLIB)
list(APPEND ENV_HOST "RANLIB=${RANLIB}")
endif()
if (DEFINED CMAKE_C_FLAGS)
list(APPEND ENV_HOST "CFLAGS=${CMAKE_C_FLAGS}")
endif()
if (DEFINED CMAKE_CXX_FLAGS)
list(APPEND ENV_HOST "CXXFLAGS=${CMAKE_CXX_FLAGS}")
endif()
if (DEFINED LINK_FLAGS)
list(APPEND ENV_HOST "LDFLAGS=${LINK_FLAGS}")
endif()
conan_cmake_install(PATH_OR_REFERENCE .
BUILD missing
ENV_HOST "${ENV_HOST}"
REMOTE conancenter
SETTINGS_BUILD os=${CONAN_HOST_OS}
SETTINGS_HOST ${CONAN_SETTINGS})
# ---- Declare library ----
FetchContent_Declare(aws-lambda-cpp
GIT_REPOSITORY https://github.com/awslabs/aws-lambda-cpp
GIT_TAG 2ebbf8e5759841b68709e7bd1c9d90808854a204
)
add_library(cppless_cppless INTERFACE)
add_library(cppless::cppless ALIAS cppless_cppless)
set_property(
TARGET cppless_cppless PROPERTY
EXPORT_NAME cppless
)
target_include_directories(
cppless_cppless ${warning_guard}
INTERFACE
"$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>"
)
target_compile_features(cppless_cppless INTERFACE cxx_std_20)
find_package(nlohmann_json REQUIRED)
target_link_libraries(cppless_cppless INTERFACE nlohmann_json::nlohmann_json)
find_package(cereal REQUIRED)
target_link_libraries(cppless_cppless INTERFACE cereal::cereal)
find_package(libnghttp2 REQUIRED)
target_link_libraries(cppless_cppless INTERFACE libnghttp2::libnghttp2)
find_package(argparse REQUIRED)
target_link_libraries(cppless_cppless INTERFACE argparse::argparse)
# ---- Tools ----
add_subdirectory(tools)
# ---- Install rules ----
if(NOT CMAKE_SKIP_INSTALL_RULES)
include(cmake/install-rules.cmake)
endif()
# ---- Benchmarks ----
if(PROJECT_IS_TOP_LEVEL OR DEFINED CPPLESS_SERVERLESS)
option(BUILD_BENCHMARKS "Build benchmarks tree." "${cppless_DEVELOPER_MODE}")
if(BUILD_BENCHMARKS OR DEFINED CPPLESS_SERVERLESS)
add_subdirectory(benchmarks)
endif()
endif()
# ---- Examples ----
if(PROJECT_IS_TOP_LEVEL OR DEFINED CPPLESS_SERVERLESS)
option(BUILD_EXAMPLES "Build examples tree." "${cppless_DEVELOPER_MODE}")
if(BUILD_EXAMPLES OR DEFINED CPPLESS_SERVERLESS)
add_subdirectory(examples)
endif()
endif()
# ---- Developer mode ----
if(NOT cppless_DEVELOPER_MODE)
return()
elseif(NOT PROJECT_IS_TOP_LEVEL)
message(
AUTHOR_WARNING
"Developer mode is intended for developers of cppless"
)
endif()
include(cmake/dev-mode.cmake)