add an auto generated version id

Former-commit-id: df3ad6b08e
This commit is contained in:
redpanther 2016-03-10 06:53:21 +01:00
parent 7f4ea9ae7b
commit 49e867f5fc
4 changed files with 32 additions and 17 deletions

View File

@ -56,25 +56,30 @@ if(ENABLE_OSX AND ENABLE_DISPMANX)
message(FATAL_ERROR "dispmanx grabber and osx grabber cannot be used at the same time")
endif(ENABLE_OSX AND ENABLE_DISPMANX)
#if(ENABLE_QT5)
# TODO vs ENABLE_QT4?
#endif(ENABLE_QT5)
# Createt the configuration file
# Add project specific cmake modules (find, etc)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
find_package(GitVersion)
# configure a header file to pass some of the CMake settings
# to the source code
configure_file("${PROJECT_SOURCE_DIR}/HyperionConfig.h.in" "${PROJECT_BINARY_DIR}/HyperionConfig.h")
include_directories("${PROJECT_BINARY_DIR}")
# Add project specific cmake modules (find, etc)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
if(ENABLE_QT5)
ADD_DEFINITIONS ( -DENABLE_QT5 )
#find_package(Qt5Widgets)
ADD_DEFINITIONS ( -DENABLE_QT5 )
#find_package(Qt5Widgets)
else(ENABLE_QT5)
# Add specific cmake modules to find qt4 (default version finds first available QT which might not be qt4)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake/qt4)
# Add specific cmake modules to find qt4 (default version finds first available QT which might not be qt4)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake/qt4)
endif(ENABLE_QT5)
# Define the global output path of binaries
@ -97,23 +102,23 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x -Wall")
if(ENABLE_QT5)
#find_package(Qt5Core REQUIRED)
find_package(Qt5 COMPONENTS Core Gui Widgets Network REQUIRED)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS}")
# set(CMAKE_CXX_FLAGS "-fPIC")
find_package(Qt5 COMPONENTS Core Gui Widgets Network REQUIRED)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS}")
# set(CMAKE_CXX_FLAGS "-fPIC")
else(ENABLE_QT5)
# Configure the use of QT4
find_package(Qt4 COMPONENTS QtCore QtGui QtNetwork REQUIRED QUIET)
# Configure the use of QT4
find_package(Qt4 COMPONENTS QtCore QtNetwork QtGui REQUIRED QUIET)
endif(ENABLE_QT5)
#add libusb and pthreads
find_package(libusb-1.0 REQUIRED)
find_package(Threads REQUIRED)
if(ENABLE_QT5)
#include(${QT_USE_FILE})
add_definitions(${QT_DEFINITIONS})
#include(${QT_USE_FILE})
add_definitions(${QT_DEFINITIONS})
else(ENABLE_QT5)
include(${QT_USE_FILE})
add_definitions(${QT_DEFINITIONS})
include(${QT_USE_FILE})
add_definitions(${QT_DEFINITIONS})
endif(ENABLE_QT5)
# TODO[TvdZ]: This linking directory should only be added if we are cross compiling

View File

@ -27,3 +27,4 @@
// Define to enable the osx grabber
#cmakedefine ENABLE_OSX
#define HYPERION_VERSION_ID "${HYPERION_VERSION_ID}"

View File

@ -0,0 +1,9 @@
execute_process( COMMAND git log -1 --format=%cn-%t/%h-%ct WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} OUTPUT_VARIABLE BUILD_ID ERROR_QUIET )
execute_process( COMMAND sh -c "git branch | grep '^*' | sed 's;^*;;g' " WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} OUTPUT_VARIABLE VERSION_ID ERROR_QUIET )
STRING ( STRIP "${BUILD_ID}" BUILD_ID )
STRING ( STRIP "${VERSION_ID}" VERSION_ID )
SET ( HYPERION_VERSION_ID "${VERSION_ID} (${BUILD_ID}" )
message ( STATUS "Current Version: ${HYPERION_VERSION_ID})" )

View File

@ -96,7 +96,7 @@ int main(int argc, char** argv)
// Initialising QCoreApplication
QCoreApplication app(argc, argv);
std::cout << "QCoreApplication initialised" << std::endl;
std::cout << "Hyperion initialised, Version: " << HYPERION_VERSION_ID << std::endl;
signal(SIGINT, signal_handler);
signal(SIGTERM, signal_handler);