Skip to content

Commit 6a778f1

Browse files
authored
Merge 45c0392 into 17d8156
2 parents 17d8156 + 45c0392 commit 6a778f1

File tree

21 files changed

+4432
-198
lines changed

21 files changed

+4432
-198
lines changed

CMakeLists.txt

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ include(QuickCppLibUtils)
2828
include(QuickCppLibPolicies)
2929

3030
option(LLFIO_USE_EXPERIMENTAL_SG14_STATUS_CODE "Whether to use SG14 status_code for failure handling" OFF)
31+
option(LLFIO_DISABLE_LIBDISPATCH "Whether to disable automatic discovery of libdispatch/Grand Unified Dispatch" OFF)
3132
option(LLFIO_ENABLE_DEPENDENCY_SMOKE_TEST "Whether to build executables which are smoke tests that LLFIO is fully working. Used by various package managers such as vcpkg." OFF)
3233
option(LLFIO_ASSUME_CROSS_COMPILING "Whether to assume we are cross compiling. Normally automatically detected, but if automatic detection doesn't work, a working <filesystem> will not be found during cmake configure." OFF)
3334
option(UNIT_TESTS_BUILD_ALL "Whether to run all of the unit test suite." OFF)
@@ -283,6 +284,30 @@ int main() {
283284
all_compile_definitions(PUBLIC LLFIO_FORCE_EXPERIMENTAL_FILESYSTEM=1 KERNELTEST_FORCE_EXPERIMENTAL_FILESYSTEM=1)
284285
endif()
285286
endif()
287+
# Do we have Grand Central Dispatch on this platform?
288+
if(NOT LLFIO_DISABLE_LIBDISPATCH)
289+
function(check_have_libdispatch postfix)
290+
set(CMAKE_REQUIRED_LIBRARIES ${ARGN})
291+
check_cxx_source_compiles("
292+
#include <dispatch/dispatch.h>
293+
int main() {
294+
return dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0) != nullptr;
295+
}
296+
" LLFIO_HAS_LIBDISPATCH_${postfix})
297+
endfunction()
298+
check_have_libdispatch(BUILTIN)
299+
if(NOT LLFIO_HAS_LIBDISPATCH_BUILTIN)
300+
check_have_libdispatch(WITH_LIBDISPATCH dispatch)
301+
if(LLFIO_HAS_LIBDISPATCH_WITH_LIBDISPATCH)
302+
all_link_libraries(PUBLIC dispatch)
303+
endif()
304+
endif()
305+
else()
306+
all_compile_definitions(PUBLIC LLFIO_DYNAMIC_THREAD_POOL_GROUP_USING_GCD=0)
307+
endif()
308+
if(NOT LLFIO_HAS_LIBDISPATCH_BUILTIN AND NOT LLFIO_HAS_LIBDISPATCH_WITH_LIBDISPATCH AND (CMAKE_SYSTEM_NAME MATCHES "FreeBSD" OR APPLE))
309+
indented_message(FATAL_ERROR "FATAL: Grand Central Dispatch as libdispatch was not found on this FreeBSD or Mac OS system. libdispatch is required for LLFIO to build on those systems.")
310+
endif()
286311

287312
# Set any macros this library requires
288313
all_compile_definitions(PRIVATE LLFIO_INCLUDE_STORAGE_PROFILE=1 LLFIO_ENABLE_TEST_IO_MULTIPLEXERS=1)
@@ -293,7 +318,8 @@ if(LLFIO_USE_EXPERIMENTAL_SG14_STATUS_CODE)
293318
all_compile_definitions(PUBLIC LLFIO_EXPERIMENTAL_STATUS_CODE=1)
294319
endif()
295320
if(WIN32)
296-
all_compile_definitions(PRIVATE _WIN32_WINNT=0x601) ## Target Win7
321+
all_compile_definitions(PRIVATE _WIN32_WINNT=0x601) ## Target Win7
322+
target_compile_definitions(llfio_hl INTERFACE _WIN32_WINNT=0x601) ## Target Win7
297323
if(NOT LLFIO_USE_EXPERIMENTAL_SG14_STATUS_CODE)
298324
target_link_libraries(llfio_hl INTERFACE ntkernel-error-category::hl)
299325
target_link_libraries(llfio_dl PUBLIC ntkernel-error-category::dl)

cmake/headers.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ set(llfio_HEADERS
2929
"include/llfio/v2.0/detail/impl/cached_parent_handle_adapter.ipp"
3030
"include/llfio/v2.0/detail/impl/clone.ipp"
3131
"include/llfio/v2.0/detail/impl/config.ipp"
32+
"include/llfio/v2.0/detail/impl/dynamic_thread_pool_group.ipp"
3233
"include/llfio/v2.0/detail/impl/fast_random_file_handle.ipp"
3334
"include/llfio/v2.0/detail/impl/io_multiplexer.ipp"
3435
"include/llfio/v2.0/detail/impl/path_discovery.ipp"
@@ -77,6 +78,7 @@ set(llfio_HEADERS
7778
"include/llfio/v2.0/detail/impl/windows/test/iocp_multiplexer.ipp"
7879
"include/llfio/v2.0/detail/impl/windows/utils.ipp"
7980
"include/llfio/v2.0/directory_handle.hpp"
81+
"include/llfio/v2.0/dynamic_thread_pool_group.hpp"
8082
"include/llfio/v2.0/fast_random_file_handle.hpp"
8183
"include/llfio/v2.0/file_handle.hpp"
8284
"include/llfio/v2.0/fs_handle.hpp"

cmake/tests.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ set(llfio_TESTS
77
"test/tests/directory_handle_create_close/runner.cpp"
88
"test/tests/directory_handle_enumerate/kernel_directory_handle_enumerate.cpp.hpp"
99
"test/tests/directory_handle_enumerate/runner.cpp"
10+
"test/tests/dynamic_thread_pool_group.cpp"
1011
"test/tests/fast_random_file_handle.cpp"
1112
"test/tests/file_handle_create_close/kernel_file_handle.cpp.hpp"
1213
"test/tests/file_handle_create_close/runner.cpp"
@@ -27,6 +28,7 @@ set(llfio_TESTS
2728
"test/tests/section_handle_create_close/kernel_section_handle.cpp.hpp"
2829
"test/tests/section_handle_create_close/runner.cpp"
2930
"test/tests/shared_fs_mutex.cpp"
31+
"test/tests/statfs.cpp"
3032
"test/tests/symlink_handle_create_close/kernel_symlink_handle.cpp.hpp"
3133
"test/tests/symlink_handle_create_close/runner.cpp"
3234
"test/tests/traverse.cpp"

include/llfio/revision.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
// Note the second line of this file must ALWAYS be the git SHA, third line ALWAYS the git SHA update time
2-
#define LLFIO_PREVIOUS_COMMIT_REF a74411eddb6401ab884c5f92cccc24b9a64a9e6f
3-
#define LLFIO_PREVIOUS_COMMIT_DATE "2021-02-23 14:33:57 +00:00"
4-
#define LLFIO_PREVIOUS_COMMIT_UNIQUE a74411ed
2+
#define LLFIO_PREVIOUS_COMMIT_REF 1cf5addd4a11570624f8faf17491431d7dde5427
3+
#define LLFIO_PREVIOUS_COMMIT_DATE "2021-02-23 12:58:16 +00:00"
4+
#define LLFIO_PREVIOUS_COMMIT_UNIQUE 1cf5addd

0 commit comments

Comments
 (0)