Skip to content

Fix for --embind-emit-tsd + -sMODULARIZE #20051

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions emcc.py
Original file line number Diff line number Diff line change
Expand Up @@ -1850,7 +1850,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