mirror of
https://github.com/swaywm/sway.git
synced 2024-11-10 20:44:01 +01:00
Added in build version based on git hash
This commit is contained in:
parent
e121258426
commit
38cfdf99f4
@ -5,6 +5,20 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "bin/")
|
|||||||
add_definitions("-Wall -Wextra -Wno-unused-parameter")
|
add_definitions("-Wall -Wextra -Wno-unused-parameter")
|
||||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/CMake)
|
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/CMake)
|
||||||
|
|
||||||
|
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git")
|
||||||
|
execute_process(
|
||||||
|
COMMAND git log -1 --format=%h
|
||||||
|
OUTPUT_VARIABLE GIT_COMMIT_HASH
|
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||||
|
)
|
||||||
|
else(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git")
|
||||||
|
set(GIT_COMMIT_HASH "Not Found")
|
||||||
|
endif(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git")
|
||||||
|
|
||||||
|
SET(GIT_VERSION_FLAG "-DSWAY_GIT_VERSION=\"${GIT_COMMIT_HASH}\"")
|
||||||
|
|
||||||
|
add_definitions("${GIT_VERSION_FLAG}")
|
||||||
|
|
||||||
find_package(XKBCommon REQUIRED)
|
find_package(XKBCommon REQUIRED)
|
||||||
find_package(WLC REQUIRED)
|
find_package(WLC REQUIRED)
|
||||||
find_package(A2X REQUIRED)
|
find_package(A2X REQUIRED)
|
||||||
|
@ -78,7 +78,11 @@ int main(int argc, char **argv) {
|
|||||||
debug = 1;
|
debug = 1;
|
||||||
break;
|
break;
|
||||||
case 'v': // version
|
case 'v': // version
|
||||||
// todo
|
#ifdef SWAY_GIT_VERSION
|
||||||
|
fprintf(stdout, "sway build %s\n", SWAY_GIT_VERSION);
|
||||||
|
#else
|
||||||
|
fprintf(stdout, "version not detected\n");
|
||||||
|
#endif
|
||||||
exit(0);
|
exit(0);
|
||||||
break;
|
break;
|
||||||
case 'V': // verbose
|
case 'V': // verbose
|
||||||
|
Loading…
Reference in New Issue
Block a user