From 410028b4793b54633e08fa3dcadb18a4d417b6a8 Mon Sep 17 00:00:00 2001 From: Jerome Laban Date: Tue, 20 Sep 2022 08:25:58 -0400 Subject: [PATCH 1/3] chore: Remove unused emscripten versions --- scripts/azure-templates-stages.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/scripts/azure-templates-stages.yml b/scripts/azure-templates-stages.yml index 02ec35c162b..551bbbf7fcf 100644 --- a/scripts/azure-templates-stages.yml +++ b/scripts/azure-templates-stages.yml @@ -368,11 +368,7 @@ stages: vmImage: ${{ parameters.VM_IMAGE_LINUX_NATIVE }} artifactName: native emscripten: - - 2.0.5 - 2.0.6 - - 2.0.9 - - 2.0.11 - - 2.0.12 - 2.0.23 - 3.1.7 From 6715fa8fece5788495c90be61f74b63bc36f255f Mon Sep 17 00:00:00 2001 From: Jerome Laban Date: Wed, 28 Sep 2022 19:58:46 -0400 Subject: [PATCH 2/3] feat: Generate for Emscripten 3.1.12 and SIMD features --- native/wasm/build.cake | 14 ++++++++++++-- scripts/azure-templates-stages.yml | 23 ++++++++++++++++++++--- scripts/azure-templates-wasm-matrix.yml | 8 ++++---- 3 files changed, 36 insertions(+), 9 deletions(-) diff --git a/native/wasm/build.cake b/native/wasm/build.cake index dd3ad005497..2c54effcc51 100644 --- a/native/wasm/build.cake +++ b/native/wasm/build.cake @@ -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); }); diff --git a/scripts/azure-templates-stages.yml b/scripts/azure-templates-stages.yml index 551bbbf7fcf..4e8c5741345 100644 --- a/scripts/azure-templates-stages.yml +++ b/scripts/azure-templates-stages.yml @@ -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 diff --git a/scripts/azure-templates-wasm-matrix.yml b/scripts/azure-templates-wasm-matrix.yml index 5386a2bb1dc..52730c71e47 100644 --- a/scripts/azure-templates-wasm-matrix.yml +++ b/scripts/azure-templates-wasm-matrix.yml @@ -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 From b2ae1a5f3a35043063e47c1bca1b841c4cb5a6fd Mon Sep 17 00:00:00 2001 From: Jerome Laban Date: Thu, 29 Sep 2022 07:45:45 -0400 Subject: [PATCH 3/3] chore: Adjust for 3.1.12 folder strurcture to use `st` (single-threaded) --- scripts/azure-templates-stages.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/azure-templates-stages.yml b/scripts/azure-templates-stages.yml index 4e8c5741345..20397551747 100644 --- a/scripts/azure-templates-stages.yml +++ b/scripts/azure-templates-stages.yml @@ -383,7 +383,7 @@ stages: - 3.1.12: displayName: 3.1.12 version: 3.1.12 - features: none + features: st - 3.1.12: displayName: '3.1.12_SIMD' version: 3.1.12