diff --git a/include/vcpkg/base/contractual-constants.h b/include/vcpkg/base/contractual-constants.h index 15c712f7fc..abbe26abfc 100644 --- a/include/vcpkg/base/contractual-constants.h +++ b/include/vcpkg/base/contractual-constants.h @@ -448,6 +448,7 @@ namespace vcpkg inline constexpr StringLiteral CMakeVariableXBoxConsoleTarget = "VCPKG_XBOX_CONSOLE_TARGET"; inline constexpr StringLiteral CMakeVariableZChainloadToolchainFile = "Z_VCPKG_CHAINLOAD_TOOLCHAIN_FILE"; inline constexpr StringLiteral CMakeVariableZVcpkgGameDKLatest = "Z_VCPKG_GameDKLatest"; + inline constexpr StringLiteral CMakeVariableZVcpkgGameDKXboxLatest = "Z_VCPKG_GameDKXboxLatest"; inline constexpr StringLiteral CMakeVariableZPostPortfileIncludes = "Z_VCPKG_POST_PORTFILE_INCLUDES"; // Policies are PascalCase diff --git a/include/vcpkg/commands.build.h b/include/vcpkg/commands.build.h index 13df235c78..528137e4ab 100644 --- a/include/vcpkg/commands.build.h +++ b/include/vcpkg/commands.build.h @@ -170,6 +170,7 @@ namespace vcpkg std::vector hash_additional_files; std::vector post_portfile_includes; Optional gamedk_latest_path; + Optional gamedk_xbox_latest_path; Path toolchain_file() const; bool using_vcvars() const; diff --git a/src/vcpkg/base/system.process.cpp b/src/vcpkg/base/system.process.cpp index 98c9e4e455..a248372ef3 100644 --- a/src/vcpkg/base/system.process.cpp +++ b/src/vcpkg/base/system.process.cpp @@ -635,6 +635,8 @@ namespace vcpkg "GameDKLatest", "GRDKLatest", "GXDKLatest", + "GameDKCoreLatest", + "GameDKXboxLatest", }; std::vector env_prefix_string = { diff --git a/src/vcpkg/cmakevars.cpp b/src/vcpkg/cmakevars.cpp index 51360c7a33..22c1d02cf0 100644 --- a/src/vcpkg/cmakevars.cpp +++ b/src/vcpkg/cmakevars.cpp @@ -174,6 +174,7 @@ VCPKG_HASH_ADDITIONAL_FILES=${VCPKG_HASH_ADDITIONAL_FILES} VCPKG_POST_PORTFILE_INCLUDES=${VCPKG_POST_PORTFILE_INCLUDES} VCPKG_XBOX_CONSOLE_TARGET=${VCPKG_XBOX_CONSOLE_TARGET} Z_VCPKG_GameDKLatest=$ENV{GameDKLatest} +Z_VCPKG_GameDKXboxLatest=$ENV{GameDKXboxLatest} e1e74b5c-18cb-4474-a6bd-5c1c8bc81f3f 8c504940-be29-4cba-9f8f-6cd83e9d87b7") endfunction() diff --git a/src/vcpkg/commands.build.cpp b/src/vcpkg/commands.build.cpp index 25fa62e104..c6ce81fcfd 100644 --- a/src/vcpkg/commands.build.cpp +++ b/src/vcpkg/commands.build.cpp @@ -1279,24 +1279,42 @@ namespace vcpkg return result; } + static Optional get_grdk_header_path(const PreBuildInfo& pre_build_info) + { + // Handles new layouts for October 2025 or later. + if (auto game_dk_xbox_latest = pre_build_info.gamedk_xbox_latest_path.get()) + { + return *game_dk_xbox_latest / "xbox/include/gxdk.h"; + } + + // Handles old layouts for April 2025 or earlier for backwards compatibility. + if (auto game_dk_latest = pre_build_info.gamedk_latest_path.get()) + { + return *game_dk_latest / "GRDK/gameKit/Include/grdk.h"; + } + + return nullopt; + } + static std::string grdk_hash(const Filesystem& fs, Cache>& grdk_cache, const PreBuildInfo& pre_build_info) { - if (auto game_dk_latest = pre_build_info.gamedk_latest_path.get()) + auto maybe_gxdk_header_path = get_grdk_header_path(pre_build_info); + if (auto gxdk_header_path = maybe_gxdk_header_path.get()) { - const auto grdk_header_path = *game_dk_latest / "GRDK/gameKit/Include/grdk.h"; - const auto& maybe_header_hash = grdk_cache.get_lazy(grdk_header_path, [&]() -> Optional { - auto maybe_hash = Hash::get_file_hash(fs, grdk_header_path, Hash::Algorithm::Sha256); - if (auto hash = maybe_hash.get()) - { - return std::move(*hash); - } - else - { - return nullopt; - } - }); + const auto& maybe_header_hash = + grdk_cache.get_lazy(*gxdk_header_path, [&fs, gxdk_header_path]() -> Optional { + auto maybe_hash = Hash::get_file_hash(fs, *gxdk_header_path, Hash::Algorithm::Sha256); + if (auto hash = maybe_hash.get()) + { + return std::move(*hash); + } + else + { + return nullopt; + } + }); if (auto header_hash = maybe_header_hash.get()) { @@ -2231,6 +2249,7 @@ namespace vcpkg } Util::assign_if_set_and_nonempty(gamedk_latest_path, cmakevars, CMakeVariableZVcpkgGameDKLatest); + Util::assign_if_set_and_nonempty(gamedk_xbox_latest_path, cmakevars, CMakeVariableZVcpkgGameDKXboxLatest); } ExtendedBuildResult::ExtendedBuildResult(BuildResult code) : code(code) { }