diff --git a/CMakeLists.txt b/CMakeLists.txt index e717c6e..e398931 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,9 +3,11 @@ cmake_minimum_required (VERSION 2.6) project (LUPPP) -set (LUPPP_VERSION_MAJOR 1) -set (LUPPP_VERSION_MINOR 0) +set(LUPPP_VERSION_MAJOR "1") +set(LUPPP_VERSION_MINOR "0") +set(LUPPP_VERSION_PATCH "1") +set(LUPPP_VERSION "${LUPPP_VERSION_MAJOR}.${LUPPP_VERSION_MINOR}.${LUPPP_VERSION_PATCH}") option(BUILD_TESTS "Build test version" OFF) @@ -17,4 +19,13 @@ option(BUILD_TESTS "Build test version" OFF) #set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) #set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) +#execute_process(COMMAND "date +\"%d-%m-%Y\"` `git log --pretty=format:\"%h\" | head -n1`" + +#execute_process(COMMAND "git log --pretty=format:\"%h\" | head -n1" + +execute_process(COMMAND git log --oneline -n1 + OUTPUT_VARIABLE _output OUTPUT_STRIP_TRAILING_WHITESPACE) + file(WRITE src/version.hxx "#define GIT_VERSION \"${_output}\"") + + add_subdirectory (src) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 5393333..b80034d 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -46,7 +46,7 @@ ENDIF(RELEASE_BUILD) FILE(GLOB sources *.cxx avtk/*.cxx cjson/*.c controller/*.cxx dsp/*.cxx observer/*.cxx state/*.cxx tests/*.cxx) # Compile binary -add_executable (luppp ${sources} ) +add_executable (luppp version.hxx ${sources} ) # Linking diff --git a/src/main.cxx b/src/main.cxx index 9b2ba5b..6caaef9 100644 --- a/src/main.cxx +++ b/src/main.cxx @@ -58,7 +58,7 @@ static void gui_static_loadSession_cb(void* inst) int main(int argc, char** argv) { - LUPPP_NOTE("%s", GIT_VERSION ); + LUPPP_NOTE("Git: %s", GIT_VERSION ); bool runTests; if ( runTests ){} // remove unused warning if not built with BUILD_TESTS diff --git a/version.sh b/version.sh deleted file mode 100755 index c7c9156..0000000 --- a/version.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - -# this file writes src/version.h from the git commit -echo " -#ifndef GIT_VERSION -#define GIT_VERSION \"`date +\"%d-%m-%Y\"` `git log --pretty=format:"%h" | head -n1`\" -#endif" > src/version.hxx