Commit 16aa03a0 authored by Pawel Sznajder's avatar Pawel Sznajder
Browse files

update versioning mechanism

parent b3040cac
......@@ -34,6 +34,13 @@ string(REGEX REPLACE "\\." "" NUMA_VERSION_PATCH ${TMP_STR})
message("-- NumA++ version is: " ${NUMA_VERSION_MAJOR} "." ${NUMA_VERSION_MINOR} "." ${NUMA_VERSION_PATCH})
execute_process(COMMAND bash -c "cd ${CMAKE_SOURCE_DIR}; git branch | grep '\*' | cut -d ' ' -f2 2> /dev/null" OUTPUT_VARIABLE NUMA_GIT_BRANCH)
execute_process(COMMAND bash -c "cd ${CMAKE_SOURCE_DIR}; git rev-parse HEAD 2> /dev/null" OUTPUT_VARIABLE NUMA_GIT_REVISION)
string(REGEX REPLACE "\n$" "" NUMA_GIT_BRANCH "${NUMA_GIT_BRANCH}")
string(REGEX REPLACE "\n$" "" NUMA_GIT_REVISION "${NUMA_GIT_REVISION}")
message("-- Git branch (revision): " ${NUMA_GIT_BRANCH} " (" ${NUMA_GIT_REVISION} ")")
# configure
configure_file(${CMAKE_SOURCE_DIR}/cmake/Version/NumAVersion.h_in ${CMAKE_SOURCE_DIR}/include/NumA/NumAVersion.h)
......@@ -50,6 +57,44 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON)
# find libraries: additional modules
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
# find libraries: Qt
find_package(Qt5 COMPONENTS Core QUIET)
if(${Qt5_FOUND})
find_package(Qt5Widgets QUIET)
if (Qt5Widgets_FOUND)
set(QT_VERSION ${Qt5Widgets_VERSION})
else()
set(QT_VERSION "5.??.??")
endif()
set(QT_LIBRARY_CORE "Qt5::Core")
set(QT_LIBRARY_SQL "Qt5::Sql")
set(QT_LIBRARY_XML "Qt5::XmlPatterns")
message("-- Found Qt5: " ${QT_VERSION})
else()
find_package(Qt4 COMPONENTS QtCore QUIET)
if(${Qt4_FOUND})
set(QT_VERSION ${QT_VERSION_MAJOR}.${QT_VERSION_MINOR}.${QT_VERSION_PATCH})
set(QT_LIBRARY_CORE "Qt4::QtCore")
set(QT_LIBRARY_SQL "Qt4::QtSql")
set(QT_LIBRARY_XML "Qt4::QtXmlPatterns")
message("-- Found Qt4: " ${QT_VERSION})
else()
message(FATAL_ERROR "Neither Qt5 nor Qt4 found in this system")
endif()
endif()
# find libraries: SFML
find_package(SFML COMPONENTS system REQUIRED)
......
......@@ -7,7 +7,11 @@
* This file is used to define NumA++ version number and it is set by CMake.
*/
#define NUMA_VERSION(major,minor) (((major) << 8) + (minor))
#define NUMA_VERSION(major,minor,patch) (1000000*major + 1000*minor + patch)
#define NUMA_VERSION_MAJOR @NUMA_VERSION_MAJOR@
#define NUMA_VERSION_MINOR @NUMA_VERSION_MINOR@
#define NUMA_VERSION_CODE NUMA_VERSION(NUMA_VERSION_MAJOR, NUMA_VERSION_MINOR)
\ No newline at end of file
#define NUMA_VERSION_PATCH @NUMA_VERSION_PATCH@
#define NUMA_VERSION_CODE NUMA_VERSION(NUMA_VERSION_MAJOR, NUMA_VERSION_MINOR, NUMA_VERSION_PATCH)
#define NUMA_GIT_BRANCH "@NUMA_GIT_BRANCH@"
#define NUMA_GIT_REVISION "@NUMA_GIT_REVISION@"
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment