@@ -46,24 +46,39 @@ def __scan_and_copy(self, src_path, trg_path):
46
46
self .toolchain .copy_files (r , trg_path , rel_path = src_path )
47
47
return resources
48
48
49
+ @staticmethod
50
+ def _get_dir_grouped_files (files ):
51
+ """ Get grouped files based on the dirname """
52
+ files_grouped = {}
53
+ for file in files :
54
+ rel_path = os .path .relpath (file , os .getcwd ())
55
+ dir_path = os .path .dirname (rel_path )
56
+ if dir_path == '' :
57
+ # all files within the current dir go into Source_Files
58
+ dir_path = 'Source_Files'
59
+ if not dir_path in files_grouped .keys ():
60
+ files_grouped [dir_path ] = []
61
+ files_grouped [dir_path ].append (file )
62
+ return files_grouped
63
+
49
64
def progen_get_project_data (self ):
50
65
""" Get ProGen project data """
51
66
# provide default data, some tools don't require any additional
52
67
# tool specific settings
53
- sources = []
68
+ code_files = []
54
69
for r_type in ['c_sources' , 'cpp_sources' , 's_sources' ]:
55
70
for file in getattr (self .resources , r_type ):
56
- sources .append (file )
71
+ code_files .append (file )
72
+
73
+ sources_files = code_files + self .resources .hex_files + self .resources .objects + \
74
+ self .resources .libraries
75
+ sources_grouped = Exporter ._get_dir_grouped_files (sources_files )
76
+ headers_grouped = Exporter ._get_dir_grouped_files (self .resources .headers )
57
77
58
78
project_data = {
59
79
'common' : {
60
- 'sources' : {
61
- 'Source Files' : sources + self .resources .hex_files +
62
- self .resources .objects + self .resources .libraries ,
63
- },
64
- 'includes' : {
65
- 'Include Files' : self .resources .headers ,
66
- },
80
+ 'sources' : sources_grouped ,
81
+ 'includes' : headers_grouped ,
67
82
'build_dir' :'.build' ,
68
83
'target' : [TARGET_MAP [self .target ].progen ['target' ]],
69
84
'macros' : self .get_symbols (),
0 commit comments