Browse Source

Add version defines

master
Robin Thoni 4 years ago
parent
commit
f881d71afd
Signed by: Robin THONI <robin@rthoni.com> GPG Key ID: 4E09DEF46B99E61E
1 changed files with 14 additions and 0 deletions
  1. 14
    0
      CMakeLists.txt

+ 14
- 0
CMakeLists.txt View File

23
 set(${CMAKE_PROJECT_NAME}_SKETCH main.ino)
23
 set(${CMAKE_PROJECT_NAME}_SKETCH main.ino)
24
 generate_arduino_firmware(${CMAKE_PROJECT_NAME})
24
 generate_arduino_firmware(${CMAKE_PROJECT_NAME})
25
 
25
 
26
+add_definitions(-DAPP_CORE_VERSION=1.0.0)
27
+
28
+execute_process(
29
+        COMMAND
30
+        git rev-parse --short HEAD
31
+        RESULT_VARIABLE
32
+        SHORT_HASH_RESULT
33
+        OUTPUT_VARIABLE
34
+        SHORT_HASH
35
+)
36
+string(REGEX REPLACE "\n$" "" SHORT_HASH "${SHORT_HASH}")
37
+message(STATUS "SHORT_HASH=${SHORT_HASH}")
38
+add_definitions(-DAPP_CORE_COMMIT=${SHORT_HASH})
39
+
26
 if (CMAKE_BUILD_TYPE MATCHES "Debug")
40
 if (CMAKE_BUILD_TYPE MATCHES "Debug")
27
     message(STATUS "Debug build detected. Enabling logs.")
41
     message(STATUS "Debug build detected. Enabling logs.")
28
     add_definitions(-DAPP_CORE_LOGS=1)
42
     add_definitions(-DAPP_CORE_LOGS=1)

Loading…
Cancel
Save