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

Add a build using MSVC #2769

Merged
merged 1 commit into from
Feb 27, 2024
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
5 changes: 3 additions & 2 deletions native/windows/build.cake
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
DirectoryPath ROOT_PATH = MakeAbsolute(Directory("../.."));
DirectoryPath OUTPUT_PATH = MakeAbsolute(ROOT_PATH.Combine("output/native"));

DirectoryPath LLVM_HOME = Argument("llvm", EnvironmentVariable("LLVM_HOME") ?? "C:/Program Files/LLVM");
var llvmHomeArg = Argument("llvm", EnvironmentVariable("LLVM_HOME") ?? "C:/Program Files/LLVM");
DirectoryPath LLVM_HOME = string.IsNullOrEmpty(llvmHomeArg) || llvmHomeArg.ToLower() == "msvc" ? "" : llvmHomeArg;
string VC_TOOLSET_VERSION = Argument("vcToolsetVersion", "14.2");

string SUPPORT_VULKAN_VAR = Argument ("supportVulkan", EnvironmentVariable ("SUPPORT_VULKAN") ?? "true");
Expand All @@ -13,7 +14,7 @@ bool SUPPORT_VULKAN = SUPPORT_VULKAN_VAR == "1" || SUPPORT_VULKAN_VAR.ToLower ()
string VARIANT = BUILD_VARIANT ?? "windows";

