Skip to content

Commit bab268c

Browse files
committed
fix: fix linking order issue on emscripten
it linked both .js and .html at the same time, so the wasm was corrupt at the end also add a test for correct wasm files
1 parent 42fdf76 commit bab268c

File tree

2 files changed

+25
-5
lines changed

2 files changed

+25
-5
lines changed

platforms/build-web.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,8 @@ if [ "$COMPILE_TYPE" == "complete_rebuild" ] || [ ! -e "$BUILD_DIR" ]; then
135135
"--wipe" \
136136
--cross-file "$CROSS_FILE" \
137137
"-Dbuildtype=$BUILDTYPE" \
138-
-Ddefault_library=static
138+
-Ddefault_library=static \
139+
-Dtests=false
139140

140141
fi
141142

src/executables/meson.build

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,17 +46,20 @@ if build_application
4646
endif
4747

4848
if not fs.exists(APP_ROMFS)
49-
error('APP_ROMFS should exist, but doesn\'t: \'' + APP_ROMFS + '\'')
49+
error(
50+
'APP_ROMFS should exist, but doesn\'t: \''
51+
+ APP_ROMFS
52+
+ '\'',
53+
)
5054
endif
5155

52-
emscripten_link_args += ['--preload-file', APP_ROMFS+'@/assets/']
56+
emscripten_link_args += ['--preload-file', APP_ROMFS + '@/assets/']
5357

5458
endif
5559

56-
5760
emscripten_name = 'oopetris'
5861
emscripten_deps = [liboopetris_graphics_dep, graphic_application_deps]
59-
62+
6063
emscripten_options = {
6164
'warning_level': '3',
6265
'werror': true,
@@ -80,6 +83,7 @@ if build_application
8083
override_options: emscripten_options,
8184
install: true,
8285
name_suffix: 'html',
86+
link_depends: [oopetris_js],
8387
)
8488

8589
python3 = find_program('python3', required: false)
@@ -100,6 +104,21 @@ if build_application
100104

101105
endif
102106

107+
wasm_validate_exe = find_program('wasm-validate', required: false)
108+
109+
if wasm_validate_exe.found()
110+
111+
wasm_file = meson.project_build_root() / 'src' / 'executables' / 'oopetris.wasm'
112+
113+
test(
114+
'validate wasm file',
115+
wasm_validate_exe,
116+
args: ['--enable-threads', wasm_file],
117+
depends: [oopetris_js, oopetris_html],
118+
119+
)
120+
endif
121+
103122
else
104123
error('Unhandled cross built system: ' + host_machine.system())
105124
endif

0 commit comments

Comments
 (0)