@@ -253,19 +253,24 @@ def inspect_headers(headers, cflags):
253
253
# Compile the program.
254
254
show ('Compiling generated code...' )
255
255
256
+ if any ('libcxxabi' in f for f in cflags ):
257
+ compiler = shared .EMXX
258
+ else :
259
+ compiler = shared .EMCC
260
+
256
261
# -Oz optimizes enough to avoid warnings on code size/num locals
257
- cmd = [shared . EMXX ] + cflags + ['-o' , js_file [1 ], src_file [1 ],
258
- '-O0' ,
259
- '-Werror' ,
260
- '-Wno-format' ,
261
- '-nostdlib' ,
262
- compiler_rt ,
263
- '-s' , 'BOOTSTRAPPING_STRUCT_INFO=1' ,
264
- '-s' , 'LLD_REPORT_UNDEFINED=1' ,
265
- '-s' , 'STRICT' ,
266
- # Use SINGLE_FILE=1 so there is only a single
267
- # file to cleanup.
268
- '-s' , 'SINGLE_FILE' ]
262
+ cmd = [compiler ] + cflags + ['-o' , js_file [1 ], src_file [1 ],
263
+ '-O0' ,
264
+ '-Werror' ,
265
+ '-Wno-format' ,
266
+ '-nostdlib' ,
267
+ compiler_rt ,
268
+ '-s' , 'BOOTSTRAPPING_STRUCT_INFO=1' ,
269
+ '-s' , 'LLD_REPORT_UNDEFINED=1' ,
270
+ '-s' , 'STRICT' ,
271
+ # Use SINGLE_FILE=1 so there is only a single
272
+ # file to cleanup.
273
+ '-s' , 'SINGLE_FILE' ]
269
274
270
275
# Default behavior for emcc is to warn for binaryen version check mismatches
271
276
# so we should try to match that behavior.
@@ -375,7 +380,8 @@ def main(args):
375
380
376
381
default_json_files = [
377
382
shared .path_from_root ('src' , 'struct_info.json' ),
378
- shared .path_from_root ('src' , 'struct_info_internal.json' )
383
+ shared .path_from_root ('src' , 'struct_info_internal.json' ),
384
+ shared .path_from_root ('src' , 'struct_info_cxx.json' ),
379
385
]
380
386
parser = argparse .ArgumentParser (description = 'Generate JSON infos for structs.' )
381
387
parser .add_argument ('json' , nargs = '*' ,
@@ -410,6 +416,9 @@ def main(args):
410
416
411
417
internal_cflags = [
412
418
'-I' + shared .path_from_root ('system' , 'lib' , 'libc' , 'musl' , 'src' , 'internal' ),
419
+ ]
420
+
421
+ cxxflags = [
413
422
'-I' + shared .path_from_root ('system' , 'lib' , 'libcxxabi' , 'src' ),
414
423
'-D__USING_EMSCRIPTEN_EXCEPTIONS__' ,
415
424
]
@@ -423,6 +432,8 @@ def main(args):
423
432
# Inspect all collected structs.
424
433
if 'internal' in f :
425
434
use_cflags = cflags + internal_cflags
435
+ elif 'cxx' in f :
436
+ use_cflags = cflags + cxxflags
426
437
else :
427
438
use_cflags = cflags
428
439
info_fragment = inspect_code (header_files , use_cflags )
0 commit comments