CMakeLists.txt 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. cmake_minimum_required(VERSION 3.20.0)
  2. find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
  3. project(relay_zephyr)
  4. # Logged at boot (see main.c) so a serial capture says which app commit -
  5. # dirty tree or not - is actually running, independent of the Zephyr
  6. # kernel's own "Booting Zephyr OS build ..." line, which only identifies
  7. # the vendored zephyr tree, not this app's source.
  8. execute_process(
  9. COMMAND git -C ${CMAKE_CURRENT_SOURCE_DIR} describe --always --dirty --long
  10. OUTPUT_VARIABLE APP_BUILD_ID
  11. OUTPUT_STRIP_TRAILING_WHITESPACE
  12. ERROR_QUIET
  13. )
  14. if(NOT APP_BUILD_ID)
  15. set(APP_BUILD_ID "unknown")
  16. endif()
  17. # CONFIG_DISABLE_MAC_VERIFY/CONFIG_DISABLE_PUBKEY_VERIFY (see Kconfig)
  18. # short-circuit the two real auth checks to always pass - bench/test
  19. # builds only, never meant to reach a fielded unit. CONFIG_* is already
  20. # available here: find_package(Zephyr ...) above has already run
  21. # Kconfig by this point. Flagging it in the build tag means a UART/
  22. # syslog capture alone proves whether auth was live, without having to
  23. # also know or trust the build's Kconfig fragment.
  24. if(CONFIG_DISABLE_MAC_VERIFY OR CONFIG_DISABLE_PUBKEY_VERIFY)
  25. set(APP_BUILD_ID "${APP_BUILD_ID}-NOAUTH")
  26. endif()
  27. target_compile_definitions(app PRIVATE APP_BUILD_ID="${APP_BUILD_ID}")
  28. # Headers are included by their path relative to src (e.g.
  29. # "frame/frame.h"), so only src itself needs to be on the include path -
  30. # no per-module directory, and no risk of a same-named header in two
  31. # modules shadowing each other.
  32. target_include_directories(app PRIVATE
  33. src
  34. )
  35. target_sources(app PRIVATE
  36. src/main.c
  37. src/beacon/beacon_ctx.c
  38. src/beacon/beacon_rx.c
  39. src/beacon/beacon_work.c
  40. src/frame/beacon_frame.c
  41. src/frame/frame.c
  42. src/frame/msg_frame.c
  43. src/frame/pkt_log.c
  44. src/frame/rx_dedup.c
  45. src/relay/cad_rx.c
  46. src/relay/cbf.c
  47. src/relay/relay_work.c
  48. src/relay/tx_queue.c
  49. src/rx/discovery_rx.c
  50. src/rx/payload_rx.c
  51. src/rx/payload_work.c
  52. src/net/peer_stats.c
  53. src/net/time_ctx.c
  54. src/crypto/base_ident_pubkey.c
  55. src/crypto/group_key.c
  56. src/crypto/group_mac.c
  57. src/crypto/ident.c
  58. src/crypto/ident_privkey.c
  59. src/crypto/ident_stub.c
  60. src/crypto/pubkey_table.c
  61. )
  62. # Base-station-only networking (WiFi connect) - every other node shares
  63. # the frame/CBF/topology code above unconditionally and skips this.
  64. target_sources_ifdef(CONFIG_APP_BASE_STATION app PRIVATE src/net/net_base.c)