execute_process(
  COMMAND git -C ${CMAKE_CURRENT_LIST_DIR}/.. rev-parse --short=8 HEAD
  OUTPUT_VARIABLE POWERPOD_GIT_HASH
  OUTPUT_STRIP_TRAILING_WHITESPACE
  ERROR_QUIET)
if(NOT POWERPOD_GIT_HASH)
  set(POWERPOD_GIT_HASH "unknown")
endif()

idf_component_register(
  SRCS
  "powerpod.c"
  "led_ring.c"
  "uart.c"
  "uart_proto.c"
  "cmd_handler.c"
  "cmd_version.c"
  "proto/uart_messages.pb.c"
  "proto/pb_encode.c"
  "proto/pb_common.c"
  INCLUDE_DIRS
  "."
  "proto")

target_compile_definitions(${COMPONENT_LIB}
                           PRIVATE "POWERPOD_GIT_HASH=\"${POWERPOD_GIT_HASH}\"")
