From ee06dc75cc19a053a8a016645e2e0498dcca4e8a Mon Sep 17 00:00:00 2001 From: autoantwort Date: Mon, 30 Dec 2024 04:04:22 +0100 Subject: [PATCH 1/3] Set compiler file hash cache variable --- include/vcpkg/base/contractual-constants.h | 1 + include/vcpkg/installedpaths.h | 1 + src/vcpkg/commands.build.cpp | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/include/vcpkg/base/contractual-constants.h b/include/vcpkg/base/contractual-constants.h index ac6bee38f2..4563d10843 100644 --- a/include/vcpkg/base/contractual-constants.h +++ b/include/vcpkg/base/contractual-constants.h @@ -370,6 +370,7 @@ namespace vcpkg inline constexpr StringLiteral CMakeVariableCMakeSystemName = "VCPKG_CMAKE_SYSTEM_NAME"; inline constexpr StringLiteral CMakeVariableCMakeSystemVersion = "VCPKG_CMAKE_SYSTEM_VERSION"; inline constexpr StringLiteral CMakeVariableCmd = "CMD"; + inline constexpr StringLiteral CMakeVariableCompilerCacheFile = "VCPKG_COMPILER_CACHE_FILE"; inline constexpr StringLiteral CMakeVariableConcurrency = "VCPKG_CONCURRENCY"; inline constexpr StringLiteral CMakeVariableCurrentBuildtreesDir = "CURRENT_BUILDTREES_DIR"; inline constexpr StringLiteral CMakeVariableCurrentPackagesDir = "CURRENT_PACKAGES_DIR"; diff --git a/include/vcpkg/installedpaths.h b/include/vcpkg/installedpaths.h index 08349eb24f..b1d04ed997 100644 --- a/include/vcpkg/installedpaths.h +++ b/include/vcpkg/installedpaths.h @@ -21,6 +21,7 @@ namespace vcpkg Path vcpkg_dir_status_file() const { return vcpkg_dir() / FileStatus; } Path vcpkg_dir_info() const { return vcpkg_dir() / FileInfo; } Path vcpkg_dir_updates() const { return vcpkg_dir() / FileUpdates; } + Path compiler_hash_cache_file() const { return vcpkg_dir() / "compiler_file_hash_cache.json"; } Path lockfile_path() const { return vcpkg_dir() / FileVcpkgLock; } Path triplet_dir(Triplet t) const { return m_root / t.canonical_name(); } Path share_dir(const PackageSpec& p) const { return triplet_dir(p.triplet()) / FileShare / p.name(); } diff --git a/src/vcpkg/commands.build.cpp b/src/vcpkg/commands.build.cpp index 16029b5612..91f204d616 100644 --- a/src/vcpkg/commands.build.cpp +++ b/src/vcpkg/commands.build.cpp @@ -693,7 +693,7 @@ namespace vcpkg paths.packages() / fmt::format("{}_{}", FileDetectCompiler, triplet.canonical_name())}, // The detect_compiler "port" doesn't depend on the host triplet, so always natively compile {CMakeVariableHostTriplet, triplet.canonical_name()}, - }; + {CMakeVariableCompilerCacheFile, paths.installed().compiler_hash_cache_file()}}; get_generic_cmake_build_args(paths, triplet, toolset, cmake_args); auto cmd = vcpkg::make_cmake_cmd(paths, paths.ports_cmake, std::move(cmake_args)); From 815a718d0c29938b01c3c741498fd3f1d791094e Mon Sep 17 00:00:00 2001 From: Billy Robert O'Neal III Date: Fri, 3 Jan 2025 11:48:27 -0800 Subject: [PATCH 2/3] Extract 'contractual constant' and use dashes. --- include/vcpkg/base/contractual-constants.h | 1 + include/vcpkg/installedpaths.h | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/include/vcpkg/base/contractual-constants.h b/include/vcpkg/base/contractual-constants.h index 4563d10843..f48713ff5f 100644 --- a/include/vcpkg/base/contractual-constants.h +++ b/include/vcpkg/base/contractual-constants.h @@ -332,6 +332,7 @@ namespace vcpkg inline constexpr StringLiteral FileBaselineDotJson = "baseline.json"; inline constexpr StringLiteral FileBin = "bin"; inline constexpr StringLiteral FileControl = "CONTROL"; + inline constexpr StringLiteral FileCompilerFileHashCacheDotJson = "compiler-file-hash-cache.json"; inline constexpr StringLiteral FileCopying = "COPYING"; inline constexpr StringLiteral FileCopyright = "copyright"; inline constexpr StringLiteral FileDebug = "debug"; diff --git a/include/vcpkg/installedpaths.h b/include/vcpkg/installedpaths.h index b1d04ed997..2dcb673362 100644 --- a/include/vcpkg/installedpaths.h +++ b/include/vcpkg/installedpaths.h @@ -21,7 +21,7 @@ namespace vcpkg Path vcpkg_dir_status_file() const { return vcpkg_dir() / FileStatus; } Path vcpkg_dir_info() const { return vcpkg_dir() / FileInfo; } Path vcpkg_dir_updates() const { return vcpkg_dir() / FileUpdates; } - Path compiler_hash_cache_file() const { return vcpkg_dir() / "compiler_file_hash_cache.json"; } + Path compiler_hash_cache_file() const { return vcpkg_dir() / FileCompilerFileHashCacheDotJson; } Path lockfile_path() const { return vcpkg_dir() / FileVcpkgLock; } Path triplet_dir(Triplet t) const { return m_root / t.canonical_name(); } Path share_dir(const PackageSpec& p) const { return triplet_dir(p.triplet()) / FileShare / p.name(); } From 87b86c3e8be88b3916a11aeec2c0b118bb3c0ae1 Mon Sep 17 00:00:00 2001 From: Billy Robert O'Neal III Date: Thu, 16 Jan 2025 00:28:23 -0800 Subject: [PATCH 3/3] Add trailing comma. --- src/vcpkg/commands.build.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/vcpkg/commands.build.cpp b/src/vcpkg/commands.build.cpp index 92cf8cc306..745c6d0e13 100644 --- a/src/vcpkg/commands.build.cpp +++ b/src/vcpkg/commands.build.cpp @@ -695,7 +695,9 @@ namespace vcpkg paths.packages() / fmt::format("{}_{}", FileDetectCompiler, triplet.canonical_name())}, // The detect_compiler "port" doesn't depend on the host triplet, so always natively compile {CMakeVariableHostTriplet, triplet.canonical_name()}, - {CMakeVariableCompilerCacheFile, paths.installed().compiler_hash_cache_file()}}; + {CMakeVariableCompilerCacheFile, paths.installed().compiler_hash_cache_file()}, + }; + get_generic_cmake_build_args(paths, triplet, toolset, cmake_args); auto cmd = vcpkg::make_cmake_cmd(paths, paths.ports_cmake, std::move(cmake_args));