Commit 6ceb8c42 authored by Pawel Sznajder's avatar Pawel Sznajder
Browse files

update versioning mechanism

parent f0e4fffe
...@@ -34,6 +34,13 @@ string(REGEX REPLACE "\\." "" ELEMENTARY_UTILS_VERSION_PATCH ${TMP_STR}) ...@@ -34,6 +34,13 @@ string(REGEX REPLACE "\\." "" ELEMENTARY_UTILS_VERSION_PATCH ${TMP_STR})
message("-- ElementaryUtils version is: " ${ELEMENTARY_UTILS_VERSION_MAJOR} "." ${ELEMENTARY_UTILS_VERSION_MINOR} "." ${ELEMENTARY_UTILS_VERSION_PATCH}) message("-- ElementaryUtils version is: " ${ELEMENTARY_UTILS_VERSION_MAJOR} "." ${ELEMENTARY_UTILS_VERSION_MINOR} "." ${ELEMENTARY_UTILS_VERSION_PATCH})
execute_process(COMMAND bash -c "cd ${CMAKE_SOURCE_DIR}; git branch | grep '\*' | cut -d ' ' -f2 2> /dev/null" OUTPUT_VARIABLE ELEMENTARY_UTILS_GIT_BRANCH)
execute_process(COMMAND bash -c "cd ${CMAKE_SOURCE_DIR}; git rev-parse HEAD 2> /dev/null" OUTPUT_VARIABLE ELEMENTARY_UTILS_GIT_REVISION)
string(REGEX REPLACE "\n$" "" ELEMENTARY_UTILS_GIT_BRANCH "${ELEMENTARY_UTILS_GIT_BRANCH}")
string(REGEX REPLACE "\n$" "" ELEMENTARY_UTILS_GIT_REVISION "${ELEMENTARY_UTILS_GIT_REVISION}")
message("-- Git branch (revision): " ${ELEMENTARY_UTILS_GIT_BRANCH} " (" ${ELEMENTARY_UTILS_GIT_REVISION} ")")
# configure # configure
configure_file(${CMAKE_SOURCE_DIR}/cmake/Version/ElementaryUtilsVersion.h_in ${CMAKE_SOURCE_DIR}/include/ElementaryUtils/ElementaryUtilsVersion.h) configure_file(${CMAKE_SOURCE_DIR}/cmake/Version/ElementaryUtilsVersion.h_in ${CMAKE_SOURCE_DIR}/include/ElementaryUtils/ElementaryUtilsVersion.h)
...@@ -50,6 +57,44 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON) ...@@ -50,6 +57,44 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON)
# find libraries: additional modules # find libraries: additional modules
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/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 libraries: SFML
find_package(SFML COMPONENTS system REQUIRED) find_package(SFML COMPONENTS system REQUIRED)
......
...@@ -7,7 +7,11 @@ ...@@ -7,7 +7,11 @@
* This file is used to define ElementaryUtils version number and it is set by CMake. * This file is used to define ElementaryUtils version number and it is set by CMake.
*/ */
#define ELEMENTARY_UTILS_VERSION(major,minor) (((major) << 8) + (minor)) #define ELEMENTARY_UTILS_VERSION(major,minor,patch) (1000000*major + 1000*minor + patch)
#define ELEMENTARY_UTILS_VERSION_MAJOR @ELEMENTARY_UTILS_VERSION_MAJOR@ #define ELEMENTARY_UTILS_VERSION_MAJOR @ELEMENTARY_UTILS_VERSION_MAJOR@
#define ELEMENTARY_UTILS_VERSION_MINOR @ELEMENTARY_UTILS_VERSION_MINOR@ #define ELEMENTARY_UTILS_VERSION_MINOR @ELEMENTARY_UTILS_VERSION_MINOR@
#define ELEMENTARY_UTILS_VERSION_CODE ELEMENTARY_UTILS_VERSION(ELEMENTARY_UTILS_VERSION_MAJOR, ELEMENTARY_UTILS_VERSION_MINOR) #define ELEMENTARY_UTILS_VERSION_PATCH @ELEMENTARY_UTILS_VERSION_PATCH@
\ No newline at end of file #define ELEMENTARY_UTILS_VERSION_CODE ELEMENTARY_UTILS_VERSION(ELEMENTARY_UTILS_VERSION_MAJOR, ELEMENTARY_UTILS_VERSION_MINOR, ELEMENTARY_UTILS_VERSION_PATCH)
#define ELEMENTARY_UTILS_GIT_BRANCH "@ELEMENTARY_UTILS_GIT_BRANCH@"
#define ELEMENTARY_UTILS_GIT_REVISION "@ELEMENTARY_UTILS_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