forked from Flipper-XFW/Xtreme-Firmware
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SConscript
95 lines (75 loc) · 2.87 KB
/
SConscript
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
Import("env")
assetsenv = env.Clone(
tools=["fbt_assets"],
FW_LIB_NAME="assets",
ASSETS_WORK_DIR=env.Dir("compiled"),
ASSETS_SRC_DIR=env.Dir("#/assets"),
)
assetsenv.ApplyLibFlags()
# Keep firmware flash icons in build dir for api symbols for asset packs
icons_path = (
assetsenv.Dir("#/build/icons")
if assetsenv["IS_BASE_FIRMWARE"]
else assetsenv["ASSETS_WORK_DIR"]
)
icons = assetsenv.CompileIcons(icons_path, assetsenv["ASSETS_SRC_DIR"].Dir("icons"))
assetsenv.Alias("icons", icons)
# Protobuf .proto -> .c + .h
proto_src = assetsenv.Glob("protobuf/*.proto", source=True)
proto_options = assetsenv.Glob("protobuf/*.options", source=True)
proto = assetsenv.ProtoBuilder(assetsenv["ASSETS_WORK_DIR"], proto_src)
assetsenv.Depends(proto, proto_options)
# Precious(proto)
assetsenv.Alias("proto", proto)
# Internal animations
dolphin_internal = assetsenv.DolphinSymBuilder(
assetsenv["ASSETS_WORK_DIR"],
assetsenv["ASSETS_SRC_DIR"].Dir("dolphin"),
DOLPHIN_RES_TYPE="internal",
)
assetsenv.Alias("dolphin_internal", dolphin_internal)
# Blocking animations
dolphin_blocking = assetsenv.DolphinSymBuilder(
assetsenv["ASSETS_WORK_DIR"],
assetsenv["ASSETS_SRC_DIR"].Dir("dolphin"),
DOLPHIN_RES_TYPE="blocking",
)
assetsenv.Alias("dolphin_blocking", dolphin_blocking)
# Protobuf version meta
proto_ver = assetsenv.ProtoVerBuilder(
"${ASSETS_WORK_DIR}/protobuf_version.h",
assetsenv["ASSETS_SRC_DIR"].File("protobuf/Changelog"),
)
assetsenv.Depends(proto_ver, proto)
assetsenv.Alias("proto_ver", proto_ver)
# Gather everything into a static lib
assets_parts = (icons, proto, dolphin_blocking, dolphin_internal, proto_ver)
env.Replace(FW_ASSETS_HEADERS=assets_parts)
assetslib = assetsenv.Library("${FW_LIB_NAME}", assets_parts)
assetsenv.Install("${LIB_DIST_DIR}", assetslib)
# Resources for SD card
if assetsenv["IS_BASE_FIRMWARE"]:
dolphin_external_out_dir = assetsenv["ASSETS_WORK_DIR"].Dir("dolphin")
# External dolphin animations
dolphin_external = assetsenv.DolphinExtBuilder(
dolphin_external_out_dir,
assetsenv["ASSETS_SRC_DIR"].Dir("dolphin"),
DOLPHIN_RES_TYPE="external",
)
if assetsenv["FORCE"]:
assetsenv.AlwaysBuild(dolphin_external)
assetsenv.Alias("dolphin_ext", dolphin_external)
assetsenv.Clean(dolphin_external, dolphin_external_out_dir)
env.Replace(DOLPHIN_EXTERNAL_OUT_DIR=dolphin_external_out_dir)
asset_packs_out_dir = assetsenv["ASSETS_WORK_DIR"].Dir("asset_packs")
# Default asset packs
asset_packs = assetsenv.AssetPacksBuilder(
asset_packs_out_dir,
assetsenv["ASSETS_SRC_DIR"].Dir("packs"),
)
if assetsenv["FORCE"]:
assetsenv.AlwaysBuild(asset_packs)
assetsenv.Alias("asset_packs", asset_packs)
assetsenv.Clean(asset_packs, asset_packs_out_dir)
env.Replace(ASSET_PACKS_OUT_DIR=asset_packs_out_dir)
Return("assetslib")