Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the use of vcpkg #2257

Merged
merged 6 commits into from
Sep 28, 2022
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 native/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
xcuserdata/
project.xcworkspace/
uwp/ANGLE/triplets
44 changes: 23 additions & 21 deletions native/uwp/build.cake
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
bool SKIP_ANGLE = Argument ("skipAngle", false);
bool SKIP_ANGLE = Argument("skipAngle", false);
string VC_TOOLSET_VERSION = Argument("vcToolsetVersion", "14.2");

DirectoryPath ROOT_PATH = MakeAbsolute(Directory("../.."));
DirectoryPath VCPKG_PATH = MakeAbsolute(ROOT_PATH.Combine("externals/vcpkg"));
DirectoryPath VCPKG_PATH = EnvironmentVariable("VCPKG_ROOT") ?? MakeAbsolute(ROOT_PATH.Combine("externals/vcpkg"));
DirectoryPath OUTPUT_PATH = MakeAbsolute(ROOT_PATH.Combine("output/native/uwp"));

#load "../../cake/native-shared.cake"
Expand Down Expand Up @@ -102,12 +102,12 @@ Task("ANGLE")
if (SKIP_ANGLE)
return;

if (!DirectoryExists (VCPKG_PATH))
RunProcess ("git", $"clone --depth 1 https://github.com/microsoft/vcpkg.git --branch master --single-branch {VCPKG_PATH}");
if (!DirectoryExists(VCPKG_PATH))
RunProcess("git", $"clone --depth 1 https://github.com/microsoft/vcpkg.git --branch master --single-branch {VCPKG_PATH}");

var vcpkg = VCPKG_PATH.CombineWithFilePath ("vcpkg.exe");
if (!FileExists (vcpkg))
RunProcess (VCPKG_PATH.CombineWithFilePath ("bootstrap-vcpkg.bat"));
var vcpkg = VCPKG_PATH.CombineWithFilePath("vcpkg.exe");
if (!FileExists(vcpkg))
RunProcess(VCPKG_PATH.CombineWithFilePath("bootstrap-vcpkg.bat"));

var platform_toolset = string.IsNullOrEmpty(VC_TOOLSET_VERSION) ? "" : $"v{VC_TOOLSET_VERSION.Replace(".", "")}";
var toolset_suffix = string.IsNullOrEmpty(VC_TOOLSET_VERSION) ? "" : $"-{platform_toolset}";
Expand All @@ -122,16 +122,18 @@ Task("ANGLE")
if (Skip(arch)) return;

var triplet = $"{arch}-uwp{toolset_suffix}";
var tripletsRoot = MakeAbsolute((DirectoryPath)"ANGLE/triplets");

// make the versioned triplets
if (!string.IsNullOrEmpty(VC_TOOLSET_VERSION)) {
var cmake = VCPKG_PATH.CombineWithFilePath ($"triplets/community/{triplet}.cmake");
if (!FileExists (cmake)) {
var src = VCPKG_PATH.CombineWithFilePath ($"triplets/{arch}-uwp.cmake");
if (!FileExists (src))
src = VCPKG_PATH.CombineWithFilePath ($"triplets/community/{arch}-uwp.cmake");
CopyFile (src, cmake);
System.IO.File.AppendAllLines (cmake.FullPath, new [] {
var cmake = tripletsRoot.CombineWithFilePath($"{triplet}.cmake");
if (!FileExists(cmake)) {
EnsureDirectoryExists(tripletsRoot);
var src = VCPKG_PATH.CombineWithFilePath($"triplets/{arch}-uwp.cmake");
if (!FileExists(src))
src = VCPKG_PATH.CombineWithFilePath($"triplets/community/{arch}-uwp.cmake");
CopyFile(src, cmake);
System.IO.File.AppendAllLines(cmake.FullPath, new [] {
$"set(VCPKG_PLATFORM_TOOLSET \"{platform_toolset}\")",
$"set(VCPKG_DEP_INFO_OVERRIDE_VARS \"{platform_toolset}\")",
});
Expand All @@ -141,16 +143,16 @@ Task("ANGLE")
var d = CONFIGURATION.ToLower() == "release" ? "" : "debug/";
var zd = CONFIGURATION.ToLower() == "release" ? "" : "d";

RunProcess (vcpkg, $"install angle:{triplet}");
RunProcess(vcpkg, $"install angle:{triplet} --overlay-triplets=\"{tripletsRoot}\"");

var outDir = OUTPUT_PATH.Combine(arch);
EnsureDirectoryExists(outDir);
CopyFileToDirectory(VCPKG_PATH.CombineWithFilePath ($"installed/{triplet}/{d}bin/libEGL.dll"), outDir);
CopyFileToDirectory(VCPKG_PATH.CombineWithFilePath ($"installed/{triplet}/{d}bin/libEGL.pdb"), outDir);
CopyFileToDirectory(VCPKG_PATH.CombineWithFilePath ($"installed/{triplet}/{d}bin/libGLESv2.dll"), outDir);
CopyFileToDirectory(VCPKG_PATH.CombineWithFilePath ($"installed/{triplet}/{d}bin/libGLESv2.pdb"), outDir);
CopyFileToDirectory(VCPKG_PATH.CombineWithFilePath ($"installed/{triplet}/{d}bin/zlib{zd}1.dll"), outDir);
CopyFileToDirectory(VCPKG_PATH.CombineWithFilePath ($"installed/{triplet}/{d}bin/zlib{zd}.pdb"), outDir);
CopyFileToDirectory(VCPKG_PATH.CombineWithFilePath($"installed/{triplet}/{d}bin/libEGL.dll"), outDir);
CopyFileToDirectory(VCPKG_PATH.CombineWithFilePath($"installed/{triplet}/{d}bin/libEGL.pdb"), outDir);
CopyFileToDirectory(VCPKG_PATH.CombineWithFilePath($"installed/{triplet}/{d}bin/libGLESv2.dll"), outDir);
CopyFileToDirectory(VCPKG_PATH.CombineWithFilePath($"installed/{triplet}/{d}bin/libGLESv2.pdb"), outDir);
CopyFileToDirectory(VCPKG_PATH.CombineWithFilePath($"installed/{triplet}/{d}bin/zlib{zd}1.dll"), outDir);
CopyFileToDirectory(VCPKG_PATH.CombineWithFilePath($"installed/{triplet}/{d}bin/zlib{zd}.pdb"), outDir);
}
});

Expand Down