mirror of
https://github.com/DarkFlippers/unleashed-firmware.git
synced 2024-12-22 04:41:36 +03:00
917410a0a8
* fbt: reworking targets & assets handling WIP * fbt: dist fixes * fbt: moved SD card resources to owning apps * unit_tests: moved resources to app folder * github: updated unit_tests paths * github: packaging fixes * unit_tests: fixes * fbt: assets: internal cleanup * fbt: reworked assets handling * github: unit_tests: reintroducing fixes * minor cleanup * fbt: naming changes to reflect private nature of scons tools * fbt: resources: fixed dist archive paths * docs: updated paths * docs: updated more paths * docs: included "resources" parameter in app manifest docs; updated assets readme * updated gitignore for assets * github: updated action versions * unit_tests: restored timeout; scripts: assets: logging changes * gh: don't upload desktop animations for unit test run Co-authored-by: あく <alleteam@gmail.com>
136 lines
3.2 KiB
Plaintext
136 lines
3.2 KiB
Plaintext
from dataclasses import dataclass, field
|
|
from fbt.appmanifest import FlipperAppType
|
|
|
|
from SCons.Node import NodeList
|
|
from SCons.Warnings import warn, WarningOnByDefault
|
|
|
|
|
|
Import("ENV")
|
|
|
|
|
|
appenv = ENV["APPENV"] = ENV.Clone(
|
|
tools=[
|
|
"fbt_extapps",
|
|
"fbt_assets",
|
|
"fbt_sdk",
|
|
],
|
|
)
|
|
|
|
appenv.Replace(
|
|
LINKER_SCRIPT_PATH=appenv["APP_LINKER_SCRIPT_PATH"],
|
|
)
|
|
|
|
appenv.AppendUnique(
|
|
CCFLAGS=[
|
|
"-mword-relocations",
|
|
"-mlong-calls",
|
|
"-fno-common",
|
|
"-nostdlib",
|
|
],
|
|
LINKFLAGS=[
|
|
"-Ur",
|
|
"-Wl,-Ur",
|
|
"-nostartfiles",
|
|
"-mlong-calls",
|
|
"-fno-common",
|
|
"-nostdlib",
|
|
"-Wl,--gc-sections",
|
|
"-Wl,--no-export-dynamic",
|
|
"-fvisibility=hidden",
|
|
"-Wl,-e${APP_ENTRY}",
|
|
"-Xlinker",
|
|
"-Map=${TARGET}.map",
|
|
"-specs=nano.specs",
|
|
"-specs=nosys.specs",
|
|
],
|
|
LIBS=[
|
|
"m",
|
|
"gcc",
|
|
"stdc++",
|
|
"supc++",
|
|
],
|
|
)
|
|
|
|
|
|
@dataclass
|
|
class FlipperExtAppBuildArtifacts:
|
|
application_map: dict = field(default_factory=dict)
|
|
sdk_tree: NodeList = field(default_factory=NodeList)
|
|
|
|
|
|
for app in appenv["APPBUILD"].get_ext_apps():
|
|
appenv.BuildAppElf(app)
|
|
|
|
extapps = FlipperExtAppBuildArtifacts()
|
|
extapps.application_map = appenv["EXT_APPS"]
|
|
|
|
|
|
if appenv["FORCE"]:
|
|
appenv.AlwaysBuild(
|
|
list(app_artifact.compact for app_artifact in extapps.application_map.values())
|
|
)
|
|
|
|
|
|
Alias(
|
|
"faps",
|
|
list(app_artifact.validator for app_artifact in extapps.application_map.values()),
|
|
)
|
|
|
|
|
|
if appsrc := appenv.subst("$APPSRC"):
|
|
launch_target = appenv.AddAppLaunchTarget(appsrc, "launch")
|
|
Alias("launch_app", launch_target)
|
|
appenv.PhonyTarget(
|
|
"launch_app",
|
|
Action(
|
|
lambda **kw: warn(
|
|
WarningOnByDefault,
|
|
"The 'launch_app' target is deprecated. Use 'launch' instead.",
|
|
),
|
|
None,
|
|
),
|
|
)
|
|
|
|
appenv.AddAppBuildTarget(appsrc, "build")
|
|
|
|
# SDK management
|
|
|
|
amalgamated_api = "${BUILD_DIR}/sdk_origin"
|
|
sdk_source = appenv.ApiAmalgamator(
|
|
amalgamated_api,
|
|
# Deps on root SDK headers and generated files
|
|
(appenv["SDK_HEADERS"], appenv["FW_ASSETS_HEADERS"]),
|
|
)
|
|
# Extra deps on headers included in deeper levels
|
|
# Available on second and subsequent builds
|
|
Depends(sdk_source, appenv.ProcessSdkDepends(f"{amalgamated_api}.d"))
|
|
|
|
appenv["SDK_DIR"] = appenv.Dir("${BUILD_DIR}/sdk_headers")
|
|
sdk_header_tree = appenv.SDKHeaderTreeExtractor(appenv["SDK_DIR"], amalgamated_api)
|
|
Depends(sdk_header_tree, appenv["SDK_DEFINITION"])
|
|
# AlwaysBuild(sdk_tree)
|
|
Alias("sdk_tree", sdk_header_tree)
|
|
extapps.sdk_tree = sdk_header_tree
|
|
|
|
api_check = appenv.ApiTableValidator(appenv["SDK_DEFINITION"], amalgamated_api)
|
|
Precious(api_check)
|
|
NoClean(api_check)
|
|
AlwaysBuild(api_check)
|
|
Alias("api_check", api_check)
|
|
|
|
firmware_apitable = appenv.ApiSymbolTable(
|
|
"${BUILD_DIR}/assets/compiled/firmware_api_table.h", appenv["SDK_DEFINITION"]
|
|
)
|
|
Alias("api_table", firmware_apitable)
|
|
ENV.Replace(
|
|
FW_API_TABLE=firmware_apitable,
|
|
_APP_ICONS=appenv["_APP_ICONS"],
|
|
)
|
|
|
|
|
|
if appenv["FORCE"]:
|
|
appenv.AlwaysBuild(sdk_source, sdk_header_tree, api_check, firmware_apitable)
|
|
|
|
|
|
Return("extapps")
|