Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions include/vcpkg/base/contractual-constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions include/vcpkg/commands.build.h
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ namespace vcpkg
std::vector<Path> hash_additional_files;
std::vector<Path> post_portfile_includes;
Optional<Path> gamedk_latest_path;
Optional<Path> gamedk_xbox_latest_path;

Path toolchain_file() const;
bool using_vcvars() const;
Expand Down
2 changes: 2 additions & 0 deletions src/vcpkg/base/system.process.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -635,6 +635,8 @@ namespace vcpkg
"GameDKLatest",
"GRDKLatest",
"GXDKLatest",
"GameDKCoreLatest",
"GameDKXboxLatest",
};

std::vector<std::string> env_prefix_string = {
Expand Down
1 change: 1 addition & 0 deletions src/vcpkg/cmakevars.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
45 changes: 32 additions & 13 deletions src/vcpkg/commands.build.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1279,24 +1279,42 @@ namespace vcpkg
return result;
}

static Optional<Path> 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<Path, Optional<std::string>>& 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<std::string> {
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<std::string> {
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())
{
Expand Down Expand Up @@ -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) { }
Expand Down
Loading