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 | |
parent | 7b5a2b5fa56cd53959e573a4750e09fe76030284 (diff) |
Replace git submodule based dependencies with cmake install based dependencies instead.
-rw-r--r-- | .gitmodules | 21 | ||||
-rw-r--r-- | CMakeLists.txt | 113 | ||||
-rw-r--r-- | cmake/QuickCppLibBootstrap.cmake | 79 | ||||
-rw-r--r-- | cmake/headers.cmake | 8 | ||||
m--------- | include/llfio/ntkernel-error-category | 0 | ||||
-rw-r--r-- | include/llfio/revision.hpp | 6 | ||||
-rw-r--r-- | include/llfio/v2.0/config.hpp | 5 | ||||
-rw-r--r-- | include/llfio/v2.0/detail/impl/windows/import.hpp | 2 | ||||
m--------- | include/llfio/v2.0/outcome | 0 | ||||
m--------- | include/llfio/v2.0/quickcpplib | 0 | ||||
m--------- | test/kerneltest | 0 |
11 files changed, 98 insertions, 136 deletions
diff --git a/.gitmodules b/.gitmodules index b185938a..6745d815 100644 --- a/.gitmodules +++ b/.gitmodules @@ -5,27 +5,6 @@ fetchRecurseSubmodules = true ignore = none # shallow = true -[submodule "include/llfio/v2.0/outcome"] - path = include/llfio/v2.0/outcome - url = https://github.com/ned14/outcome.git - branch = master - fetchRecurseSubmodules = true - ignore = untracked -# shallow = true -[submodule "test/kerneltest"] - path = test/kerneltest - url = https://github.com/ned14/kerneltest.git - branch = master - fetchRecurseSubmodules = true - ignore = untracked -# shallow = true -[submodule "include/llfio/v2.0/quickcpplib"] - path = include/llfio/v2.0/quickcpplib - url = https://github.com/ned14/quickcpplib - branch = master - fetchRecurseSubmodules = true - ignore = untracked -# shallow = true [submodule "include/llfio/ntkernel-error-category"] path = include/llfio/ntkernel-error-category url = https://github.com/ned14/ntkernel-error-category.git 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 diff --git a/cmake/QuickCppLibBootstrap.cmake b/cmake/QuickCppLibBootstrap.cmake index 58c749e8..fafc182c 100644 --- a/cmake/QuickCppLibBootstrap.cmake +++ b/cmake/QuickCppLibBootstrap.cmake @@ -1,3 +1,25 @@ +# QuickCppLib cmake +# (C) 2016-2019 Niall Douglas <http://www.nedproductions.biz/> +# +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License in the accompanying file +# Licence.txt or at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file Licence.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + cmake_minimum_required(VERSION 3.1 FATAL_ERROR) # If necessary bring in the quickcpplib cmake tooling set(quickcpplib_done OFF) @@ -9,40 +31,39 @@ endforeach() if(NOT quickcpplib_done) # CMAKE_SOURCE_DIR is the very topmost parent cmake project # CMAKE_CURRENT_SOURCE_DIR is the current cmake subproject + set(CTEST_QUICKCPPLIB_CLONE_DIR) # If there is a magic .quickcpplib_use_siblings directory above the topmost project, use sibling edition - if(EXISTS "${CMAKE_SOURCE_DIR}/../.quickcpplib_use_siblings") + if(EXISTS "${CMAKE_SOURCE_DIR}/../.quickcpplib_use_siblings" AND NOT QUICKCPPLIB_DISABLE_SIBLINGS) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/../quickcpplib/cmakelib") set(CTEST_QUICKCPPLIB_SCRIPTS "${CMAKE_SOURCE_DIR}/../quickcpplib/scripts") - elseif(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/../.quickcpplib_use_siblings") - set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/../quickcpplib/cmakelib") - set(CTEST_QUICKCPPLIB_SCRIPTS "${CMAKE_CURRENT_SOURCE_DIR}/../quickcpplib/scripts") - elseif(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.gitmodules") - # Read in .gitmodules and look for myself - file(READ "${CMAKE_CURRENT_SOURCE_DIR}/.gitmodules" GITMODULESCONTENTS) - if(GITMODULESCONTENTS MATCHES ".*\\n?\\[submodule \"([^\"]+\\/quickcpplib)\"\\]") - set(quickcpplibpath "${CMAKE_MATCH_1}") - if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${quickcpplibpath}/cmake") - set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/${quickcpplibpath}/cmakelib") - set(CTEST_QUICKCPPLIB_SCRIPTS "${CMAKE_CURRENT_SOURCE_DIR}/${quickcpplibpath}/scripts") - else() - message(WARNING "WARNING: ${quickcpplibpath}/cmake does not exist, attempting git submodule update --init --recursive ...") - include(FindGit) - execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive - WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" - ) - if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${quickcpplibpath}/cmake") - set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/${quickcpplibpath}/cmakelib") - set(CTEST_QUICKCPPLIB_SCRIPTS "${CMAKE_CURRENT_SOURCE_DIR}/${quickcpplibpath}/scripts") - else() - message(FATAL_ERROR "FATAL: ${quickcpplibpath}/cmake does not exist and git submodule update --init --recursive did not make it available, bailing out") - endif() + elseif(CMAKE_BINARY_DIR) + # Place into root binary directory, same place as where find_quickcpplib_library() puts dependencies. + set(CTEST_QUICKCPPLIB_CLONE_DIR "${CMAKE_BINARY_DIR}/quickcpplib") + else() + # We must be being called from a ctest script. No way of knowing what the build directory + # will be, so simply clone into the current directory + set(CTEST_QUICKCPPLIB_CLONE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/quickcpplib") + endif() + if(CTEST_QUICKCPPLIB_CLONE_DIR) + file(MAKE_DIRECTORY "${CTEST_QUICKCPPLIB_CLONE_DIR}") + find_package(quickcpplib QUIET CONFIG NO_DEFAULT_PATH PATHS "${CTEST_QUICKCPPLIB_CLONE_DIR}/repo") + if(NOT quickcpplib_FOUND) + message(STATUS "quickcpplib not found, cloning git repository and installing into ${CTEST_QUICKCPPLIB_CLONE_DIR} ...") + include(FindGit) + execute_process(COMMAND "${GIT_EXECUTABLE}" clone "https://github.com/ned14/quickcpplib.git" repo + WORKING_DIRECTORY "${CTEST_QUICKCPPLIB_CLONE_DIR}" + OUTPUT_VARIABLE cloneout + ERROR_VARIABLE errout + ) + if(NOT EXISTS "${CTEST_QUICKCPPLIB_CLONE_DIR}/repo/cmakelib") + message(FATAL_ERROR "FATAL: Failed to git clone quickcpplib!\n\nstdout was: ${cloneout}\n\nstderr was: ${errout}") endif() - else() - message(FATAL_ERROR "FATAL: A copy of quickcpplib cannot be found, and cannot find a quickcpplib submodule in this git repository") endif() - else() - message(FATAL_ERROR "FATAL: A copy of quickcpplib cannot be found, and there are no git submodules to search") + set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CTEST_QUICKCPPLIB_CLONE_DIR}/repo/cmakelib") + set(CTEST_QUICKCPPLIB_SCRIPTS "${CTEST_QUICKCPPLIB_CLONE_DIR}/repo/scripts") endif() + + # Copy latest version of myself into end user + file(COPY "${CTEST_QUICKCPPLIB_SCRIPTS}/../cmake/QuickCppLibBootstrap.cmake" DESTINATION "${CMAKE_CURRENT_SOURCE_DIR}/cmake/") endif() -message(STATUS "CMAKE_MODULE_PATH = ${CMAKE_MODULE_PATH}") diff --git a/cmake/headers.cmake b/cmake/headers.cmake index 2c12b3ca..2952317d 100644 --- a/cmake/headers.cmake +++ b/cmake/headers.cmake @@ -3,10 +3,10 @@ set(llfio_HEADERS "include/kvstore/kvstore.hpp" "include/llfio.hpp" "include/llfio/llfio.hpp" - "include/llfio/ntkernel-error-category/include/config.hpp" - "include/llfio/ntkernel-error-category/include/detail/ntkernel-table.ipp" - "include/llfio/ntkernel-error-category/include/detail/ntkernel_category_impl.ipp" - "include/llfio/ntkernel-error-category/include/ntkernel_category.hpp" + "include/llfio/ntkernel-error-category/include/ntkernel-error-category/config.hpp" + "include/llfio/ntkernel-error-category/include/ntkernel-error-category/detail/ntkernel-table.ipp" + "include/llfio/ntkernel-error-category/include/ntkernel-error-category/detail/ntkernel_category_impl.ipp" + "include/llfio/ntkernel-error-category/include/ntkernel-error-category/ntkernel_category.hpp" "include/llfio/revision.hpp" "include/llfio/v2.0/algorithm/handle_adapter/cached_parent.hpp" "include/llfio/v2.0/algorithm/handle_adapter/combining.hpp" diff --git a/include/llfio/ntkernel-error-category b/include/llfio/ntkernel-error-category -Subproject d6b8e9a544792518613d98668277be29dc32227 +Subproject 2a6d4d320ee3df3921d6fd3562f0fc593b1823f diff --git a/include/llfio/revision.hpp b/include/llfio/revision.hpp index 08b07ba9..311d81b9 100644 --- a/include/llfio/revision.hpp +++ b/include/llfio/revision.hpp @@ -1,4 +1,4 @@ // Note the second line of this file must ALWAYS be the git SHA, third line ALWAYS the git SHA update time -#define LLFIO_PREVIOUS_COMMIT_REF aea9a0bda5ffc7aac4ba5e8c6582893b7aad7d90 -#define LLFIO_PREVIOUS_COMMIT_DATE "2019-09-25 15:31:53 +00:00" -#define LLFIO_PREVIOUS_COMMIT_UNIQUE aea9a0bd +#define LLFIO_PREVIOUS_COMMIT_REF 7b5a2b5fa56cd53959e573a4750e09fe76030284 +#define LLFIO_PREVIOUS_COMMIT_DATE "2019-09-25 17:14:32 +00:00" +#define LLFIO_PREVIOUS_COMMIT_UNIQUE 7b5a2b5f diff --git a/include/llfio/v2.0/config.hpp b/include/llfio/v2.0/config.hpp index 52766103..3f516f0f 100644 --- a/include/llfio/v2.0/config.hpp +++ b/include/llfio/v2.0/config.hpp @@ -232,6 +232,11 @@ LLFIO_V2_NAMESPACE_END LLFIO_V2_NAMESPACE_BEGIN namespace filesystem = std::experimental::filesystem; LLFIO_V2_NAMESPACE_END +#elif __has_include(<filesystem>) +#include <filesystem> +LLFIO_V2_NAMESPACE_BEGIN +namespace filesystem = std::filesystem; +LLFIO_V2_NAMESPACE_END #endif #elif __PCPP_ALWAYS_TRUE__ #include <experimental/filesystem> diff --git a/include/llfio/v2.0/detail/impl/windows/import.hpp b/include/llfio/v2.0/detail/impl/windows/import.hpp index 7a85ee4a..55d42b6b 100644 --- a/include/llfio/v2.0/detail/impl/windows/import.hpp +++ b/include/llfio/v2.0/detail/impl/windows/import.hpp @@ -60,7 +60,7 @@ Distributed under the Boost Software License, Version 1.0. #define NTKERNEL_ERROR_CATEGORY_STATIC 1 #endif #endif -#include "../../../../ntkernel-error-category/include/ntkernel_category.hpp" +#include "ntkernel-error-category/ntkernel_category.hpp" #endif LLFIO_V2_NAMESPACE_BEGIN diff --git a/include/llfio/v2.0/outcome b/include/llfio/v2.0/outcome deleted file mode 160000 -Subproject d50803be3e01d38bbeb91e9c6a0ae0fb86b7c68 diff --git a/include/llfio/v2.0/quickcpplib b/include/llfio/v2.0/quickcpplib deleted file mode 160000 -Subproject 6541411a0d0fc4b4609ad70b803d59b82c33c81 diff --git a/test/kerneltest b/test/kerneltest deleted file mode 160000 -Subproject 75783829f711cd348edb6157149aa50f2c52b64 |