mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-03-31 01:45:40 +00:00
* Unused icons to check later
* Exclude disabled icons from firmware
* Format
* Also report free flash in gh comment
* Fix free flash calc
* Fix?
* Fix??
* Split to next line
* Remove dead icons
* Some spring cleaning of icons cooker
* Improve unused icons script
* Disable icons that cant be used in asset packs
* These will need a workaround for external
* Revert "These will need a workaround for external"
This reverts commit fb23d97952.
* Here's the workaround: split assets lib
now there is "assets" and "fwassets"
firmware links with fwassets and includes all icons
however not all of them are exposed to api
if an app needs a firmware icon not in api, it can use fap_libs=["assets"]
this will link against this dummy assets lib
it only contains the icons that arent exposed to api
this way, an app using assets lib will still benefit from asset packs
but at same time, we can remove pointless icons from dfu blob
* Update changelog
118 lines
3.8 KiB
Python
118 lines
3.8 KiB
Python
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"),
|
|
fw_bundle=True,
|
|
)
|
|
assetsenv.Alias("icons", icons)
|
|
|
|
# Extra icons lib so apps don't override asset packs to use fw icons not exposed to api
|
|
# Not used anywhere in code, apps still reference assets_icons.h, but if one of the
|
|
# icons they need is not exposed in api, they can link with fap_libs=["assets"] which
|
|
# will use this lib purely for linking as a drop-in for missing symbols.
|
|
# Should mean that apps made for OFW with fap_libs=["assets"], when compiled with
|
|
# this FBT, will still use asset packs at runtime and only link non-exposed icons.
|
|
if assetsenv["IS_BASE_FIRMWARE"]:
|
|
dropin_icons = assetsenv.CompileIcons(
|
|
assetsenv["ASSETS_WORK_DIR"],
|
|
assetsenv["ASSETS_SRC_DIR"].Dir("icons"),
|
|
icon_bundle_name="_assets_icons_dropin",
|
|
)
|
|
|
|
|
|
# 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${FW_LIB_NAME}", assets_parts)
|
|
assetsenv.Install("${LIB_DIST_DIR}", assetslib)
|
|
|
|
if assetsenv["IS_BASE_FIRMWARE"]:
|
|
dropin_parts = (dropin_icons, proto, dolphin_blocking, dolphin_internal, proto_ver)
|
|
dropin_assetslib = assetsenv.Library("${FW_LIB_NAME}", dropin_parts)
|
|
assetsenv.Install("${LIB_DIST_DIR}", dropin_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")
|