2023-05-03 08:48:49 +03:00
|
|
|
Import("env")
|
|
|
|
|
2022-06-26 15:00:03 +03:00
|
|
|
assetsenv = env.Clone(
|
|
|
|
tools=["fbt_assets"],
|
|
|
|
FW_LIB_NAME="assets",
|
2023-10-30 18:17:30 +03:00
|
|
|
ASSETS_WORK_DIR=env.Dir("compiled"),
|
|
|
|
ASSETS_SRC_DIR=env.Dir("#/assets"),
|
2022-06-26 15:00:03 +03:00
|
|
|
)
|
|
|
|
assetsenv.ApplyLibFlags()
|
|
|
|
|
2022-10-06 16:55:57 +03:00
|
|
|
icons = assetsenv.CompileIcons(
|
2023-10-30 18:17:30 +03:00
|
|
|
assetsenv["ASSETS_WORK_DIR"],
|
|
|
|
assetsenv["ASSETS_SRC_DIR"].Dir("icons"),
|
2022-09-14 19:11:38 +03:00
|
|
|
)
|
2022-06-30 19:06:12 +03:00
|
|
|
assetsenv.Alias("icons", icons)
|
2022-06-26 15:00:03 +03:00
|
|
|
|
|
|
|
|
|
|
|
# Protobuf .proto -> .c + .h
|
2022-06-30 19:06:12 +03:00
|
|
|
proto_src = assetsenv.Glob("protobuf/*.proto", source=True)
|
|
|
|
proto_options = assetsenv.Glob("protobuf/*.options", source=True)
|
2023-10-30 18:17:30 +03:00
|
|
|
proto = assetsenv.ProtoBuilder(assetsenv["ASSETS_WORK_DIR"], proto_src)
|
2022-06-30 19:06:12 +03:00
|
|
|
assetsenv.Depends(proto, proto_options)
|
2022-06-26 15:00:03 +03:00
|
|
|
# Precious(proto)
|
2022-06-30 19:06:12 +03:00
|
|
|
assetsenv.Alias("proto", proto)
|
2022-06-26 15:00:03 +03:00
|
|
|
|
|
|
|
|
|
|
|
# Internal animations
|
|
|
|
|
|
|
|
dolphin_internal = assetsenv.DolphinSymBuilder(
|
2023-10-30 18:17:30 +03:00
|
|
|
assetsenv["ASSETS_WORK_DIR"],
|
|
|
|
assetsenv["ASSETS_SRC_DIR"].Dir("dolphin"),
|
2022-06-26 15:00:03 +03:00
|
|
|
DOLPHIN_RES_TYPE="internal",
|
|
|
|
)
|
2022-06-30 19:06:12 +03:00
|
|
|
assetsenv.Alias("dolphin_internal", dolphin_internal)
|
2022-06-26 15:00:03 +03:00
|
|
|
|
|
|
|
|
|
|
|
# Blocking animations
|
|
|
|
|
|
|
|
dolphin_blocking = assetsenv.DolphinSymBuilder(
|
2023-10-30 18:17:30 +03:00
|
|
|
assetsenv["ASSETS_WORK_DIR"],
|
|
|
|
assetsenv["ASSETS_SRC_DIR"].Dir("dolphin"),
|
2022-06-26 15:00:03 +03:00
|
|
|
DOLPHIN_RES_TYPE="blocking",
|
|
|
|
)
|
2022-06-30 19:06:12 +03:00
|
|
|
assetsenv.Alias("dolphin_blocking", dolphin_blocking)
|
2022-06-26 15:00:03 +03:00
|
|
|
|
|
|
|
|
|
|
|
# Protobuf version meta
|
|
|
|
proto_ver = assetsenv.ProtoVerBuilder(
|
2023-10-30 18:17:30 +03:00
|
|
|
"${ASSETS_WORK_DIR}/protobuf_version.h",
|
|
|
|
assetsenv["ASSETS_SRC_DIR"].File("protobuf/Changelog"),
|
2022-06-26 15:00:03 +03:00
|
|
|
)
|
2022-06-30 19:06:12 +03:00
|
|
|
assetsenv.Depends(proto_ver, proto)
|
|
|
|
assetsenv.Alias("proto_ver", proto_ver)
|
2022-06-26 15:00:03 +03:00
|
|
|
|
|
|
|
# Gather everything into a static lib
|
|
|
|
assets_parts = (icons, proto, dolphin_blocking, dolphin_internal, proto_ver)
|
2023-01-17 15:55:49 +03:00
|
|
|
env.Replace(FW_ASSETS_HEADERS=assets_parts)
|
2022-06-26 15:00:03 +03:00
|
|
|
|
|
|
|
assetslib = assetsenv.Library("${FW_LIB_NAME}", assets_parts)
|
|
|
|
assetsenv.Install("${LIB_DIST_DIR}", assetslib)
|
|
|
|
|
|
|
|
|
|
|
|
# Resources for SD card
|
|
|
|
if assetsenv["IS_BASE_FIRMWARE"]:
|
2023-10-30 18:17:30 +03:00
|
|
|
dolphin_external_out_dir = assetsenv["ASSETS_WORK_DIR"].Dir("dolphin")
|
2022-06-26 15:00:03 +03:00
|
|
|
# External dolphin animations
|
|
|
|
dolphin_external = assetsenv.DolphinExtBuilder(
|
2023-10-30 18:17:30 +03:00
|
|
|
dolphin_external_out_dir,
|
|
|
|
assetsenv["ASSETS_SRC_DIR"].Dir("dolphin"),
|
2022-06-26 15:00:03 +03:00
|
|
|
DOLPHIN_RES_TYPE="external",
|
|
|
|
)
|
|
|
|
if assetsenv["FORCE"]:
|
2022-06-30 19:06:12 +03:00
|
|
|
assetsenv.AlwaysBuild(dolphin_external)
|
|
|
|
assetsenv.Alias("dolphin_ext", dolphin_external)
|
2023-10-30 18:17:30 +03:00
|
|
|
assetsenv.Clean(dolphin_external, dolphin_external_out_dir)
|
2022-06-26 15:00:03 +03:00
|
|
|
|
2023-10-30 18:17:30 +03:00
|
|
|
env.Replace(DOLPHIN_EXTERNAL_OUT_DIR=dolphin_external_out_dir)
|
2022-06-26 15:00:03 +03:00
|
|
|
|
|
|
|
Return("assetslib")
|