From f628b169c216145400d839de1e31e1e6abde7d67 Mon Sep 17 00:00:00 2001 From: Joel Rosdahl Date: Sun, 24 Mar 2024 11:00:10 +0100 Subject: [PATCH] build: Improve build of bundled cxxurl third party dependency --- .clang-format | 2 +- LICENSE.adoc | 60 ++++++++++----------- src/ccache/CMakeLists.txt | 1 + src/ccache/storage/Storage.cpp | 2 +- src/ccache/storage/remote/FileStorage.hpp | 2 +- src/ccache/storage/remote/HttpStorage.cpp | 3 +- src/ccache/storage/remote/HttpStorage.hpp | 2 +- src/ccache/storage/remote/RedisStorage.hpp | 2 +- src/ccache/storage/remote/RemoteStorage.hpp | 3 +- src/third_party/CMakeLists.txt | 3 +- src/third_party/cxxurl/CMakeLists.txt | 9 ++++ src/third_party/{ => cxxurl/cxxurl}/url.cpp | 0 src/third_party/{ => cxxurl/cxxurl}/url.hpp | 0 13 files changed, 49 insertions(+), 40 deletions(-) create mode 100644 src/third_party/cxxurl/CMakeLists.txt rename src/third_party/{ => cxxurl/cxxurl}/url.cpp (100%) rename src/third_party/{ => cxxurl/cxxurl}/url.hpp (100%) diff --git a/.clang-format b/.clang-format index 3910db4d9..d41fa25d8 100644 --- a/.clang-format +++ b/.clang-format @@ -31,7 +31,7 @@ IncludeCategories: - Regex: '^$' + - Regex: '^<(cxxurl/url\.hpp|doctest/.*|fmt/.*|hiredis/.*|httplib\.h|nonstd/.*|tl/expected\.hpp|zstd\.h)>$' Priority: 3 # System headers: - Regex: '\.h.*>$' diff --git a/LICENSE.adoc b/LICENSE.adoc index c8e824a2d..901bd7e7d 100644 --- a/LICENSE.adoc +++ b/LICENSE.adoc @@ -418,6 +418,36 @@ SOFTWARE. ---- +=== src/third_party/cxxurl/cxxurl/url.* + +CxxUrl - A simple C++ URL class. Copied from CxxUrl v0.3 downloaded from +. It has the following license text: + +---- +The MIT License (MIT) + +Copyright (c) 2015 Christophe Meessen + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +---- + + === src/third_party/nonstd-span/nonstd/span.hpp This is the single header version of @@ -583,36 +613,6 @@ express Statement of Purpose. ---- -=== src/third_party/url.* - -CxxUrl - A simple C++ URL class. Copied from CxxUrl v0.3 downloaded from -. It has the following license text: - ----- -The MIT License (MIT) - -Copyright (c) 2015 Christophe Meessen - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. ----- - - === src/third_party/win32/getopt.* This implementation of `getopt_long()` for Win32 was taken from diff --git a/src/ccache/CMakeLists.txt b/src/ccache/CMakeLists.txt index 5952e8801..8169c98e2 100644 --- a/src/ccache/CMakeLists.txt +++ b/src/ccache/CMakeLists.txt @@ -45,6 +45,7 @@ find_package(Threads REQUIRED) target_link_libraries( ccache_framework PUBLIC + dep_cxxurl dep_fmt dep_nonstdspan dep_tlexpected diff --git a/src/ccache/storage/Storage.cpp b/src/ccache/storage/Storage.cpp index 7155f705a..1149940c9 100644 --- a/src/ccache/storage/Storage.cpp +++ b/src/ccache/storage/Storage.cpp @@ -39,7 +39,7 @@ #include #include -#include +#include #include #include diff --git a/src/ccache/storage/remote/FileStorage.hpp b/src/ccache/storage/remote/FileStorage.hpp index 4fb61b1aa..a5d067f21 100644 --- a/src/ccache/storage/remote/FileStorage.hpp +++ b/src/ccache/storage/remote/FileStorage.hpp @@ -20,7 +20,7 @@ #include -#include +#include #include #include diff --git a/src/ccache/storage/remote/HttpStorage.cpp b/src/ccache/storage/remote/HttpStorage.cpp index a74da0ea1..37221dec9 100644 --- a/src/ccache/storage/remote/HttpStorage.cpp +++ b/src/ccache/storage/remote/HttpStorage.cpp @@ -29,10 +29,9 @@ #include #include +#include #include -#include - #include namespace storage::remote { diff --git a/src/ccache/storage/remote/HttpStorage.hpp b/src/ccache/storage/remote/HttpStorage.hpp index fd3f4cfe1..f7213b09d 100644 --- a/src/ccache/storage/remote/HttpStorage.hpp +++ b/src/ccache/storage/remote/HttpStorage.hpp @@ -20,7 +20,7 @@ #include -#include +#include #include #include diff --git a/src/ccache/storage/remote/RedisStorage.hpp b/src/ccache/storage/remote/RedisStorage.hpp index be4ac2794..9c16bcfd2 100644 --- a/src/ccache/storage/remote/RedisStorage.hpp +++ b/src/ccache/storage/remote/RedisStorage.hpp @@ -20,7 +20,7 @@ #include -#include +#include #include #include diff --git a/src/ccache/storage/remote/RemoteStorage.hpp b/src/ccache/storage/remote/RemoteStorage.hpp index 341b47bdc..afa8f96b4 100644 --- a/src/ccache/storage/remote/RemoteStorage.hpp +++ b/src/ccache/storage/remote/RemoteStorage.hpp @@ -21,11 +21,10 @@ #include #include +#include #include #include -#include - #include #include #include diff --git a/src/third_party/CMakeLists.txt b/src/third_party/CMakeLists.txt index 2f28156b4..de420646e 100644 --- a/src/third_party/CMakeLists.txt +++ b/src/third_party/CMakeLists.txt @@ -1,4 +1,4 @@ -add_library(third_party STATIC url.cpp xxhash.c) +add_library(third_party STATIC xxhash.c) target_include_directories(third_party INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}) if(MSVC) @@ -55,6 +55,7 @@ if(MSVC) endif() add_subdirectory(blake3) +add_subdirectory(cxxurl) if(NOT TARGET dep_cpphttplib) add_subdirectory(cpp-httplib) diff --git a/src/third_party/cxxurl/CMakeLists.txt b/src/third_party/cxxurl/CMakeLists.txt new file mode 100644 index 000000000..b67dc4a74 --- /dev/null +++ b/src/third_party/cxxurl/CMakeLists.txt @@ -0,0 +1,9 @@ +add_library( + dep_cxxurl + STATIC EXCLUDE_FROM_ALL + "${CMAKE_CURRENT_SOURCE_DIR}/cxxurl/url.cpp" +) +target_include_directories( + dep_cxxurl + SYSTEM INTERFACE "$" +) diff --git a/src/third_party/url.cpp b/src/third_party/cxxurl/cxxurl/url.cpp similarity index 100% rename from src/third_party/url.cpp rename to src/third_party/cxxurl/cxxurl/url.cpp diff --git a/src/third_party/url.hpp b/src/third_party/cxxurl/cxxurl/url.hpp similarity index 100% rename from src/third_party/url.hpp rename to src/third_party/cxxurl/cxxurl/url.hpp -- 2.47.2