add an auto generated version id

Former-commit-id: df3ad6b08e24e73d957611e8be45e7e8cc717b8c
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") message(FATAL_ERROR "dispmanx grabber and osx grabber cannot be used at the same time")
endif(ENABLE_OSX AND ENABLE_DISPMANX) endif(ENABLE_OSX AND ENABLE_DISPMANX)
#if(ENABLE_QT5) #if(ENABLE_QT5)
# TODO vs ENABLE_QT4? # TODO vs ENABLE_QT4?
#endif(ENABLE_QT5) #endif(ENABLE_QT5)
# Createt the configuration file # 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 # configure a header file to pass some of the CMake settings
# to the source code # to the source code
configure_file("${PROJECT_SOURCE_DIR}/HyperionConfig.h.in" "${PROJECT_BINARY_DIR}/HyperionConfig.h") configure_file("${PROJECT_SOURCE_DIR}/HyperionConfig.h.in" "${PROJECT_BINARY_DIR}/HyperionConfig.h")
include_directories("${PROJECT_BINARY_DIR}") 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) if(ENABLE_QT5)
ADD_DEFINITIONS ( -DENABLE_QT5 ) ADD_DEFINITIONS ( -DENABLE_QT5 )
#find_package(Qt5Widgets) #find_package(Qt5Widgets)
else(ENABLE_QT5) else(ENABLE_QT5)
# Add specific cmake modules to find qt4 (default version finds first available QT which might not be 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) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake/qt4)
endif(ENABLE_QT5) endif(ENABLE_QT5)
# Define the global output path of binaries # 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) if(ENABLE_QT5)
#find_package(Qt5Core REQUIRED) #find_package(Qt5Core REQUIRED)
find_package(Qt5 COMPONENTS Core Gui Widgets Network 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 "${CMAKE_CXX_FLAGS} ${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS}")
# set(CMAKE_CXX_FLAGS "-fPIC") # set(CMAKE_CXX_FLAGS "-fPIC")
else(ENABLE_QT5) else(ENABLE_QT5)
# Configure the use of QT4 # Configure the use of QT4
find_package(Qt4 COMPONENTS QtCore QtGui QtNetwork REQUIRED QUIET) find_package(Qt4 COMPONENTS QtCore QtNetwork QtGui REQUIRED QUIET)
endif(ENABLE_QT5) endif(ENABLE_QT5)
#add libusb and pthreads #add libusb and pthreads
find_package(libusb-1.0 REQUIRED) find_package(libusb-1.0 REQUIRED)
find_package(Threads REQUIRED) find_package(Threads REQUIRED)
if(ENABLE_QT5) if(ENABLE_QT5)
#include(${QT_USE_FILE}) #include(${QT_USE_FILE})
add_definitions(${QT_DEFINITIONS}) add_definitions(${QT_DEFINITIONS})
else(ENABLE_QT5) else(ENABLE_QT5)
include(${QT_USE_FILE}) include(${QT_USE_FILE})
add_definitions(${QT_DEFINITIONS}) add_definitions(${QT_DEFINITIONS})
endif(ENABLE_QT5) endif(ENABLE_QT5)
# TODO[TvdZ]: This linking directory should only be added if we are cross compiling # 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 // Define to enable the osx grabber
#cmakedefine ENABLE_OSX #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 // Initialising QCoreApplication
QCoreApplication app(argc, argv); 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(SIGINT, signal_handler);
signal(SIGTERM, signal_handler); signal(SIGTERM, signal_handler);