@@ -253,19 +253,24 @@ def inspect_headers(headers, cflags):
253253 # Compile the program.
254254 show ('Compiling generated code...' )
255255
256+ if any ('libcxxabi' in f for f in cflags ):
257+ compiler = shared .EMXX
258+ else :
259+ compiler = shared .EMCC
260+
256261 # -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' ]
269274
270275 # Default behavior for emcc is to warn for binaryen version check mismatches
271276 # so we should try to match that behavior.
@@ -375,7 +380,8 @@ def main(args):
375380
376381 default_json_files = [
377382 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' ),
379385 ]
380386 parser = argparse .ArgumentParser (description = 'Generate JSON infos for structs.' )
381387 parser .add_argument ('json' , nargs = '*' ,
@@ -410,6 +416,9 @@ def main(args):
410416
411417 internal_cflags = [
412418 '-I' + shared .path_from_root ('system' , 'lib' , 'libc' , 'musl' , 'src' , 'internal' ),
419+ ]
420+
421+ cxxflags = [
413422 '-I' + shared .path_from_root ('system' , 'lib' , 'libcxxabi' , 'src' ),
414423 '-D__USING_EMSCRIPTEN_EXCEPTIONS__' ,
415424 ]
@@ -423,6 +432,8 @@ def main(args):
423432 # Inspect all collected structs.
424433 if 'internal' in f :
425434 use_cflags = cflags + internal_cflags
435+ elif 'cxx' in f :
436+ use_cflags = cflags + cxxflags
426437 else :
427438 use_cflags = cflags
428439 info_fragment = inspect_code (header_files , use_cflags )
0 commit comments