SConscript 1.7 KB

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