]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
build: Let blake3 be a separate target not depended on by third_party
authorJoel Rosdahl <joel@rosdahl.net>
Wed, 27 Mar 2024 19:02:50 +0000 (20:02 +0100)
committerJoel Rosdahl <joel@rosdahl.net>
Sat, 27 Apr 2024 08:14:29 +0000 (10:14 +0200)
.clang-format
src/ccache/CMakeLists.txt
src/ccache/Hash.hpp
src/ccache/hashutil.cpp
src/third_party/CMakeLists.txt
src/third_party/blake3/CMakeLists.txt

index d41fa25d81eaac7e8e49afd016d114ac0ea0303d..64d9450f80e34c828028ac5a81810f68effa21b4 100644 (file)
@@ -31,7 +31,7 @@ IncludeCategories:
   - Regex: '^<ccache/'
     Priority: 2
   # Dependency headers:
-  - Regex: '^<(cxxurl/url\.hpp|doctest/.*|fmt/.*|hiredis/.*|httplib\.h|nonstd/.*|tl/expected\.hpp|zstd\.h)>$'
+  - Regex: '^<(blake3\.h|cxxurl/url\.hpp|doctest/.*|fmt/.*|hiredis/.*|httplib\.h|nonstd/.*|tl/expected\.hpp|zstd\.h)>$'
     Priority: 3
   # System headers:
   - Regex: '\.h.*>$'
index 8169c98e20839b077a569696b5137d84bb2656dc..629a361733b03112ece5009ae7e5135ac136b9bd 100644 (file)
@@ -45,6 +45,7 @@ find_package(Threads REQUIRED)
 target_link_libraries(
   ccache_framework
   PUBLIC
+    dep_blake3
     dep_cxxurl
     dep_fmt
     dep_nonstdspan
index 4e97b042712f8f7f88d2f1625f400113e685dc8b..990b77bce4bb762838490632ce6b0e5bb892c432 100644 (file)
 
 #pragma once
 
+#include <blake3.h>
 #include <nonstd/span.hpp>
 #include <tl/expected.hpp>
 
-#include <blake3/blake3.h>
-
 #include <array>
 #include <cstdint>
 #include <cstdio>
index efe978cbaf9cd33c5ce6aa16083d7ed39312f910..c22f7b344f64a6611982a2ce05a145975759c14e 100644 (file)
@@ -36,7 +36,7 @@
 #  include "InodeCache.hpp"
 #endif
 
-#include <blake3/blake3_cpu_supports_avx2.h>
+#include <blake3_cpu_supports_avx2.h>
 
 #ifdef HAVE_UNISTD_H
 #  include <unistd.h>
index de420646e781f775e8c94fb8cebfe2519ff8b4e2..a3071d24e5022ccd81bce5828dcbb831a96c2578 100644 (file)
@@ -43,7 +43,6 @@ target_include_directories(
 )
 
 target_link_libraries(third_party PRIVATE standard_settings)
-target_link_libraries(third_party INTERFACE blake3)
 
 if(WIN32)
   target_link_libraries(third_party PRIVATE ws2_32)
index d2da244ff1a038166f650a4d5674eb1458450b0c..1d4ad94427dfd77068f1bde6e5d7f1187cf38dd5 100644 (file)
@@ -1,6 +1,7 @@
-add_library(blake3 STATIC blake3.c blake3_dispatch_ccache.c blake3_portable.c)
+add_library(dep_blake3 STATIC blake3.c blake3_dispatch_ccache.c blake3_portable.c)
 
-target_link_libraries(blake3 PRIVATE standard_settings)
+target_include_directories(dep_blake3 INTERFACE "${CMAKE_SOURCE_DIR}/src/third_party/blake3")
+target_link_libraries(dep_blake3 PRIVATE standard_settings)
 
 if(MSVC)
   # No object file is created if masm is passed the compile options from standard_settings,
@@ -74,7 +75,7 @@ function(add_source_if_enabled feature msvc_flags others_flags intrinsic)
   endif()
 
   if(${have_feature})
-    target_sources(blake3 PRIVATE blake3_${feature}${suffix})
+    target_sources(dep_blake3 PRIVATE blake3_${feature}${suffix})
     if(suffix STREQUAL ".c")
       if(MINGW AND feature STREQUAL "avx512")
         # Workaround for https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65782.
@@ -121,4 +122,4 @@ if(CMAKE_SIZEOF_VOID_P EQUAL 8)
 endif()
 
 file(GLOB headers *.h)
-target_sources(blake3 PRIVATE ${headers})
+target_sources(dep_blake3 PRIVATE ${headers})