@@ -64,6 +64,8 @@ class Resources:
64
64
def __init__ (self , base_path = None ):
65
65
self .base_path = base_path
66
66
67
+ self .file_basepath = {}
68
+
67
69
self .inc_dirs = []
68
70
self .headers = []
69
71
@@ -105,6 +107,9 @@ def __radd__(self, resources):
105
107
return self .add (resources )
106
108
107
109
def add (self , resources ):
110
+ for f ,p in resources .file_basepath .items ():
111
+ self .file_basepath [f ] = p
112
+
108
113
self .inc_dirs += resources .inc_dirs
109
114
self .headers += resources .headers
110
115
@@ -404,9 +409,14 @@ def is_ignored(self, file_path):
404
409
return True
405
410
return False
406
411
407
- def scan_resources (self , path , exclude_paths = None ):
412
+ def scan_resources (self , path , exclude_paths = None , base_path = None ):
408
413
labels = self .get_labels ()
414
+
409
415
resources = Resources (path )
416
+ if not base_path :
417
+ base_path = path
418
+ resources .base_path = base_path
419
+
410
420
self .has_config = False
411
421
412
422
""" os.walk(top[, topdown=True[, onerror=None[, followlinks=False]]])
@@ -445,7 +455,7 @@ def scan_resources(self, path, exclude_paths=None):
445
455
dirs .remove (d )
446
456
447
457
if (d .startswith ('FEATURE_' )):
448
- resources .features [d [8 :]] = self .scan_resources (dir_path )
458
+ resources .features [d [8 :]] = self .scan_resources (dir_path , base_path = base_path )
449
459
dirs .remove (d )
450
460
451
461
# Remove dirs that already match the ignorepatterns
@@ -467,6 +477,8 @@ def scan_resources(self, path, exclude_paths=None):
467
477
for file in files :
468
478
file_path = join (root , file )
469
479
480
+ resources .file_basepath [file_path ] = base_path
481
+
470
482
if self .is_ignored (file_path ):
471
483
continue
472
484
@@ -597,15 +609,13 @@ def compile_sources(self, resources, build_path, inc_dirs=None):
597
609
queue = []
598
610
prev_dir = None
599
611
600
- # The dependency checking for C/C++ is delegated to the compiler
601
- base_path = resources .base_path
602
612
# Sort compile queue for consistency
603
613
files_to_compile .sort ()
604
614
work_dir = getcwd ()
605
615
606
616
for source in files_to_compile :
607
617
_ , name , _ = split_path (source )
608
- object = self .relative_object_path (build_path , base_path , source )
618
+ object = self .relative_object_path (build_path , resources . file_basepath [ source ] , source )
609
619
610
620
# Queue mode (multiprocessing)
611
621
commands = self .compile_command (source , object , inc_paths )
0 commit comments