Skip to content

Commit 434f7e3

Browse files
committed
meson: Propagate optimization flag for linking on Emscripten
Emscripten uses the optimization flag at link time to enable optimizations via Binaryen [1]. While meson.build currently recognizes the -Doptimization option, it does not propagate it to the linking. This commit updates meson.build to propagate the optimization flag to the linking when targeting WebAssembly. [1] https://emscripten.org/docs/optimizing/Optimizing-Code.html#how-emscripten-optimizes Signed-off-by: Kohei Tokunaga <[email protected]>
1 parent a5cecaa commit 434f7e3

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

meson.build

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -869,6 +869,10 @@ elif host_os == 'openbsd'
869869
# Disable OpenBSD W^X if available
870870
emulator_link_args = cc.get_supported_link_arguments('-Wl,-z,wxneeded')
871871
endif
872+
elif host_os == 'emscripten'
873+
if get_option('optimization') != 'plain'
874+
emulator_link_args += ['-O' + get_option('optimization')]
875+
endif
872876
endif
873877

874878
###############################################

0 commit comments

Comments
 (0)