-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
85 lines (67 loc) · 1.96 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
cmake_minimum_required(VERSION 3.14)
include(cmake/prelude.cmake)
project(
skye
VERSION 0.12.0
DESCRIPTION "Skye is an HTTP server framework for C++20"
HOMEPAGE_URL "https://github.com/luketokheim/skye"
LANGUAGES CXX
)
include(cmake/project-is-top-level.cmake)
include(cmake/variables.cmake)
# ---- Declare library ----
add_library(skye_skye INTERFACE)
add_library(skye::skye ALIAS skye_skye)
set_property(
TARGET skye_skye PROPERTY
EXPORT_NAME skye
)
target_include_directories(
skye_skye ${warning_guard}
INTERFACE
"$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>"
)
target_compile_features(skye_skye INTERFACE cxx_std_20)
# Target Windows 10 SDK from asio
if(WIN32)
target_compile_definitions(skye_skye INTERFACE _WIN32_WINNT=0x0A00)
endif()
find_package(Boost REQUIRED)
target_link_libraries(skye_skye INTERFACE Boost::boost)
find_package(fmt QUIET)
if(fmt_FOUND)
target_link_libraries(skye_skye INTERFACE fmt::fmt)
endif()
# Use io_uring on Linux. Requires liburing-dev package and kernel support.
find_library(URING_LIBRARY uring)
option(
ENABLE_IO_URING
"Enable the io_uring backend on Linux if liburing is found"
OFF)
if(ENABLE_IO_URING AND URING_LIBRARY)
target_compile_definitions(
skye_skye
INTERFACE
BOOST_ASIO_HAS_IO_URING
BOOST_ASIO_DISABLE_EPOLL)
target_link_libraries(skye_skye INTERFACE uring)
endif()
# Enable AVX2 vectorization for Linux x64. Faster buffer copies!
option(ENABLE_ARCH "Build with Skylake CPU specific instructions" OFF)
if(ENABLE_ARCH)
target_compile_options(skye_skye INTERFACE -march=skylake)
endif()
# ---- Install rules ----
if(NOT CMAKE_SKIP_INSTALL_RULES)
include(cmake/install-rules.cmake)
endif()
# ---- Developer mode ----
if(NOT skye_DEVELOPER_MODE)
return()
elseif(NOT PROJECT_IS_TOP_LEVEL)
message(
AUTHOR_WARNING
"Developer mode is intended for developers of skye"
)
endif()
include(cmake/dev-mode.cmake)