SConscript 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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("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. File("pretty_format.h"),
  28. ],
  29. )
  30. libenv = env.Clone(tools=["fbt_version"], FW_LIB_NAME="toolbox")
  31. libenv.ApplyLibFlags()
  32. # Git Version management
  33. version_depends = []
  34. version_id_data = get_fast_git_version_id()
  35. if version_id_data:
  36. version_depends = Value(version_id_data)
  37. # Only invoke version generator if preliminary check target (version_depends) has changed
  38. build_version = libenv.VersionBuilder(
  39. Dir("."),
  40. version_depends,
  41. )
  42. fw_version_json = libenv.InstallAs(
  43. "${BUILD_DIR}/${FIRMWARE_BUILD_CFG}.json", "version.json"
  44. )
  45. Alias("version_json", fw_version_json)
  46. env.Append(FW_VERSION_JSON=fw_version_json)
  47. # Default(fw_version_json)
  48. if not version_depends:
  49. libenv.Precious(build_version)
  50. libenv.AlwaysBuild(build_version)
  51. sources = libenv.GlobRecursive("*.c")
  52. libenv.Append(CPPPATH=[libenv.Dir(".")])
  53. lib = libenv.StaticLibrary("${FW_LIB_NAME}", sources)
  54. libenv.Install("${LIB_DIST_DIR}", lib)
  55. Return("lib")