@@ -471,14 +471,9 @@ def get_files(self):
471
471
def generate_ninja (self , build_dir , libname ):
472
472
ensure_sysroot ()
473
473
utils .safe_ensure_dirs (build_dir )
474
+ self .batch_inputs = True
474
475
475
476
cflags = self .get_cflags ()
476
- if self .deterministic_paths :
477
- source_dir = utils .path_from_root ()
478
- relative_source_dir = os .path .relpath (source_dir , build_dir )
479
- cflags += [f'-ffile-prefix-map={ source_dir } ={ DETERMINISITIC_PREFIX } ' ,
480
- f'-ffile-prefix-map={ relative_source_dir } ={ DETERMINISITIC_PREFIX } ' ,
481
- f'-fdebug-compilation-dir={ DETERMINISITIC_PREFIX } ' ]
482
477
asflags = get_base_cflags (preprocess = False )
483
478
input_files = self .get_files ()
484
479
ninja_file = os .path .join (build_dir , 'build.ninja' )
@@ -491,18 +486,11 @@ def build_objects(self, build_dir):
491
486
By default, this builds all the source files returned by `self.get_files()`,
492
487
with the `cflags` returned by `self.get_cflags()`.
493
488
"""
494
- batch_inputs = int (os .environ .get ('EMCC_BATCH_BUILD' , '1' ))
489
+ self . batch_inputs = int (os .environ .get ('EMCC_BATCH_BUILD' , '1' ))
495
490
batches = {}
496
491
commands = []
497
492
objects = set ()
498
493
cflags = self .get_cflags ()
499
- if self .deterministic_paths :
500
- source_dir = utils .path_from_root ()
501
- if batch_inputs :
502
- relative_source_dir = os .path .relpath (source_dir , build_dir )
503
- cflags += [f'-ffile-prefix-map={ relative_source_dir } ={ DETERMINISITIC_PREFIX } ' ]
504
- cflags += [f'-ffile-prefix-map={ source_dir } ={ DETERMINISITIC_PREFIX } ' ,
505
- f'-fdebug-compilation-dir={ DETERMINISITIC_PREFIX } ' ]
506
494
case_insensitive = is_case_insensitive (build_dir )
507
495
for src in self .get_files ():
508
496
ext = shared .suffix (src )
@@ -537,7 +525,7 @@ def build_objects(self, build_dir):
537
525
object_uuid += 1
538
526
o = os .path .join (build_dir , f'{ object_basename } __{ object_uuid } .o' )
539
527
commands .append (cmd + [src , '-o' , o ])
540
- elif batch_inputs :
528
+ elif self . batch_inputs :
541
529
# Use relative paths to reduce the length of the command line.
542
530
# This allows to avoid switching to a response file as often.
543
531
src = os .path .relpath (src , build_dir )
@@ -547,7 +535,7 @@ def build_objects(self, build_dir):
547
535
commands .append (cmd + [src , '-o' , o ])
548
536
objects .add (o )
549
537
550
- if batch_inputs :
538
+ if self . batch_inputs :
551
539
# Choose a chunk size that is large enough to avoid too many subprocesses
552
540
# but not too large to avoid task starvation.
553
541
# For now the heuristic is to split inputs by 2x number of cores.
@@ -611,6 +599,13 @@ def get_cflags(self):
611
599
if self .includes :
612
600
cflags += ['-I' + utils .path_from_root (i ) for i in self ._inherit_list ('includes' )]
613
601
602
+ if self .deterministic_paths :
603
+ source_dir = utils .path_from_root ()
604
+ if self .batch_inputs :
605
+ relative_source_dir = os .path .relpath (source_dir , build_dir )
606
+ cflags += [f'-ffile-prefix-map={ relative_source_dir } ={ DETERMINISITIC_PREFIX } ' ]
607
+ cflags += [f'-ffile-prefix-map={ source_dir } ={ DETERMINISITIC_PREFIX } ' ,
608
+ f'-fdebug-compilation-dir={ DETERMINISITIC_PREFIX } ' ]
614
609
return cflags
615
610
616
611
def get_base_name_prefix (self ):
0 commit comments