2022-06-26 12:00:03 +00:00
|
|
|
Import("env")
|
|
|
|
|
|
|
|
from fbt.version import get_fast_git_version_id
|
|
|
|
|
|
|
|
|
|
|
|
env.Append(
|
|
|
|
CPPPATH=[
|
|
|
|
"#/lib/toolbox",
|
|
|
|
],
|
2022-09-14 16:11:38 +00:00
|
|
|
SDK_HEADERS=[
|
2022-11-02 15:15:40 +00:00
|
|
|
File("manchester_decoder.h"),
|
|
|
|
File("manchester_encoder.h"),
|
|
|
|
File("path.h"),
|
|
|
|
File("random_name.h"),
|
2023-03-21 12:29:54 +00:00
|
|
|
File("sha256.h"),
|
2022-11-02 15:15:40 +00:00
|
|
|
File("crc32_calc.h"),
|
|
|
|
File("dir_walk.h"),
|
|
|
|
File("md5.h"),
|
|
|
|
File("args.h"),
|
|
|
|
File("saved_struct.h"),
|
|
|
|
File("version.h"),
|
2022-12-30 12:52:53 +00:00
|
|
|
File("float_tools.h"),
|
2023-01-27 09:41:55 +00:00
|
|
|
File("value_index.h"),
|
2022-11-02 15:15:40 +00:00
|
|
|
File("tar/tar_archive.h"),
|
|
|
|
File("stream/stream.h"),
|
|
|
|
File("stream/file_stream.h"),
|
|
|
|
File("stream/string_stream.h"),
|
|
|
|
File("stream/buffered_file_stream.h"),
|
|
|
|
File("protocols/protocol_dict.h"),
|
2023-03-02 13:23:33 +00:00
|
|
|
File("pretty_format.h"),
|
2023-04-06 04:13:30 +00:00
|
|
|
File("hex.h"),
|
2022-09-14 16:11:38 +00:00
|
|
|
],
|
2022-06-26 12:00:03 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
libenv = env.Clone(tools=["fbt_version"], FW_LIB_NAME="toolbox")
|
|
|
|
libenv.ApplyLibFlags()
|
|
|
|
|
|
|
|
|
|
|
|
# Git Version management
|
|
|
|
version_depends = []
|
|
|
|
version_id_data = get_fast_git_version_id()
|
|
|
|
if version_id_data:
|
|
|
|
version_depends = Value(version_id_data)
|
|
|
|
|
|
|
|
# Only invoke version generator if preliminary check target (version_depends) has changed
|
|
|
|
build_version = libenv.VersionBuilder(
|
|
|
|
Dir("."),
|
|
|
|
version_depends,
|
|
|
|
)
|
|
|
|
|
|
|
|
fw_version_json = libenv.InstallAs(
|
|
|
|
"${BUILD_DIR}/${FIRMWARE_BUILD_CFG}.json", "version.json"
|
|
|
|
)
|
2022-08-22 17:06:17 +00:00
|
|
|
Alias("version_json", fw_version_json)
|
2022-06-26 12:00:03 +00:00
|
|
|
env.Append(FW_VERSION_JSON=fw_version_json)
|
|
|
|
|
|
|
|
# Default(fw_version_json)
|
|
|
|
|
|
|
|
|
|
|
|
if not version_depends:
|
|
|
|
libenv.Precious(build_version)
|
|
|
|
libenv.AlwaysBuild(build_version)
|
|
|
|
|
|
|
|
sources = libenv.GlobRecursive("*.c")
|
|
|
|
|
2022-08-22 17:06:17 +00:00
|
|
|
libenv.Append(CPPPATH=[libenv.Dir(".")])
|
2022-06-26 12:00:03 +00:00
|
|
|
|
|
|
|
lib = libenv.StaticLibrary("${FW_LIB_NAME}", sources)
|
|
|
|
libenv.Install("${LIB_DIST_DIR}", lib)
|
|
|
|
Return("lib")
|