unleashed-firmware/assets/SConscript
SG b9a766d909 [FL-2627] Flipper applications: SDK, build and debug system (#1387)
* Added support for running applications from SD card (FAPs - Flipper Application Packages)
* Added plugin_dist target for fbt to build FAPs
* All apps of type FlipperAppType.EXTERNAL and FlipperAppType.PLUGIN are built as FAPs by default
* Updated VSCode configuration for new fbt features - re-deploy stock configuration to use them
* Added debugging support for FAPs with fbt debug & VSCode
* Added public firmware API with automated versioning

Co-authored-by: hedger <hedger@users.noreply.github.com>
Co-authored-by: SG <who.just.the.doctor@gmail.com>
Co-authored-by: あく <alleteam@gmail.com>
2022-09-15 02:21:03 +09:00

115 lines
3.1 KiB
Python

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(
assetsenv.Dir("compiled"), ICON_SRC_DIR=assetsenv.Dir("#/assets/icons")
)
assetsenv.Depends(icons, icons_src)
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.Dir("compiled"), proto_src)
assetsenv.Depends(proto, proto_options)
# Precious(proto)
assetsenv.Alias("proto", proto)
# Internal animations
dolphin_internal = assetsenv.DolphinSymBuilder(
assetsenv.Dir("compiled"),
assetsenv.Dir("#/assets/dolphin"),
DOLPHIN_RES_TYPE="internal",
)
assetsenv.Alias("dolphin_internal", dolphin_internal)
# Blocking animations
dolphin_blocking = assetsenv.DolphinSymBuilder(
assetsenv.Dir("compiled"),
assetsenv.Dir("#/assets/dolphin"),
DOLPHIN_RES_TYPE="blocking",
)
assetsenv.Alias("dolphin_blocking", dolphin_blocking)
# Protobuf version meta
proto_ver = assetsenv.ProtoVerBuilder(
"compiled/protobuf_version.h",
"#/assets/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)
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(
assetsenv.Dir("#/assets/resources/dolphin"),
assetsenv.Dir("#/assets/dolphin"),
DOLPHIN_RES_TYPE="external",
)
assetsenv.NoClean(dolphin_external)
if assetsenv["FORCE"]:
assetsenv.AlwaysBuild(dolphin_external)
assetsenv.Alias("dolphin_ext", dolphin_external)
# Resources manifest
resources = assetsenv.Command(
"#/assets/resources/Manifest",
assetsenv.GlobRecursive("*", "resources", exclude="Manifest"),
action=Action(
'${PYTHON3} "${ASSETS_COMPILER}" manifest "${TARGET.dir.posix}"',
"${RESMANIFESTCOMSTR}",
),
)
assetsenv.AlwaysBuild(resources)
assetsenv.Clean(
resources,
assetsenv.Dir("#/assets/resources/apps"),
)
# Exporting resources node to external environment
env["FW_RESOURCES"] = resources
assetsenv.Alias("resources", resources)
Return("assetslib")