9bf11d9fd2
* fbt: assets builder for apps WIP * fbt: automatically building private fap assets * docs: details on how to use image assets * fbt: renamed fap_assets -> fap_icons * fbt: support for fap_extbuild field * docs: info on fap_extbuild * fbt: added --proxy-env parame ter * fbt: made firmware_cdb & updater_cdb targets always available * fbt: renamed fap_icons -> fap_icon_assets * fbt: deprecated firmware_* target names for faps; new alias is "fap_APPID" * fbt: changed intermediate file locations for external apps * fbt: support for fap_private_libs; docs: updates * restored mbedtls as global lib * scripts: lint.py: skip "lib" subfolder * fbt: Sanity checks for building advanced faps as part of fw * docs: info on fap_private_libs; fbt: optimized *.fam indexing * fbt: cleanup; samples: added sample_icons app * fbt: moved example app to applications/examples * linter fix * docs: readme fixes * added applications/examples/application.fam stub * docs: more info on private libs Co-authored-by: あく <alleteam@gmail.com>
98 lines
2.7 KiB
Python
98 lines
2.7 KiB
Python
Import("env")
|
|
|
|
from fbt.version import get_git_commit_unix_timestamp
|
|
|
|
assetsenv = env.Clone(
|
|
tools=["fbt_assets"],
|
|
FW_LIB_NAME="assets",
|
|
GIT_UNIX_TIMESTAMP=get_git_commit_unix_timestamp(),
|
|
)
|
|
assetsenv.ApplyLibFlags()
|
|
|
|
icons = assetsenv.CompileIcons(
|
|
assetsenv.Dir("compiled"), assetsenv.Dir("#/assets/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.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}" --timestamp=${GIT_UNIX_TIMESTAMP}',
|
|
"${RESMANIFESTCOMSTR}",
|
|
),
|
|
)
|
|
assetsenv.Precious(resources)
|
|
assetsenv.AlwaysBuild(resources)
|
|
assetsenv.Clean(
|
|
resources,
|
|
assetsenv.Dir("#/assets/resources/apps"),
|
|
)
|
|
|
|
# Exporting resources node to external environment
|
|
env["FW_ASSETS_HEADERS"] = assets_parts
|
|
env["FW_RESOURCES"] = resources
|
|
assetsenv.Alias("resources", resources)
|
|
|
|
Return("assetslib")
|