Skip to content

Commit 7b3d638

Browse files
authored
Fix for --embind-emit-tsd + -sMODULARIZE (#20051)
Fixes: #20012
1 parent f2c8fe1 commit 7b3d638

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

emcc.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1853,7 +1853,11 @@ def phase_linker_setup(options, state, newargs):
18531853
# With this option we don't actually output the program itself only the
18541854
# TS bindings.
18551855
options.output_file = in_temp('a.out.js')
1856+
# Don't invoke the program's `main` function.
18561857
settings.INVOKE_RUN = False
1858+
# Ignore -sMODULARIZE which could otherwise effect how we run the module
1859+
# to generate the bindings.
1860+
settings.MODULARIZE = False
18571861

18581862
# options.output_file is the user-specified one, target is what we will generate
18591863
if options.output_file:

test/test_other.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2908,8 +2908,11 @@ def test_jspi_add_function(self):
29082908
self.do_runf(test_file('other/test_jspi_add_function.c'), 'done')
29092909

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

0 commit comments

Comments
 (0)