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

Update Cake files to override deployment targets #2482

Merged
merged 3 commits into from
Jun 8, 2023
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
2 changes: 1 addition & 1 deletion .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
]
},
"dotnet-reportgenerator-globaltool": {
"version": "5.0.4",
"version": "5.1.19",
"commands": [
"reportgenerator"
]
Expand Down
7 changes: 6 additions & 1 deletion cake/xcode.cake
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#addin nuget:?package=Cake.XCode&version=5.0.0

void RunXCodeBuild(FilePath project, string scheme, string sdk, string arch, string platform = null)
void RunXCodeBuild(FilePath project, string scheme, string sdk, string arch, string platform = null, Dictionary<string, string> properties = null)
{
var dir = project.GetDirectory();

Expand All @@ -21,6 +21,11 @@ void RunXCodeBuild(FilePath project, string scheme, string sdk, string arch, str
if (platform != null) {
settings.BuildSettings["PLATFORM"] = platform;
}
if (properties != null) {
foreach (var prop in properties) {
settings.BuildSettings[prop.Key] = prop.Value;
}
}

XCodeBuild(settings);
}
Expand Down
41 changes: 29 additions & 12 deletions native/ios/build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,36 @@ DirectoryPath OUTPUT_PATH = MakeAbsolute(ROOT_PATH.Combine("output/native"));
#load "../../cake/native-shared.cake"
#load "../../cake/xcode.cake"

string VARIANT = BUILD_VARIANT ?? "ios";
string VARIANT = (BUILD_VARIANT ?? "ios").ToLower();
string DEPLOYMENT_SDK = VARIANT == "maccatalyst" ? "[sdk=macosx*]" : "";

DirectoryPath OUTPUT_VARIANT_PATH = OUTPUT_PATH.Combine(VARIANT);

string GetDeploymentTarget(string arch)
{
switch (VARIANT) {
case "maccatalyst": return "13.0";
default: return "8.0";
}
}

Task("libSkiaSharp")
.IsDependentOn("git-sync-deps")
.WithCriteria(IsRunningOnMacOs())
.Does(() =>
{
if (VARIANT.ToLower() == "ios") {
if (VARIANT == "ios") {
Build("iphonesimulator", "i386", "x86");
Build("iphonesimulator", "x86_64", "x64");
Build("iphoneos", "armv7", "arm");
Build("iphoneos", "arm64", "arm64");

CreateFatFramework(OUTPUT_PATH.Combine("ios/libSkiaSharp"));
} else if (VARIANT.ToLower() == "maccatalyst") {
CreateFatFramework(OUTPUT_VARIANT_PATH.Combine("libSkiaSharp"));
} else if (VARIANT == "maccatalyst") {
Build("macosx", "x86_64", "x64");
Build("macosx", "arm64", "arm64");

CreateFatVersionedFramework(OUTPUT_PATH.Combine("maccatalyst/libSkiaSharp"));
CreateFatVersionedFramework(OUTPUT_VARIANT_PATH.Combine("libSkiaSharp"));
}

void Build(string sdk, string arch, string skiaArch)
Expand All @@ -32,6 +43,7 @@ Task("libSkiaSharp")
GnNinja($"{VARIANT}/{arch}", "skia modules/skottie",
$"target_cpu='{skiaArch}' " +
$"target_os='{VARIANT}' " +
$"min_{VARIANT}_version='{GetDeploymentTarget(arch)}' " +
$"skia_use_icu=false " +
$"skia_use_metal={(sdk == "macosx" ? "false" : "true")} " +
$"skia_use_piex=true " +
Expand All @@ -42,9 +54,12 @@ Task("libSkiaSharp")
$"skia_use_system_libwebp=false " +
$"skia_use_system_zlib=false " +
$"skia_enable_skottie=true " +
$"extra_cflags=[ '-DSKIA_C_DLL', '-DHAVE_ARC4RANDOM_BUF' ] ");
$"extra_cflags=[ '-DSKIA_C_DLL', '-DHAVE_ARC4RANDOM_BUF' ] " +
ADDITIONAL_GN_ARGS);

RunXCodeBuild("libSkiaSharp/libSkiaSharp.xcodeproj", "libSkiaSharp", sdk, arch, platform: VARIANT);
RunXCodeBuild("libSkiaSharp/libSkiaSharp.xcodeproj", "libSkiaSharp", sdk, arch, platform: VARIANT, properties: new Dictionary<string, string> {
{ $"IPHONEOS_DEPLOYMENT_TARGET{DEPLOYMENT_SDK}", GetDeploymentTarget(arch) },
});

SafeCopy(
$"libSkiaSharp/bin/{CONFIGURATION}/{sdk}/{arch}.xcarchive",
Expand All @@ -56,25 +71,27 @@ Task("libHarfBuzzSharp")
.WithCriteria(IsRunningOnMacOs())
.Does(() =>
{
if (VARIANT.ToLower() == "ios") {
if (VARIANT == "ios") {
Build("iphonesimulator", "i386");
Build("iphonesimulator", "x86_64");
Build("iphoneos", "armv7");
Build("iphoneos", "arm64");

CreateFatFramework(OUTPUT_PATH.Combine("ios/libHarfBuzzSharp"));
} else if (VARIANT.ToLower() == "maccatalyst") {
CreateFatFramework(OUTPUT_VARIANT_PATH.Combine("libHarfBuzzSharp"));
} else if (VARIANT == "maccatalyst") {
Build("macosx", "x86_64");
Build("macosx", "arm64");

CreateFatVersionedFramework(OUTPUT_PATH.Combine("maccatalyst/libHarfBuzzSharp"));
CreateFatVersionedFramework(OUTPUT_VARIANT_PATH.Combine("libHarfBuzzSharp"));
}

void Build(string sdk, string arch)
{
if (Skip(arch)) return;

RunXCodeBuild("libHarfBuzzSharp/libHarfBuzzSharp.xcodeproj", "libHarfBuzzSharp", sdk, arch, platform: VARIANT);
RunXCodeBuild("libHarfBuzzSharp/libHarfBuzzSharp.xcodeproj", "libHarfBuzzSharp", sdk, arch, platform: VARIANT, properties: new Dictionary<string, string> {
{ $"IPHONEOS_DEPLOYMENT_TARGET{DEPLOYMENT_SDK}", GetDeploymentTarget(arch) },
});

SafeCopy(
$"libHarfBuzzSharp/bin/{CONFIGURATION}/{sdk}/{arch}.xcarchive",
Expand Down
22 changes: 15 additions & 7 deletions native/macos/build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ DirectoryPath OUTPUT_PATH = MakeAbsolute(ROOT_PATH.Combine("output/native/osx"))
#load "../../cake/native-shared.cake"
#load "../../cake/xcode.cake"

string GetDeploymentTarget(string arch)
{
switch (arch.ToLower()) {
case "arm64": return "11.0";
default: return "10.8";
}
}

Task("libSkiaSharp")
.IsDependentOn("git-sync-deps")
.WithCriteria(IsRunningOnMacOs())
Expand All @@ -18,14 +26,10 @@ Task("libSkiaSharp")
{
if (Skip(arch)) return;

var minVersion = skiaArch.ToLower() == "arm64"
? "11.0"
: "10.8";

GnNinja($"macos/{arch}", "skia modules/skottie",
$"target_os='mac' " +
$"target_cpu='{skiaArch}' " +
$"min_macos_version='{minVersion}' " +
$"min_macos_version='{GetDeploymentTarget(arch)}' " +
$"skia_use_icu=false " +
$"skia_use_metal=true " +
$"skia_use_piex=true " +
Expand All @@ -39,7 +43,9 @@ Task("libSkiaSharp")
$"extra_cflags=[ '-DSKIA_C_DLL', '-DHAVE_ARC4RANDOM_BUF', '-stdlib=libc++' ] " +
$"extra_ldflags=[ '-stdlib=libc++' ]");

RunXCodeBuild("libSkiaSharp/libSkiaSharp.xcodeproj", "libSkiaSharp", "macosx", arch);
RunXCodeBuild("libSkiaSharp/libSkiaSharp.xcodeproj", "libSkiaSharp", "macosx", arch, properties: new Dictionary<string, string> {
{ "MACOSX_DEPLOYMENT_TARGET", GetDeploymentTarget(arch) },
});

SafeCopy(
$"libSkiaSharp/bin/{CONFIGURATION}/macosx/{arch}.xcarchive",
Expand All @@ -60,7 +66,9 @@ Task("libHarfBuzzSharp")
{
if (Skip(arch)) return;

RunXCodeBuild("libHarfBuzzSharp/libHarfBuzzSharp.xcodeproj", "libHarfBuzzSharp", "macosx", arch);
RunXCodeBuild("libHarfBuzzSharp/libHarfBuzzSharp.xcodeproj", "libHarfBuzzSharp", "macosx", arch, properties: new Dictionary<string, string> {
{ "MACOSX_DEPLOYMENT_TARGET", GetDeploymentTarget(arch) },
});

SafeCopy(
$"libHarfBuzzSharp/bin/{CONFIGURATION}/macosx/{arch}.xcarchive",
Expand Down
14 changes: 12 additions & 2 deletions native/tvos/build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ DirectoryPath OUTPUT_PATH = MakeAbsolute(ROOT_PATH.Combine("output/native/tvos")
#load "../../cake/native-shared.cake"
#load "../../cake/xcode.cake"

string GetDeploymentTarget(string arch)
{
return "9.0";
}

Task("libSkiaSharp")
.IsDependentOn("git-sync-deps")
.WithCriteria(IsRunningOnMacOs())
Expand All @@ -21,6 +26,7 @@ Task("libSkiaSharp")
GnNinja($"tvos/{arch}", "skia modules/skottie",
$"target_os='tvos' " +
$"target_cpu='{skiaArch}' " +
$"min_ios_version='{GetDeploymentTarget(arch)}' " +
$"skia_use_icu=false " +
$"skia_use_metal=false " +
$"skia_use_piex=true " +
Expand All @@ -33,7 +39,9 @@ Task("libSkiaSharp")
$"skia_enable_skottie=true " +
$"extra_cflags=[ '-DSKIA_C_DLL', '-DHAVE_ARC4RANDOM_BUF' ] ");

RunXCodeBuild("libSkiaSharp/libSkiaSharp.xcodeproj", "libSkiaSharp", sdk, arch);
RunXCodeBuild("libSkiaSharp/libSkiaSharp.xcodeproj", "libSkiaSharp", sdk, arch, properties: new Dictionary<string, string> {
{ "TVOS_DEPLOYMENT_TARGET", GetDeploymentTarget(arch) },
});

SafeCopy(
$"libSkiaSharp/bin/{CONFIGURATION}/{sdk}/{arch}.xcarchive",
Expand All @@ -54,7 +62,9 @@ Task("libHarfBuzzSharp")
{
if (Skip(arch)) return;

RunXCodeBuild("libHarfBuzzSharp/libHarfBuzzSharp.xcodeproj", "libHarfBuzzSharp", sdk, arch);
RunXCodeBuild("libHarfBuzzSharp/libHarfBuzzSharp.xcodeproj", "libHarfBuzzSharp", sdk, arch, properties: new Dictionary<string, string> {
{ "TVOS_DEPLOYMENT_TARGET", GetDeploymentTarget(arch) },
});

SafeCopy(
$"libHarfBuzzSharp/bin/{CONFIGURATION}/{sdk}/{arch}.xcarchive",
Expand Down
14 changes: 12 additions & 2 deletions native/watchos/build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ DirectoryPath OUTPUT_PATH = MakeAbsolute(ROOT_PATH.Combine("output/native/watcho
#load "../../cake/native-shared.cake"
#load "../../cake/xcode.cake"

string GetDeploymentTarget(string arch)
{
return "2.0";
}

Task("libSkiaSharp")
.IsDependentOn("git-sync-deps")
.WithCriteria(IsRunningOnMacOs())
Expand All @@ -22,6 +27,7 @@ Task("libSkiaSharp")
GnNinja($"watchos/{arch}", "skia modules/skottie",
$"target_os='watchos' " +
$"target_cpu='{skiaArch}' " +
$"min_watchos_version='{GetDeploymentTarget(arch)}' " +
$"skia_enable_gpu=false " +
$"skia_use_icu=false " +
$"skia_use_metal=false " +
Expand All @@ -35,7 +41,9 @@ Task("libSkiaSharp")
$"skia_enable_skottie=true " +
$"extra_cflags=[ '-DSKIA_C_DLL', '-DHAVE_ARC4RANDOM_BUF' ] ");

RunXCodeBuild("libSkiaSharp/libSkiaSharp.xcodeproj", "libSkiaSharp", sdk, arch);
RunXCodeBuild("libSkiaSharp/libSkiaSharp.xcodeproj", "libSkiaSharp", sdk, arch, properties: new Dictionary<string, string> {
{ "WATCHOS_DEPLOYMENT_TARGET", GetDeploymentTarget(arch) },
});

SafeCopy(
$"libSkiaSharp/bin/{CONFIGURATION}/{sdk}/{arch}.xcarchive",
Expand All @@ -57,7 +65,9 @@ Task("libHarfBuzzSharp")
{
if (Skip(arch)) return;

RunXCodeBuild("libHarfBuzzSharp/libHarfBuzzSharp.xcodeproj", "libHarfBuzzSharp", sdk, arch);
RunXCodeBuild("libHarfBuzzSharp/libHarfBuzzSharp.xcodeproj", "libHarfBuzzSharp", sdk, arch, properties: new Dictionary<string, string> {
{ "WATCHOS_DEPLOYMENT_TARGET", GetDeploymentTarget(arch) },
});

SafeCopy(
$"libHarfBuzzSharp/bin/{CONFIGURATION}/{sdk}/{arch}.xcarchive",
Expand Down
2 changes: 1 addition & 1 deletion scripts/azure-pipelines-variables.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ variables:
BUILD_COUNTER: $[counter('global_counter', 1)]
TIZEN_LINUX_PACKAGES: libxcb-icccm4 libxcb-render-util0 gettext libxcb-image0 libsdl1.2debian libv4l-0 libxcb-randr0 bridge-utils libxcb-shape0 libpython2.7 openvpn
MANAGED_LINUX_PACKAGES: ttf-ancient-fonts ninja-build
MONO_VERSION_MACOS: '6_12_13'
MONO_VERSION_MACOS: '6_12_24'
MONO_VERSION_LINUX: 'stable-focal/snapshots/6.12.0.182'
XCODE_VERSION: 13.2.1
VISUAL_STUDIO_VERSION: ''
Expand Down
4 changes: 3 additions & 1 deletion scripts/install-vs.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ Write-Host "Installing Visual Studio..."
$exitCode = & "$temp\dd_vs_community.exe" --quiet --norestart --wait `
--includeRecommended `
--add Microsoft.VisualStudio.Workload.NetCrossPlat `
--add Microsoft.VisualStudio.Workload.NetCoreTools `
--add Microsoft.VisualStudio.Workload.ManagedDesktop `
--add Microsoft.VisualStudio.Workload.Universal `
| Out-Null
Expand All @@ -55,5 +54,8 @@ New-Item -ItemType Directory -Force -Path "$vsLogs" | Out-Null
Get-ChildItem "$temp\dd_*" |
Where-Object { $_.CreationTime -gt $startTime } |
Copy-Item -Destination "$vsLogs"
Get-ChildItem "$env:TEMP\dd_*" |
Where-Object { $_.CreationTime -gt $startTime } |
Copy-Item -Destination "$vsLogs"

exit $LASTEXITCODE