Skip to content

Commit

Permalink
embind: Ignore single file option for TS generation. (emscripten-core…
Browse files Browse the repository at this point in the history
…#20632)

Another setting we can ignore during TS generation to avoid errors.
  • Loading branch information
brendandahl authored Nov 7, 2023
1 parent 5315ba7 commit cece8cd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion emcc.py
Original file line number Diff line number Diff line change
Expand Up @@ -3297,12 +3297,13 @@ def phase_embind_emit_tsd(options, in_wasm, wasm_target, memfile, js_syms):
# import names.
settings.MINIFY_WASM_IMPORTED_MODULES = False
setup_environment_settings()
# Use a separate Wasm file so the JS does not need to be modified after emscripten.run.
settings.SINGLE_FILE = False
# Embind may be included multiple times, de-duplicate the list first.
settings.JS_LIBRARIES = dedup_list(settings.JS_LIBRARIES)
# Replace embind with the TypeScript generation version.
embind_index = settings.JS_LIBRARIES.index('embind/embind.js')
settings.JS_LIBRARIES[embind_index] = 'embind/embind_ts.js'

outfile_js = in_temp('tsgen_a.out.js')
# The Wasm outfile may be modified by emscripten.run, so use a temporary file.
outfile_wasm = in_temp('tsgen_a.out.wasm')
Expand Down
1 change: 1 addition & 0 deletions test/test_other.py
Original file line number Diff line number Diff line change
Expand Up @@ -3011,6 +3011,7 @@ def test_embind_tsgen_ignore(self):
'-sUSE_PTHREADS',
'-sPROXY_TO_PTHREAD',
'-sPTHREAD_POOL_SIZE=1',
'-sSINGLE_FILE',
'-lembind', # Test duplicated link option.
]
self.run_process([EMCC, test_file('other/embind_tsgen.cpp'),
Expand Down

0 comments on commit cece8cd

Please sign in to comment.