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:
parent
b3bfd46e2d
commit
ba872e02af
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -40,7 +40,7 @@ _testmain.go
|
||||||
/qtox.app
|
/qtox.app
|
||||||
|
|
||||||
# Qt
|
# Qt
|
||||||
*.pro.user*
|
*.user
|
||||||
moc_*
|
moc_*
|
||||||
ui_*
|
ui_*
|
||||||
qrc_*
|
qrc_*
|
||||||
|
|
|
@ -22,6 +22,7 @@ execute_process(
|
||||||
COMMAND brew --prefix qt5
|
COMMAND brew --prefix qt5
|
||||||
OUTPUT_VARIABLE QT_PREFIX_PATH
|
OUTPUT_VARIABLE QT_PREFIX_PATH
|
||||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
|
|
||||||
if(NOT QT_PREFIX_PATH)
|
if(NOT QT_PREFIX_PATH)
|
||||||
set(QT_PREFIX_PATH
|
set(QT_PREFIX_PATH
|
||||||
/usr/src/mxe/usr/x86_64-w64-mingw32.shared/qt5
|
/usr/src/mxe/usr/x86_64-w64-mingw32.shared/qt5
|
||||||
|
@ -115,11 +116,23 @@ qt5_add_translation(${PROJECT_NAME}_QM_FILES
|
||||||
translations/zh.ts
|
translations/zh.ts
|
||||||
)
|
)
|
||||||
|
|
||||||
qt5_add_resources(${PROJECT_NAME}_RESOURCES
|
qt5_add_resources(
|
||||||
|
${PROJECT_NAME}_RESOURCES
|
||||||
res.qrc
|
res.qrc
|
||||||
smileys/smileys.qrc
|
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/translations.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"
|
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/translations.qrc.in"
|
||||||
"<!DOCTYPE RCC>
|
"<!DOCTYPE RCC>
|
||||||
|
|
|
@ -111,9 +111,46 @@ if(WIN32)
|
||||||
search_dependency(STRMIIDS LIBRARY strmiids)
|
search_dependency(STRMIIDS LIBRARY strmiids)
|
||||||
endif()
|
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(
|
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
|
-DQTOX_PLATFORM_EXT=1
|
||||||
-DGIT_COMMIT="N/A"
|
)
|
||||||
-DGIT_DESCRIBE="N/A"
|
|
||||||
-DGIT_VERSION="N/A"
|
|
||||||
-DTIMESTAMP="N/A")
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user