Previously the commit hash was generated with a python script which was only called by PlatformIO and caused issues when using Zephyr SDK directly.
27 lines
729 B
CMake
27 lines
729 B
CMake
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
set(BOARD_ROOT ${CMAKE_SOURCE_DIR}/..)
|
|
set(DTS_ROOT ${CMAKE_SOURCE_DIR})
|
|
|
|
cmake_minimum_required(VERSION 3.13.1)
|
|
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
|
|
|
|
project(libre_solar_charge_controller)
|
|
|
|
add_subdirectory(../src build/src)
|
|
|
|
add_subdirectory(../lib/thingset build/thingset)
|
|
add_subdirectory(../lib/oled-display build/oled-display)
|
|
|
|
# determine git commit hash and provide it as a compiler define
|
|
find_package(Git)
|
|
if(GIT_FOUND)
|
|
execute_process(
|
|
COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD
|
|
OUTPUT_VARIABLE COMMIT_HASH
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
else()
|
|
set(COMMIT_HASH "")
|
|
endif()
|
|
add_definitions(-DCOMMIT_HASH="${COMMIT_HASH}")
|