Information("Native Arguments:");
Information($" {"LLVM_HOME".PadRight(30)} {{0}}", LLVM_HOME);
Information($" {"LLVM_HOME".PadRight(30)} {{0}}", string.IsNullOrEmpty(LLVM_HOME.FullPath) ? "(Using MSVC)" : LLVM_HOME);
Information($" {"SUPPORT_VULKAN".PadRight(30)} {{0}}", SUPPORT_VULKAN);
Information($" {"VARIANT".PadRight(30)} {{0}}", VARIANT);
Information($" {"CONFIGURATION".PadRight(30)} {{0}}", CONFIGURATION);
Expand Down
45 changes: 45 additions & 0 deletions scripts/azure-templates-stages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,39 @@ stages:
target: externals-windows
additionalArgs: --buildarch=arm64
artifactName: native
- template: azure-templates-bootstrapper.yml # Build Native Win32|x86 (Win + MSVC)
parameters:
name: native_win32_x86_msvc_windows
displayName: Win32 x86 [MSVC]
buildExternals: ${{ parameters.buildExternals }}
buildPipelineType: ${{ parameters.buildPipelineType }}
vmImage: ${{ parameters.VM_IMAGE_WINDOWS_NATIVE }}
target: externals-windows
additionalArgs: --buildarch=x86 --llvm="msvc"
artifactName: native_msvc
installLlvm: false
- template: azure-templates-bootstrapper.yml # Build Native Win32|x64 (Win + MSVC)
parameters:
name: native_win32_x64_msvc_windows
displayName: Win32 x64 [MSVC]
buildExternals: ${{ parameters.buildExternals }}
buildPipelineType: ${{ parameters.buildPipelineType }}
vmImage: ${{ parameters.VM_IMAGE_WINDOWS_NATIVE }}
target: externals-windows
additionalArgs: --buildarch=x64 --llvm="msvc"
artifactName: native_msvc
installLlvm: false
- template: azure-templates-bootstrapper.yml # Build Native Win32|arm64 (Win + MSVC)
parameters:
name: native_win32_arm64_msvc_windows
displayName: Win32 arm64 [MSVC]
buildExternals: ${{ parameters.buildExternals }}
buildPipelineType: ${{ parameters.buildPipelineType }}
vmImage: ${{ parameters.VM_IMAGE_WINDOWS_NATIVE }}
target: externals-windows
additionalArgs: --buildarch=arm64 --llvm="msvc"
artifactName: native_msvc
installLlvm: false
- template: azure-templates-bootstrapper.yml # Build Native WinUI|x86 (Win)
parameters:
name: native_winui_x86_windows
Expand Down Expand Up @@ -886,6 +919,7 @@ stages:
scanArtifacts:
- nuget
- nuget_symbols
- native_msvc
antiMalwareEnabled: true
binSkimEnabled: false
policheckExclusionFile: $(Build.SourcesDirectory)\scripts\guardian\PoliCheckExclusions.xml
Expand All @@ -900,7 +934,18 @@ stages:
apiScanSoftwareName: 'SkiaSharp'
apiScanSoftwareVersionNum: $(SKIASHARP_MAJOR_VERSION)
apiScanPreserveLogsFolder: true
apiScanSurrogateConfigurationFolder: $(Build.ArtifactStagingDirectory)\APIScanSurrogates
preScanSteps:
- pwsh: |
$softwareFolder = "$(Build.ArtifactStagingDirectory)\binaries-to-scan"
$surrogateFile = "$(Build.SourcesDirectory)\scripts\guardian\APIScanSurrogates.in.xml"
$destFolder = "$(Build.ArtifactStagingDirectory)\APIScanSurrogates"
$destFile = "$destFolder\APIScanSurrogates.xml"
New-Item -ItemType Directory -Force -Path $destFolder | Out-Null
$surrogateContents = (Get-Content $surrogateFile)
$surrogateContents = $surrogateContents.Replace("{SOFTWARE_FOLDER}", $softwareFolder)
$surrogateContents | Set-Content $destFile
displayName: Generate the surrogate files
- pwsh: |
$nupkgs = (Get-ChildItem "$(Build.ArtifactStagingDirectory)\binaries-to-scan\*\*.*nupkg")
foreach ($nupkg in $nupkgs) {
Expand Down
63 changes: 63 additions & 0 deletions scripts/guardian/APIScanSurrogates.in.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<?xml version="1.0" encoding="utf-8"?>
<APIScanSurrogates>
<Mappings>
<!-- Win32 Clang to MSVC -->
<Mapping>
<SurrogateSet>
<BinarySet>
<SymbolLocations>
<SymbolLocation>{SOFTWARE_FOLDER}</SymbolLocation>
<SymbolLocation>SRV*https://symweb</SymbolLocation>
</SymbolLocations>
<Binary path="{SOFTWARE_FOLDER}\native_msvc\native\windows\x86\libskiasharp.dll" />
</BinarySet>
</SurrogateSet>
<Targets>
<Binary path=".*\\nuget_symbols-extracted\\skiasharp\.nativeassets\.win32.*\\runtimes\\win-x86\\native\\libskiasharp\.dll" pathType="Regex" />
</Targets>
</Mapping>
<Mapping>
<SurrogateSet>
<BinarySet>
<SymbolLocations>
<SymbolLocation>{SOFTWARE_FOLDER}</SymbolLocation>
<SymbolLocation>SRV*https://symweb</SymbolLocation>
</SymbolLocations>
<Binary path="{SOFTWARE_FOLDER}\native_msvc\native\windows\x64\libskiasharp.dll" />
</BinarySet>
</SurrogateSet>
<Targets>
<Binary path=".*\\nuget_symbols-extracted\\skiasharp\.nativeassets\.win32.*\\runtimes\\win-x64\\native\\libskiasharp\.dll" pathType="Regex" />
</Targets>
</Mapping>
<!-- NanoServer Clang to MSVC -->
<Mapping>
<SurrogateSet>
<BinarySet>
<SymbolLocations>
<SymbolLocation>{SOFTWARE_FOLDER}</SymbolLocation>
<SymbolLocation>SRV*https://symweb</SymbolLocation>
</SymbolLocations>
<Binary path="{SOFTWARE_FOLDER}\native_msvc\native\windows\x86\libskiasharp.dll" />
</BinarySet>
</SurrogateSet>
<Targets>
<Binary path=".*\\nuget_symbols-extracted\\skiasharp\.nativeassets\.nanoserver.*\\runtimes\\win-x86\\native\\libskiasharp\.dll" pathType="Regex" />
</Targets>
</Mapping>
<Mapping>
<SurrogateSet>
<BinarySet>
<SymbolLocations>
<SymbolLocation>{SOFTWARE_FOLDER}</SymbolLocation>
<SymbolLocation>SRV*https://symweb</SymbolLocation>
</SymbolLocations>
<Binary path="{SOFTWARE_FOLDER}\native_msvc\native\windows\x64\libskiasharp.dll" />
</BinarySet>
</SurrogateSet>
<Targets>
<Binary path=".*\\nuget_symbols-extracted\\skiasharp\.nativeassets\.nanoserver.*\\runtimes\\win-x64\\native\\libskiasharp\.dll" pathType="Regex" />
</Targets>
</Mapping>
</Mappings>
</APIScanSurrogates>
Loading