feat: Generate for Emscripten 3.1.12 and SIMD features

This commit is contained in:
Jerome Laban 2022-09-28 19:58:46 -04:00
Родитель 410028b479
Коммит 6715fa8fec
3 изменённых файлов: 36 добавлений и 9 удалений

Просмотреть файл

@ -5,6 +5,12 @@ DirectoryPath OUTPUT_PATH = MakeAbsolute(ROOT_PATH.Combine("output/native"));
string SUPPORT_GPU_VAR = Argument("supportGpu", EnvironmentVariable("SUPPORT_GPU") ?? "true").ToLower();
string EMSCRIPTEN_VERSION = Argument("emscriptenVersion", EnvironmentVariable("EMSCRIPTEN_VERSION") ?? "").ToLower();
string[] EMSCRIPTEN_FEATURES =
Argument("emscriptenFeatures", EnvironmentVariable("EMSCRIPTEN_FEATURES") ?? "")
.ToLower()
.Split(",")
.Where(f => f != "none")
.ToArray();
bool SUPPORT_GPU = SUPPORT_GPU_VAR == "1" || SUPPORT_GPU_VAR == "true";
string CC = Argument("cc", "emcc");
@ -17,6 +23,7 @@ Task("libSkiaSharp")
.WithCriteria(IsRunningOnLinux())
.Does(() =>
{
bool hasSimdEnabled = EMSCRIPTEN_FEATURES.Contains("simd");
GnNinja($"wasm", "SkiaSharp",
$"target_os='linux' " +
@ -51,10 +58,11 @@ Task("libSkiaSharp")
$"use_PIC=false " +
$"extra_cflags=[ " +
$" '-DSKIA_C_DLL', '-DXML_POOR_ENTROPY', " +
$" '-DSKNX_NO_SIMD', '-DSK_DISABLE_AAA', '-DGR_GL_CHECK_ALLOC_WITH_GET_ERROR=0', " +
$" {(!hasSimdEnabled ? "'-DSKNX_NO_SIMD', " : "")} '-DSK_DISABLE_AAA', '-DGR_GL_CHECK_ALLOC_WITH_GET_ERROR=0', " +
$" '-s', 'WARN_UNALIGNED=1' " + // '-s', 'USE_WEBGL2=1' (experimental)
$"] " +
$"extra_cflags_cc=[ '-frtti' ] " +
// SIMD support is based on https://github.com/google/skia/blob/1f193df9b393d50da39570dab77a0bb5d28ec8ef/modules/canvaskit/compile.sh#L57
$"extra_cflags_cc=[ '-frtti' { (hasSimdEnabled ? ", '-msimd128'" : "") } ] " +
COMPILERS +
ADDITIONAL_GN_ARGS);
@ -88,6 +96,8 @@ Task("libSkiaSharp")
var outDir = OUTPUT_PATH.Combine($"wasm");
if (!string.IsNullOrEmpty(EMSCRIPTEN_VERSION))
outDir = outDir.Combine("libSkiaSharp.a").Combine(EMSCRIPTEN_VERSION);
if (EMSCRIPTEN_FEATURES.Length != 0)
outDir = outDir.Combine(string.Join(",", EMSCRIPTEN_FEATURES));
EnsureDirectoryExists(outDir);
CopyFileToDirectory(a, outDir);
});

Просмотреть файл

@ -368,9 +368,26 @@ stages:
vmImage: ${{ parameters.VM_IMAGE_LINUX_NATIVE }}
artifactName: native
emscripten:
- 2.0.6
- 2.0.23
- 3.1.7
- 2.0.6:
displayName: 2.0.6
version: 2.0.6
features: none
- 2.0.23:
displayName: 2.0.23
version: 2.0.23
features: none
- 3.1.7:
displayName: 3.1.7
version: 3.1.7
features: none
- 3.1.12:
displayName: 3.1.12
version: 3.1.12
features: none
- 3.1.12:
displayName: '3.1.12_SIMD'
version: 3.1.12
features: simd
- ${{ if ne(parameters.buildPipelineType, 'tests') }}:
- stage: managed

Просмотреть файл

@ -9,15 +9,15 @@ jobs:
- ${{ each version in parameters.emscripten }}:
- template: azure-templates-bootstrapper.yml
parameters:
name: native_wasm_${{ replace(version, '.', '_') }}_linux
displayName: WASM (${{ version }})
name: native_wasm_${{ replace(version.displayName, '.', '_') }}_linux
displayName: WASM (${{ version.displayName }})
buildExternals: ${{ parameters.buildExternals }}
buildPipelineType: ${{ parameters.buildPipelineType }}
vmImage: ${{ parameters.vmImage }}
docker: scripts/Docker/wasm
target: externals-wasm
dockerArgs: --build-arg EMSCRIPTEN_VERSION=${{ version }}
additionalArgs: --emscriptenVersion=${{ version }}
dockerArgs: --build-arg EMSCRIPTEN_VERSION=${{ version.version }}
additionalArgs: --emscriptenVersion=${{ version.version }} --emscriptenFeatures="${{ version.features }}"
artifactName: ${{ parameters.artifactName }}
postBuildSteps:
- task: PublishBuildArtifacts@1