Skip to content

Commit 3a56ec7

Browse files
committed
Fix for --embind-emit-tsd + -sMODULARIZE
Fixes: #20012
1 parent 02e8ce3 commit 3a56ec7

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
@@ -1850,7 +1850,11 @@ def phase_linker_setup(options, state, newargs):
18501850
# With this option we don't actually output the program itself only the
18511851
# TS bindings.
18521852
options.output_file = in_temp('a.out.js')
1853+
# Don't invoke the program's `main` function.
18531854
settings.INVOKE_RUN = False
1855+
# Ignore -sMODULARIZE which could otherwise effect how we run the module
1856+
# to generate the bindings.
1857+
settings.MODULARIZE = False
18541858

18551859
# options.output_file is the user-specified one, target is what we will generate
18561860
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)