forked from matth-x/MicroOcpp
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSConscript.py
More file actions
Latest commit
49 lines (37 loc) · 1.18 KB
/
Copy pathSConscript.py
File metadata and controls
49 lines (37 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# matth-x/MicroOcpp
# Copyright Matthias Akstaller 2019 - 2024
# MIT License
# NOTE: This SConscript is still WIP. It has thankfully been contributed from a project using SCons,
# not necessarily considering full reusability in other projects though.
# Use this file as a starting point for writing your own SCons integration. And as always, any
# contributions are highly welcome!
Import("env")
importos, pathlib
defgetAllDirs(root_dir):
dir_list= []
forroot, subfolders, filesinos.walk(root_dir.abspath):
dir_list.append(Dir(root))
returndir_list
SOURCE_DIR=Dir(".").srcnode().Dir("src")
source_dirs=getAllDirs(SOURCE_DIR)
source_files= []
forfolderinsource_dirs:
source_files+=folder.glob("*.c")
source_files+=folder.glob("*.cpp")
compiled_objects= []
forsource_fileinsource_files:
obj=env.Object(
target=pathlib.Path(source_file.path).stem
+".o",
source=source_file,
)
compiled_objects.append(obj)
libmicroocpp=env.StaticLibrary(
target='libmicroocpp',
source=sorted(compiled_objects)
)
exports= {
'library': libmicroocpp,
'CPPPATH': SOURCE_DIR
}
Return("exports")