SConscript 1.6 KB

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