diff options
author | Niall Douglas (s [underscore] sourceforge {at} nedprod [dot] com) <spamtrap@nedprod.com> | 2019-10-04 16:24:28 +0300 |
---|---|---|
committer | Niall Douglas (s [underscore] sourceforge {at} nedprod [dot] com) <spamtrap@nedprod.com> | 2019-10-04 16:24:28 +0300 |
commit | 4bf1142ca61104193d061f58475b0f991de16398 (patch) | |
tree | 3c983f5910240200d4b757df482e7eb9f6605494 /CMakeLists.txt | |
parent | 7b5a2b5fa56cd53959e573a4750e09fe76030284 (diff) |
Replace git submodule based dependencies with cmake install based dependencies instead.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 113 |
1 files changed, 35 insertions, 78 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 5e382ab7..25a35eb9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -42,9 +42,10 @@ if(NOT PROJECT_IS_DEPENDENCY) UpdateRevisionHppFromGit("${CMAKE_CURRENT_SOURCE_DIR}/include/llfio/revision.hpp") endif() # Find my library dependencies -find_quickcpplib_library(quickcpplib 1.0 REQUIRED) -find_quickcpplib_library(outcome 2.0 REQUIRED) -find_quickcpplib_library(kerneltest 1.0 REQUIRED) +find_quickcpplib_library(outcome + GIT_REPOSITORY "https://github.com/ned14/outcome.git" + REQUIRED +) if(WIN32) add_subdirectory("include/llfio/ntkernel-error-category" EXCLUDE_FROM_ALL) endif() @@ -57,6 +58,13 @@ include(QuickCppLibMakeLibrary) # Make an interface only library so dependent CMakeLists can bring in this header-only library include(QuickCppLibMakeHeaderOnlyLibrary) +# If we have concepts, enable those for both myself and all inclusions +apply_cxx_concepts_to(INTERFACE llfio_hl) +apply_cxx_concepts_to(PUBLIC llfio_sl llfio_dl) + +# If we have coroutines, enable those for the shared library build only +apply_cxx_coroutines_to(PRIVATE llfio_dl) + # Make preprocessed edition of this library target if(NOT PROJECT_IS_DEPENDENCY) if(NOT PYTHONINTERP_FOUND) @@ -85,7 +93,7 @@ if(NOT PROJECT_IS_DEPENDENCY) WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" ) if(NOT CMAKE_VERSION VERSION_LESS 3.3) - add_dependencies(outcome_hl ${target}) + add_dependencies(llfio_hl ${target}) endif() endfunction() make_single_header(llfio_hl-pp-posix @@ -120,66 +128,6 @@ include(QuickCppLibMakeDoxygen) # Set the standard definitions for these libraries and bring in the all_* helper functions include(QuickCppLibApplyDefaultDefinitions) -# Do we have the Coroutines TS? -function(CheckCXXHasCoroutines iter) - set(CMAKE_REQUIRED_FLAGS ${ARGN}) - check_cxx_source_compiles(" -#if __has_include(<coroutine>) -#include <coroutine> -using std::suspend_never; -#elif __has_include(<experimental/coroutine>) -#include <experimental/coroutine> -using std::experimental::suspend_never; -#endif -class resumable{ -public: - struct promise_type - { - resumable get_return_object() { return {}; } - auto initial_suspend() { return suspend_never(); } - auto final_suspend() { return suspend_never(); } - int return_value(int x) { return x; } - void unhandled_exception(); - }; - bool resume() { return true; } - int get() { return 0; } -}; -resumable g() { co_return 0; } -int main() { return g().get(); } -" CXX_HAS_COROUTINES${iter}) - set(CXX_HAS_COROUTINES${iter} ${CXX_HAS_COROUTINES${iter}} PARENT_SCOPE) -endfunction() -include(CheckCXXSourceCompiles) -set(HAVE_COROUTINES 0) -CheckCXXHasCoroutines(_BY_DEFAULT) -if(CXX_HAS_COROUTINES_BY_DEFAULT) - set(HAVE_COROUTINES 1) -endif() -if(NOT HAVE_COROUTINES) - if(MSVC) - CheckCXXHasCoroutines(_MSVC "/await") - if(CXX_HAS_COROUTINES_MSVC) - add_compile_options("/await") - set(HAVE_COROUTINES 1) - endif() - endif() - if(CLANG OR GCC) - CheckCXXHasCoroutines(_CLANG_GCC "-fcoroutines-ts") - if(CXX_HAS_COROUTINES_CLANG_GCC) - add_compile_options("-fcoroutines-ts") - set(HAVE_COROUTINES 1) - endif() - CheckCXXHasCoroutines(_CLANG_GCC_LIBCXX "-stdlib=libc++ -fcoroutines-ts") - if(CXX_HAS_COROUTINES_CLANG_GCC_LIBCXX) - add_compile_options("-stdlib=libc++ -fcoroutines-ts") - set(HAVE_COROUTINES 1) - endif() - endif() -endif() -if(HAVE_COROUTINES) - all_compile_definitions(PUBLIC "LLFIO_HAVE_COROUTINES=1") -endif() - # Set the C++ features this library requires all_compile_features(PUBLIC # cxx_exceptions ## Annoyingly not supported by cmake 3.6 @@ -245,22 +193,31 @@ if(TARGET llfio-example_single-header) endif() endif() -# For all possible configurations of this library, add each test -include(QuickCppLibMakeStandardTests) -# For each test target, set definitions and linkage -foreach(target ${llfio_COMPILE_TEST_TARGETS} ${llfio_TEST_TARGETS}) - target_compile_definitions(${target} PRIVATE LLFIO_INCLUDE_ASYNC_FILE_HANDLE=1 LLFIO_INCLUDE_STORAGE_PROFILE=1) -endforeach() -foreach(test_target ${llfio_TEST_TARGETS}) - target_link_libraries(${test_target} PRIVATE kerneltest::hl) -endforeach() -if(MSVC) +if(NOT PROJECT_IS_DEPENDENCY) + # For all possible configurations of this library, add each test + include(QuickCppLibMakeStandardTests) + # For each test target, set definitions and linkage + foreach(target ${llfio_COMPILE_TEST_TARGETS} ${llfio_TEST_TARGETS}) + target_compile_definitions(${target} PRIVATE LLFIO_INCLUDE_ASYNC_FILE_HANDLE=1 LLFIO_INCLUDE_STORAGE_PROFILE=1) + endforeach() + find_quickcpplib_library(kerneltest + GIT_REPOSITORY "https://github.com/ned14/kerneltest.git" + REQUIRED + ) foreach(test_target ${llfio_TEST_TARGETS}) - target_compile_options(${test_target} PRIVATE /wd4503) ## decorated name length exceeded - if(NOT CLANG) - target_compile_options(${test_target} PRIVATE /permissive-) ## future parsing - endif() + target_link_libraries(${test_target} PRIVATE kerneltest::hl) + if(test_target MATCHES "coroutines") + apply_cxx_coroutines_to(PRIVATE ${test_target}) + endif() endforeach() + if(MSVC) + foreach(test_target ${llfio_TEST_TARGETS}) + target_compile_options(${test_target} PRIVATE /wd4503) ## decorated name length exceeded + if(NOT CLANG) + target_compile_options(${test_target} PRIVATE /permissive-) ## future parsing + endif() + endforeach() + endif() endif() # Cache this library's auto scanned sources for later reuse |