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

Use Clang for Windows (m79) #1006

Merged
merged 4 commits into from
Nov 11, 2019
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
4 changes: 3 additions & 1 deletion build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ DirectoryPath NUGET_PACKAGES = EnvironmentVariable ("NUGET_PACKAGES") ?? PROFILE
DirectoryPath ANDROID_SDK_ROOT = EnvironmentVariable ("ANDROID_SDK_ROOT") ?? EnvironmentVariable ("ANDROID_HOME") ?? PROFILE_PATH.Combine ("android-sdk");
DirectoryPath ANDROID_NDK_HOME = EnvironmentVariable ("ANDROID_NDK_HOME") ?? EnvironmentVariable ("ANDROID_NDK_ROOT") ?? PROFILE_PATH.Combine ("android-ndk");
DirectoryPath TIZEN_STUDIO_HOME = EnvironmentVariable ("TIZEN_STUDIO_HOME") ?? PROFILE_PATH.Combine ("tizen-studio");
DirectoryPath LLVM_HOME = EnvironmentVariable ("LLVM_HOME") ?? "C:/Program Files/LLVM";

DirectoryPath ROOT_PATH = MakeAbsolute(Directory("."));
DirectoryPath DEPOT_PATH = MakeAbsolute(ROOT_PATH.Combine("externals/depot_tools"));
Expand Down Expand Up @@ -572,6 +573,7 @@ Information ("SDK Paths:");
Information (" Android SDK: {0}", ANDROID_SDK_ROOT);
Information (" Android NDK: {0}", ANDROID_NDK_HOME);
Information (" Tizen Studio: {0}", TIZEN_STUDIO_HOME);
Information (" LLVM/Clang: {0}", LLVM_HOME);
Information ("");

Information ("Environment Variables (whitelisted):");
Expand All @@ -582,7 +584,7 @@ var envVarsWhitelist = new [] {
"node_label", "build_id", "git_sha", "git_branch_name",
"feature_name", "msbuild_exe", "python_exe", "preview_label",
"home", "userprofile", "nuget_packages", "build_arch",
"android_sdk_root", "android_ndk_root",
"android_sdk_root", "android_ndk_root", "llvm_home",
"android_home", "android_ndk_home", "tizen_studio_home"
};
var envVars = EnvironmentVariables ();
Expand Down
3 changes: 3 additions & 0 deletions cake/BuildExternals.cake
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,13 @@ Task ("externals-windows")
return;
}

var clang = string.IsNullOrEmpty(LLVM_HOME.FullPath) ? "" : $"clang_win='{LLVM_HOME}' ";

// generate native skia build files
GnNinja ($"win/{arch}", "SkiaSharp",
$"is_official_build=true skia_enable_tools=false " +
$"target_os='win' target_cpu='{skiaArch}' " +
clang +
COMMON_GN_ARGS +
$"skia_use_system_zlib=false skia_use_dng_sdk=true skia_enable_fontmgr_win_gdi=false " +
$"extra_cflags=[ '-DSKIA_C_DLL', '/MT', '/EHsc', '/Z7' ] " +
Expand Down
5 changes: 5 additions & 0 deletions scripts/azure-templates-bootstrapper.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ jobs:
- ${{ if contains(parameters.name, '_android_') }}:
- pwsh: .\scripts\install-android-ndk.ps1
displayName: Install the Android NDK
# install llvm
- ${{ if endsWith(parameters.name, '_windows') }}:
- pwsh: .\scripts\install-llvm.ps1
displayName: Install LLVM
# install extra bits for the manged builds
- ${{ if not(startsWith(parameters.name, 'native_')) }}:
- task: UseDotNet@2
Expand Down Expand Up @@ -106,6 +110,7 @@ jobs:
- pwsh: .\scripts\retry-command.ps1 -RetryCount ${{ parameters.retryCount }} { .\bootstrapper.ps1 -t ${{ parameters.target }} -v ${{ parameters.verbosity }} -c ${{ coalesce(parameters.configuration, 'Release') }} ${{ parameters.additionalArgs }} }
env:
JavaSdkDirectory: $(JAVA_HOME)
LLVM_HOME: $(LLVM_HOME)
displayName: Run the bootstrapper for ${{ parameters.target }}
- ${{ if not(endsWith(parameters.name, '_windows')) }}:
- bash: ./scripts/retry-command.sh ${{ parameters.retryCount }} ./bootstrapper.sh -t ${{ parameters.target }} -v ${{ parameters.verbosity }} -c ${{ coalesce(parameters.configuration, 'Release') }} ${{ parameters.additionalArgs }}
Expand Down
24 changes: 24 additions & 0 deletions scripts/install-llvm.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Param(
[string] $Version = "9.0.0"
)

$ErrorActionPreference = 'Stop'

$url = "http://releases.llvm.org/${Version}/LLVM-${Version}-win64.exe"

$llvmTemp = "$HOME/llvm-temp"
$install = "$llvmTemp/llvm.exe"

# download
Write-Host "Downloading LLVM..."
New-Item -ItemType Directory -Force -Path "$llvmTemp" | Out-Null
(New-Object System.Net.WebClient).DownloadFile("$url", "$install")

# install
Write-Host "Installing LLVM..."
& $install /S

# make sure that LLVM is in LLVM_HOME
Write-Host "##vso[task.setvariable variable=LLVM_HOME;]C:\Program Files\LLVM";

exit $LASTEXITCODE