@@ -34,7 +34,8 @@ find_package(Threads REQUIRED)
34
34
find_package (OpenMP REQUIRED )
35
35
36
36
set (FETCHCONTENT_QUIET OFF )
37
- include (FetchContent )
37
+ include (FetchContent ) # For CMake-friendly dependencies
38
+ include (ExternalProject ) # If the dependency is not CMake-friendly
38
39
39
40
# GTest (required by Google Benchmark)
40
41
FetchContent_Declare (
@@ -79,7 +80,7 @@ FetchContent_Declare(
79
80
GIT_TAG master
80
81
)
81
82
82
- # Suppress TBB’ s own tests:
83
+ # Suppress TBB' s own tests:
83
84
set (TBB_TEST OFF CACHE BOOL "Do not build TBB tests" FORCE )
84
85
FetchContent_MakeAvailable (IntelTBB )
85
86
@@ -159,14 +160,55 @@ FetchContent_Declare(
159
160
)
160
161
FetchContent_MakeAvailable (NielsLohmannJSON )
161
162
162
- # Yaoyuan Guo YYJSON for more flexible & performant C-style parsing
163
+ # Yaoyuan Guo's YYJSON for more flexible & performant C-style parsing
163
164
FetchContent_Declare (
164
165
YaoyuanGuoYYJSON
165
166
GIT_REPOSITORY https://github.com/ibireme/yyjson.git
166
167
GIT_TAG 0.10.0
167
168
)
168
169
FetchContent_MakeAvailable (YaoyuanGuoYYJSON )
169
170
171
+ # Chris Kohlhoff's ASIO standalone, avoiding Boost... integration is a bit tricky:
172
+ # https://github.com/cpm-cmake/CPM.cmake/blob/master/examples/asio-standalone/CMakeLists.txt
173
+ FetchContent_Declare (
174
+ ChrisKohlhoffASIO
175
+ GIT_REPOSITORY https://github.com/chriskohlhoff/asio.git
176
+ GIT_TAG master
177
+ )
178
+ FetchContent_MakeAvailable (ChrisKohlhoffASIO )
179
+ add_library (asio INTERFACE )
180
+ target_include_directories (asio SYSTEM INTERFACE ${chriskohlhoffasio_SOURCE_DIR} /asio/include )
181
+ target_compile_definitions (asio INTERFACE ASIO_STANDALONE ASIO_NO_DEPRECATED )
182
+
183
+ # Jens Axboe's liburing to simplify I/O operations on Linux
184
+ # https://github.com/axboe/liburing/pull/438
185
+ # https://github.com/axboe/liburing/issues/946
186
+ if (CMAKE_SYSTEM_NAME STREQUAL "Linux" )
187
+ set (LIBURING_DIR ${CMAKE_BINARY_DIR} /_deps/jensaxboeliburing )
188
+ ExternalProject_Add (
189
+ JensAxboeLibUring
190
+ GIT_REPOSITORY https://github.com/axboe/liburing.git
191
+ GIT_TAG liburing-2.8
192
+ GIT_SHALLOW 1
193
+ PREFIX ${CMAKE_BINARY_DIR} /_deps/
194
+ SOURCE_DIR ${LIBURING_DIR}
195
+ CONFIGURE_COMMAND echo Configuring LibUring && cd ${LIBURING_DIR} && ./configure --nolibc --cc=${CMAKE_C_COMPILER} --cxx=${CMAKE_CXX_COMPILER};
196
+ BUILD_COMMAND cd ${LIBURING_DIR} && make;
197
+ INSTALL_COMMAND ""
198
+ UPDATE_COMMAND ""
199
+ )
200
+ add_library (liburing_internal STATIC IMPORTED GLOBAL )
201
+ add_dependencies (liburing_internal JensAxboeLibUring )
202
+ set_property (TARGET liburing_internal
203
+ PROPERTY IMPORTED_LOCATION
204
+ ${LIBURING_DIR} /src/liburing.a
205
+ )
206
+ set_property (TARGET liburing_internal
207
+ PROPERTY INTERFACE_INCLUDE_DIRECTORIES
208
+ ${LIBURING_DIR} /src/include
209
+ )
210
+ endif ()
211
+
170
212
# ------------------------------------------------------------------------------
171
213
# Main Executable
172
214
# ------------------------------------------------------------------------------
@@ -219,13 +261,18 @@ target_link_libraries(less_slow
219
261
range-v3
220
262
cppcoro
221
263
unifex
264
+ asio
222
265
stringzilla
223
266
yyjson
224
267
ctre
225
268
# There is no `absl` shortcut:
226
269
# https://github.com/abseil/abseil-cpp/blob/master/CMake/README.md#available-abseil-cmake-public-targets
227
270
absl::flat_hash_map
228
271
nlohmann_json::nlohmann_json
229
- $< $< STREQUAL:${CMAKE_SYSTEM_NAME} ,Linux> :TBB::tbb>
230
- $< $< STREQUAL:${CMAKE_SYSTEM_NAME} ,Linux> :OpenMP::OpenMP_CXX>
231
- )
272
+ )
273
+
274
+ if (CMAKE_SYSTEM_NAME STREQUAL "Linux" )
275
+ target_link_libraries (less_slow PRIVATE TBB::tbb )
276
+ target_link_libraries (less_slow PRIVATE OpenMP::OpenMP_CXX )
277
+ target_link_libraries (less_slow PRIVATE liburing_internal )
278
+ endif ()
0 commit comments