SConscript 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. Import("env")
  2. from fbt.version import get_fast_git_version_id
  3. env.Append(
  4. CPPPATH=[
  5. "#/lib/toolbox",
  6. ],
  7. SDK_HEADERS=[
  8. File("manchester_decoder.h"),
  9. File("manchester_encoder.h"),
  10. File("path.h"),
  11. File("random_name.h"),
  12. File("hmac_sha256.h"),
  13. File("crc32_calc.h"),
  14. File("dir_walk.h"),
  15. File("md5.h"),
  16. File("args.h"),
  17. File("saved_struct.h"),
  18. File("version.h"),
  19. File("float_tools.h"),
  20. File("value_index.h"),
  21. File("tar/tar_archive.h"),
  22. File("stream/stream.h"),
  23. File("stream/file_stream.h"),
  24. File("stream/string_stream.h"),
  25. File("stream/buffered_file_stream.h"),
  26. File("protocols/protocol_dict.h"),
  27. ],
  28. )
  29. libenv = env.Clone(tools=["fbt_version"], FW_LIB_NAME="toolbox")
  30. libenv.ApplyLibFlags()
  31. # Git Version management
  32. version_depends = []
  33. version_id_data = get_fast_git_version_id()
  34. if version_id_data:
  35. version_depends = Value(version_id_data)
  36. # Only invoke version generator if preliminary check target (version_depends) has changed
  37. build_version = libenv.VersionBuilder(
  38. Dir("."),
  39. version_depends,
  40. )
  41. fw_version_json = libenv.InstallAs(
  42. "${BUILD_DIR}/${FIRMWARE_BUILD_CFG}.json", "version.json"
  43. )
  44. Alias("version_json", fw_version_json)
  45. env.Append(FW_VERSION_JSON=fw_version_json)
  46. # Default(fw_version_json)
  47. if not version_depends:
  48. libenv.Precious(build_version)
  49. libenv.AlwaysBuild(build_version)
  50. sources = libenv.GlobRecursive("*.c")
  51. libenv.Append(CPPPATH=[libenv.Dir(".")])
  52. lib = libenv.StaticLibrary("${FW_LIB_NAME}", sources)
  53. libenv.Install("${LIB_DIST_DIR}", lib)
  54. Return("lib")