@@ -23,8 +23,14 @@ Task("libSkiaSharp")
23
23
. WithCriteria ( IsRunningOnLinux ( ) )
24
24
. Does ( ( ) =>
25
25
{
26
- bool hasSimdEnabled = EMSCRIPTEN_FEATURES . Contains ( "simd" ) ;
26
+ bool hasSimdEnabled = EMSCRIPTEN_FEATURES . Contains ( "simd" ) || EMSCRIPTEN_FEATURES . Contains ( "_simd" ) ;
27
27
bool hasThreadingEnabled = EMSCRIPTEN_FEATURES . Contains ( "mt" ) ;
28
+ bool hasWasmEH = EMSCRIPTEN_FEATURES . Contains ( "_wasmeh" ) ;
29
+
30
+ var emscriptenFeaturesModifiers =
31
+ EMSCRIPTEN_FEATURES
32
+ . Where ( f => ! f . StartsWith ( "_" ) )
33
+ . ToArray ( ) ;
28
34
29
35
GnNinja ( $ "wasm", "SkiaSharp" ,
30
36
$ "target_os='linux' " +
@@ -63,9 +69,10 @@ Task("libSkiaSharp")
63
69
$ " '-s', 'WARN_UNALIGNED=1' " + // '-s', 'USE_WEBGL2=1' (experimental)
64
70
$ " { ( hasSimdEnabled ? ", '-msimd128'" : "" ) } " +
65
71
$ " { ( hasThreadingEnabled ? ", '-pthread'" : "" ) } " +
72
+ $ " { ( hasWasmEH ? ", '-fwasm-exceptions'" : "" ) } " +
66
73
$ "] " +
67
74
// SIMD support is based on https://github.com/google/skia/blob/1f193df9b393d50da39570dab77a0bb5d28ec8ef/modules/canvaskit/compile.sh#L57
68
- $ "extra_cflags_cc=[ '-frtti' { ( hasSimdEnabled ? ", '-msimd128'" : "" ) } { ( hasThreadingEnabled ? ", '-pthread'" : "" ) } ] " +
75
+ $ "extra_cflags_cc=[ '-frtti' { ( hasSimdEnabled ? ", '-msimd128'" : "" ) } { ( hasThreadingEnabled ? ", '-pthread'" : "" ) } { ( hasWasmEH ? ", '-fwasm-exceptions'" : "" ) } ] " +
69
76
COMPILERS +
70
77
ADDITIONAL_GN_ARGS ) ;
71
78
@@ -99,8 +106,8 @@ Task("libSkiaSharp")
99
106
var outDir = OUTPUT_PATH . Combine ( $ "wasm") ;
100
107
if ( ! string . IsNullOrEmpty ( EMSCRIPTEN_VERSION ) )
101
108
outDir = outDir . Combine ( "libSkiaSharp.a" ) . Combine ( EMSCRIPTEN_VERSION ) ;
102
- if ( EMSCRIPTEN_FEATURES . Length != 0 )
103
- outDir = outDir . Combine ( string . Join ( "," , EMSCRIPTEN_FEATURES ) ) ;
109
+ if ( emscriptenFeaturesModifiers . Length != 0 )
110
+ outDir = outDir . Combine ( string . Join ( "," , emscriptenFeaturesModifiers ) ) ;
104
111
EnsureDirectoryExists ( outDir ) ;
105
112
CopyFileToDirectory ( a , outDir ) ;
106
113
} ) ;
@@ -109,24 +116,30 @@ Task("libHarfBuzzSharp")
109
116
. WithCriteria ( IsRunningOnLinux ( ) )
110
117
. Does ( ( ) =>
111
118
{
112
- bool hasSimdEnabled = EMSCRIPTEN_FEATURES . Contains ( "simd" ) ;
119
+ bool hasSimdEnabled = EMSCRIPTEN_FEATURES . Contains ( "simd" ) || EMSCRIPTEN_FEATURES . Contains ( "_simd" ) ; ;
113
120
bool hasThreadingEnabled = EMSCRIPTEN_FEATURES . Contains ( "mt" ) ;
121
+ bool hasWasmEH = EMSCRIPTEN_FEATURES . Contains ( "_wasmeh" ) ;
122
+
123
+ var emscriptenFeaturesModifiers =
124
+ EMSCRIPTEN_FEATURES
125
+ . Where ( f => ! f . StartsWith ( "_" ) )
126
+ . ToArray ( ) ;
114
127
115
128
GnNinja ( $ "wasm", "HarfBuzzSharp" ,
116
129
$ "target_os='linux' " +
117
130
$ "target_cpu='wasm' " +
118
131
$ "is_static_skiasharp=true " +
119
132
$ "visibility_hidden=false " +
120
- $ "extra_cflags=[ { ( hasSimdEnabled ? "'-msimd128', " : "" ) } { ( hasThreadingEnabled ? "'-pthread'" : "" ) } ] " +
121
- $ "extra_cflags_cc=[ '-frtti' { ( hasSimdEnabled ? ", '-msimd128'" : "" ) } { ( hasThreadingEnabled ? ", '-pthread'" : "" ) } ] " +
133
+ $ "extra_cflags=[ '-s', 'WARN_UNALIGNED=1' { ( hasSimdEnabled ? ", '-msimd128'" : "" ) } { ( hasThreadingEnabled ? ", '-pthread'" : "" ) } { ( hasWasmEH ? ", '-fwasm-exceptions '" : "" ) } ] " +
134
+ $ "extra_cflags_cc=[ '-frtti' { ( hasSimdEnabled ? ", '-msimd128'" : "" ) } { ( hasThreadingEnabled ? ", '-pthread'" : "" ) } { ( hasWasmEH ? ", '-fwasm-exceptions'" : "" ) } ] " +
122
135
COMPILERS +
123
136
ADDITIONAL_GN_ARGS ) ;
124
137
125
138
var outDir = OUTPUT_PATH . Combine ( $ "wasm") ;
126
139
if ( ! string . IsNullOrEmpty ( EMSCRIPTEN_VERSION ) )
127
140
outDir = outDir . Combine ( "libHarfBuzzSharp.a" ) . Combine ( EMSCRIPTEN_VERSION ) ;
128
- if ( EMSCRIPTEN_FEATURES . Length != 0 )
129
- outDir = outDir . Combine ( string . Join ( "," , EMSCRIPTEN_FEATURES ) ) ;
141
+ if ( emscriptenFeaturesModifiers . Length != 0 )
142
+ outDir = outDir . Combine ( string . Join ( "," , emscriptenFeaturesModifiers ) ) ;
130
143
EnsureDirectoryExists ( outDir ) ;
131
144
var so = SKIA_PATH . CombineWithFilePath ( $ "out/wasm/libHarfBuzzSharp.a") ;
132
145
CopyFileToDirectory ( so , outDir ) ;
0 commit comments