Skip to content

Commit

Permalink
Fix for --embind-emit-tsd + -sMODULARIZE (emscripten-core#20051)
Browse files Browse the repository at this point in the history
  • Loading branch information
sbc100 authored Aug 24, 2023
1 parent f2c8fe1 commit 7b3d638
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 4 additions & 0 deletions emcc.py
Original file line number Diff line number Diff line change
Expand Up @@ -1853,7 +1853,11 @@ def phase_linker_setup(options, state, newargs):
# With this option we don't actually output the program itself only the
# TS bindings.
options.output_file = in_temp('a.out.js')
# Don't invoke the program's `main` function.
settings.INVOKE_RUN = False
# Ignore -sMODULARIZE which could otherwise effect how we run the module
# to generate the bindings.
settings.MODULARIZE = False

# options.output_file is the user-specified one, target is what we will generate
if options.output_file:
Expand Down
7 changes: 5 additions & 2 deletions test/test_other.py
Original file line number Diff line number Diff line change
Expand Up @@ -2908,8 +2908,11 @@ def test_jspi_add_function(self):
self.do_runf(test_file('other/test_jspi_add_function.c'), 'done')

def test_embind_tsgen(self):
self.run_process([EMCC, test_file('other/embind_tsgen.cpp'), '-o', 'out.html',
'-lembind', '--embind-emit-tsd', 'embind_tsgen.d.ts'])
# These extra arguments are not related to TS binding generation but we want to
# verify that they do not interfere with it.
extra_args = ['-o', 'out.html', '-sMODULARIZE']
self.run_process([EMCC, test_file('other/embind_tsgen.cpp'),
'-lembind', '--embind-emit-tsd', 'embind_tsgen.d.ts'] + extra_args)
actual = read_file('embind_tsgen.d.ts')
self.assertNotExists('out.html')
self.assertNotExists('out.js')
Expand Down

0 comments on commit 7b3d638

Please sign in to comment.