SConscript 1.7 KB

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