1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

chore(cmake): Added git definitions

This commit is contained in:
Diadlo 2016-11-23 00:33:00 +03:00
parent b3bfd46e2d
commit ba872e02af
No known key found for this signature in database
GPG Key ID: 5AF9F2E29107C727
3 changed files with 58 additions and 8 deletions

2
.gitignore vendored
View File

@ -40,7 +40,7 @@ _testmain.go
/qtox.app
# Qt
*.pro.user*
*.user
moc_*
ui_*
qrc_*

View File

@ -22,6 +22,7 @@ execute_process(
COMMAND brew --prefix qt5
OUTPUT_VARIABLE QT_PREFIX_PATH
OUTPUT_STRIP_TRAILING_WHITESPACE)
if(NOT QT_PREFIX_PATH)
set(QT_PREFIX_PATH
/usr/src/mxe/usr/x86_64-w64-mingw32.shared/qt5
@ -115,11 +116,23 @@ qt5_add_translation(${PROJECT_NAME}_QM_FILES
translations/zh.ts
)
qt5_add_resources(${PROJECT_NAME}_RESOURCES
qt5_add_resources(
${PROJECT_NAME}_RESOURCES
res.qrc
smileys/smileys.qrc
${CMAKE_CURRENT_BINARY_DIR}/translations.qrc
DEPENDS ${${PROJECT_NAME}_QM_FILES})
DEPENDS ${${PROJECT_NAME}_QM_FILES}
)
if(NOT ${SMILEYS})
set(SMILEYS, "")
endif()
if(NOT ${SMILEYS} MATCHES "NO")
qt5_add_resources(smileys/emojione.qrc)
if(NOT ${SMILEYS} MATCHES "MIN")
qt5_add_resources(smileys/smileys.qrc)
endif()
endif()
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/translations.qrc.in"
"<!DOCTYPE RCC>

View File

@ -111,9 +111,46 @@ if(WIN32)
search_dependency(STRMIIDS LIBRARY strmiids)
endif()
execute_process(
COMMAND git describe --tags
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE GIT_DESCRIBE
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if(NOT GIT_DESCRIBE)
set(GIT_DESCRIBE "Nightly")
endif()
add_definitions(
-DGIT_DESCRIBE="${GIT_DESCRIBE}"
)
# GIT_VERSION
execute_process(
COMMAND git rev-parse HEAD
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE GIT_VERSION
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if(NOT GIT_VERSION)
set(GIT_VERSION "build without git")
endif()
add_definitions(
-DGIT_VERSION="${GIT_VERSION}"
)
execute_process(
COMMAND date +%s
OUTPUT_VARIABLE TIMESTAMP
)
add_definitions(
-DTIMESTAMP=${TIMESTAMP}
-DLOG_TO_FILE=1
-DQTOX_PLATFORM_EXT=1
-DGIT_COMMIT="N/A"
-DGIT_DESCRIBE="N/A"
-DGIT_VERSION="N/A"
-DTIMESTAMP="N/A")
)