SConscript 1.6 KB

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