-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
122 lines (110 loc) · 2.5 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
cmake_minimum_required(VERSION 3.21)
project(allio)
set(CMAKE_CXX_STANDARD 17)
include(FetchContent)
FetchContent_Declare(
Catch2
GIT_REPOSITORY https://github.com/catchorg/Catch2.git
GIT_TAG v3.1.0
)
FetchContent_MakeAvailable(Catch2)
FetchContent_Declare(
tl_expected
GIT_REPOSITORY https://github.com/vasama/expected.git
GIT_TAG master
)
FetchContent_MakeAvailable(tl_expected)
FetchContent_Declare(
unifex
GIT_REPOSITORY https://github.com/facebookexperimental/libunifex.git
GIT_TAG main
)
FetchContent_MakeAvailable(unifex)
add_library(allio
source/directory_handle.cpp
source/default_multiplexer.cpp
source/file_handle.cpp
source/filesystem_handle.cpp
source/handle.cpp
source/manual_multiplexer.cpp
source/multiplexer.cpp
source/platform_handle.cpp
source/result.cpp
source/socket_handle.cpp
source/static_multiplexer_handle_relation_provider.cpp
)
if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
FetchContent_Declare(
win32
GIT_REPOSITORY https://github.com/vasama/win32.git
GIT_TAG master
)
FetchContent_MakeAvailable(win32)
target_sources(allio
PRIVATE
source/posix_socket.cpp
source/win32/api_string.cpp
source/win32/default_multiplexer.cpp
source/win32/file_handle.cpp
source/win32/filesystem_handle.cpp
source/win32/iocp_file_handle.cpp
source/win32/iocp_multiplexer.cpp
source/win32/iocp_socket_handle.cpp
source/win32/kernel.cpp
source/win32/kernel_error.cpp
source/win32/platform_handle.cpp
source/win32/posix_socket.cpp
source/win32/wsa_error.cpp
source/win32/wsa_ex.cpp
)
target_link_libraries(allio
PRIVATE
win32
)
endif()
if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
target_sources(allio
PRIVATE
source/posix_socket.cpp
source/linux/default_multiplexer.cpp
source/linux/file_handle.cpp
source/linux/filesystem_handle.cpp
source/linux/io_uring_file_handle.cpp
source/linux/io_uring_multiplexer.cpp
source/linux/io_uring_socket_handle.cpp
source/linux/platform_handle.cpp
source/linux/posix_socket.cpp
source/linux/unique_fd.cpp
)
endif()
target_include_directories(allio
PUBLIC
include
)
target_compile_features(allio
PUBLIC
cxx_std_20
)
target_link_libraries(allio
PUBLIC
expected
unifex
)
if(MSVC)
target_compile_options(allio
PRIVATE
/Zc:preprocessor
)
endif()
if(PROJECT_IS_TOP_LEVEL)
add_executable(allio-test
source/file_handle.test.cpp
source/path_view.test.cpp
source/socket_handle.test.cpp
)
target_link_libraries(allio-test
PRIVATE
allio
Catch2::Catch2WithMain
)
endif()