Skip to content

Commit

Permalink
chore: Adjust build flags for pthread, fix harfbuzz generation
Browse files Browse the repository at this point in the history
  • Loading branch information
jeromelaban committed Oct 12, 2022
1 parent d8a8948 commit f17f50a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion native/wasm/build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Task("libSkiaSharp")
.Does(() =>
{
bool hasSimdEnabled = EMSCRIPTEN_FEATURES.Contains("simd");
bool hasThreadingEnabled = EMSCRIPTEN_FEATURES.Contains("mt");

GnNinja($"wasm", "SkiaSharp",
$"target_os='linux' " +
Expand Down Expand Up @@ -62,7 +63,7 @@ Task("libSkiaSharp")
$" '-s', 'WARN_UNALIGNED=1' " + // '-s', 'USE_WEBGL2=1' (experimental)
$"] " +
// SIMD support is based on https://github.com/google/skia/blob/1f193df9b393d50da39570dab77a0bb5d28ec8ef/modules/canvaskit/compile.sh#L57
$"extra_cflags_cc=[ '-frtti' { (hasSimdEnabled ? ", '-msimd128'" : "") } ] " +
$"extra_cflags_cc=[ '-frtti' { (hasSimdEnabled ? ", '-msimd128'" : "") { (hasThreadingEnabled ? ", '-pthread'" : "") } } ] " +
COMPILERS +
ADDITIONAL_GN_ARGS);

Expand Down Expand Up @@ -111,12 +112,15 @@ Task("libHarfBuzzSharp")
$"target_cpu='wasm' " +
$"is_static_skiasharp=true " +
$"visibility_hidden=false " +
$"extra_cflags_cc=[ '-frtti' { (hasSimdEnabled ? ", '-msimd128'" : "") { (hasThreadingEnabled ? ", '-pthread'" : "") } } ] " +
COMPILERS +
ADDITIONAL_GN_ARGS);

var outDir = OUTPUT_PATH.Combine($"wasm");
if (!string.IsNullOrEmpty(EMSCRIPTEN_VERSION))
outDir = outDir.Combine("libHarfBuzzSharp.a").Combine(EMSCRIPTEN_VERSION);
if (EMSCRIPTEN_FEATURES.Length != 0)
outDir = outDir.Combine(string.Join(",", EMSCRIPTEN_FEATURES));
EnsureDirectoryExists(outDir);
var so = SKIA_PATH.CombineWithFilePath($"out/wasm/libHarfBuzzSharp.a");
CopyFileToDirectory(so, outDir);
Expand Down

0 comments on commit f17f50a

Please sign in to comment.