2022-06-26 12:00:03 +00:00
|
|
|
Import("env")
|
|
|
|
|
|
|
|
# HACHHACK
|
|
|
|
# Currently injected to CPPPATH by libs - since they are built earlier and depend on assets
|
|
|
|
# env.Append(
|
|
|
|
# CPPPATH=[
|
|
|
|
# Dir("./compiled"),
|
|
|
|
# ]
|
|
|
|
# )
|
|
|
|
|
|
|
|
assetsenv = env.Clone(
|
|
|
|
tools=["fbt_assets"],
|
|
|
|
FW_LIB_NAME="assets",
|
|
|
|
)
|
|
|
|
assetsenv.ApplyLibFlags()
|
|
|
|
|
|
|
|
if not assetsenv["VERBOSE"]:
|
|
|
|
assetsenv.SetDefault(
|
|
|
|
ICONSCOMSTR="\tICONS\t${TARGET}",
|
|
|
|
PROTOCOMSTR="\tPROTO\t${SOURCE}",
|
|
|
|
DOLPHINCOMSTR="\tDOLPHIN\t${DOLPHIN_RES_TYPE}",
|
|
|
|
RESMANIFESTCOMSTR="\tMANIFEST\t${TARGET}",
|
|
|
|
PBVERCOMSTR="\tPBVER\t${TARGET}",
|
|
|
|
)
|
|
|
|
|
|
|
|
# Gathering icons sources
|
|
|
|
icons_src = assetsenv.GlobRecursive("*.png", "icons")
|
|
|
|
icons_src += assetsenv.GlobRecursive("frame_rate", "icons")
|
|
|
|
|
|
|
|
icons = assetsenv.IconBuilder(Dir("compiled"), Dir("#/assets/icons"))
|
2022-06-30 16:06:12 +00:00
|
|
|
assetsenv.Depends(icons, icons_src)
|
|
|
|
assetsenv.Alias("icons", icons)
|
2022-06-26 12:00:03 +00:00
|
|
|
|
|
|
|
|
|
|
|
# Protobuf .proto -> .c + .h
|
|
|
|
|
2022-06-30 16:06:12 +00:00
|
|
|
proto_src = assetsenv.Glob("protobuf/*.proto", source=True)
|
|
|
|
proto_options = assetsenv.Glob("protobuf/*.options", source=True)
|
|
|
|
proto = assetsenv.ProtoBuilder(assetsenv.Dir("compiled"), proto_src)
|
|
|
|
assetsenv.Depends(proto, proto_options)
|
2022-06-26 12:00:03 +00:00
|
|
|
# Precious(proto)
|
2022-06-30 16:06:12 +00:00
|
|
|
assetsenv.Alias("proto", proto)
|
2022-06-26 12:00:03 +00:00
|
|
|
|
|
|
|
|
|
|
|
# Internal animations
|
|
|
|
|
|
|
|
dolphin_internal = assetsenv.DolphinSymBuilder(
|
2022-06-30 16:06:12 +00:00
|
|
|
assetsenv.Dir("compiled"),
|
|
|
|
assetsenv.Dir("#/assets/dolphin"),
|
2022-06-26 12:00:03 +00:00
|
|
|
DOLPHIN_RES_TYPE="internal",
|
|
|
|
)
|
2022-06-30 16:06:12 +00:00
|
|
|
assetsenv.Alias("dolphin_internal", dolphin_internal)
|
2022-06-26 12:00:03 +00:00
|
|
|
|
|
|
|
|
|
|
|
# Blocking animations
|
|
|
|
|
|
|
|
dolphin_blocking = assetsenv.DolphinSymBuilder(
|
2022-06-30 16:06:12 +00:00
|
|
|
assetsenv.Dir("compiled"),
|
|
|
|
assetsenv.Dir("#/assets/dolphin"),
|
2022-06-26 12:00:03 +00:00
|
|
|
DOLPHIN_RES_TYPE="blocking",
|
|
|
|
)
|
2022-06-30 16:06:12 +00:00
|
|
|
assetsenv.Alias("dolphin_blocking", dolphin_blocking)
|
2022-06-26 12:00:03 +00:00
|
|
|
|
|
|
|
|
|
|
|
# Protobuf version meta
|
|
|
|
proto_ver = assetsenv.ProtoVerBuilder(
|
|
|
|
"compiled/protobuf_version.h",
|
|
|
|
"#/assets/protobuf/Changelog",
|
|
|
|
)
|
2022-06-30 16:06:12 +00:00
|
|
|
assetsenv.Depends(proto_ver, proto)
|
|
|
|
assetsenv.Alias("proto_ver", proto_ver)
|
2022-06-26 12:00:03 +00:00
|
|
|
|
|
|
|
# Gather everything into a static lib
|
|
|
|
assets_parts = (icons, proto, dolphin_blocking, dolphin_internal, proto_ver)
|
|
|
|
|
|
|
|
assetslib = assetsenv.Library("${FW_LIB_NAME}", assets_parts)
|
|
|
|
assetsenv.Install("${LIB_DIST_DIR}", assetslib)
|
|
|
|
|
|
|
|
|
|
|
|
# Resources for SD card
|
|
|
|
|
|
|
|
if assetsenv["IS_BASE_FIRMWARE"]:
|
|
|
|
# External dolphin animations
|
|
|
|
dolphin_external = assetsenv.DolphinExtBuilder(
|
2022-06-30 16:06:12 +00:00
|
|
|
assetsenv.Dir("#/assets/resources/dolphin"),
|
|
|
|
assetsenv.Dir("#/assets/dolphin"),
|
2022-06-26 12:00:03 +00:00
|
|
|
DOLPHIN_RES_TYPE="external",
|
|
|
|
)
|
2022-06-30 16:06:12 +00:00
|
|
|
assetsenv.NoClean(dolphin_external)
|
2022-06-26 12:00:03 +00:00
|
|
|
if assetsenv["FORCE"]:
|
2022-06-30 16:06:12 +00:00
|
|
|
assetsenv.AlwaysBuild(dolphin_external)
|
|
|
|
assetsenv.Alias("dolphin_ext", dolphin_external)
|
2022-06-26 12:00:03 +00:00
|
|
|
|
|
|
|
# Resources manifest
|
|
|
|
|
|
|
|
resources = assetsenv.Command(
|
|
|
|
"#/assets/resources/Manifest",
|
|
|
|
assetsenv.GlobRecursive("*", "resources", exclude="Manifest"),
|
|
|
|
action=Action(
|
2022-07-25 21:31:34 +00:00
|
|
|
'${PYTHON3} "${ASSETS_COMPILER}" manifest "${TARGET.dir.posix}"',
|
2022-06-26 12:00:03 +00:00
|
|
|
"${RESMANIFESTCOMSTR}",
|
|
|
|
),
|
|
|
|
)
|
2022-06-30 16:06:12 +00:00
|
|
|
assetsenv.Precious(resources)
|
|
|
|
assetsenv.NoClean(resources)
|
2022-06-26 12:00:03 +00:00
|
|
|
if assetsenv["FORCE"]:
|
2022-06-30 16:06:12 +00:00
|
|
|
assetsenv.AlwaysBuild(resources)
|
2022-06-26 12:00:03 +00:00
|
|
|
|
|
|
|
# Exporting resources node to external environment
|
|
|
|
env["FW_RESOURCES"] = resources
|
2022-06-30 16:06:12 +00:00
|
|
|
assetsenv.Alias("resources", resources)
|
2022-06-26 12:00:03 +00:00
|
|
|
|
|
|
|
Return("assetslib")
|