-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* tweak about dialog * `d2mapapi_piped` returns init error string
- Loading branch information
Showing
12 changed files
with
175 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
macro(get_project_version VER_PROJ_NAME) | ||
find_package(Git QUIET) | ||
|
||
# Check if git is found... | ||
if (GIT_FOUND) | ||
|
||
# Get last tag from git | ||
execute_process(COMMAND ${GIT_EXECUTABLE} describe --abbrev=0 --tags | ||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} | ||
OUTPUT_VARIABLE ${VER_PROJ_NAME}_VERSION_STRING | ||
OUTPUT_STRIP_TRAILING_WHITESPACE) | ||
|
||
# Get name of current branch | ||
execute_process(COMMAND ${GIT_EXECUTABLE} symbolic-ref --short HEAD | ||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} | ||
OUTPUT_VARIABLE ${VER_PROJ_NAME}_BRANCH_NAME | ||
OUTPUT_STRIP_TRAILING_WHITESPACE) | ||
|
||
#How many commits since last tag | ||
execute_process(COMMAND ${GIT_EXECUTABLE} rev-list ${${VER_PROJ_NAME}_BRANCH_NAME} ${${VER_PROJ_NAME}_VERSION_STRING}..HEAD --count | ||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} | ||
OUTPUT_VARIABLE ${VER_PROJ_NAME}_VERSION_AHEAD | ||
OUTPUT_STRIP_TRAILING_WHITESPACE) | ||
|
||
# Get current commit SHA from git | ||
execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD | ||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} | ||
OUTPUT_VARIABLE ${VER_PROJ_NAME}_VERSION_GIT_SHA | ||
OUTPUT_STRIP_TRAILING_WHITESPACE) | ||
|
||
# Get partial versions into a list | ||
string(REGEX MATCHALL "-.*$|[0-9]+" ${VER_PROJ_NAME}_PARTIAL_VERSION_LIST | ||
${${VER_PROJ_NAME}_VERSION_STRING}) | ||
|
||
# Set the version numbers | ||
list(GET ${VER_PROJ_NAME}_PARTIAL_VERSION_LIST | ||
0 ${VER_PROJ_NAME}_VERSION_MAJOR) | ||
list(GET ${VER_PROJ_NAME}_PARTIAL_VERSION_LIST | ||
1 ${VER_PROJ_NAME}_VERSION_MINOR) | ||
list(GET ${VER_PROJ_NAME}_PARTIAL_VERSION_LIST | ||
2 ${VER_PROJ_NAME}_VERSION_PATCH) | ||
|
||
# The tweak part is optional, so check if the list contains it | ||
list(LENGTH ${VER_PROJ_NAME}_PARTIAL_VERSION_LIST | ||
${VER_PROJ_NAME}_PARTIAL_VERSION_LIST_LEN) | ||
if (${VER_PROJ_NAME}_PARTIAL_VERSION_LIST_LEN GREATER 3) | ||
list(GET ${VER_PROJ_NAME}_PARTIAL_VERSION_LIST 3 ${VER_PROJ_NAME}_VERSION_TWEAK) | ||
string(SUBSTRING ${${VER_PROJ_NAME}_VERSION_TWEAK} 1 -1 ${VER_PROJ_NAME}_VERSION_TWEAK) | ||
endif() | ||
|
||
# Unset the list | ||
unset(${VER_PROJ_NAME}_PARTIAL_VERSION_LIST) | ||
|
||
# Save version to file (which will be used when Git is not available | ||
# or VERSION_UPDATE_FROM_GIT is disabled) | ||
file(WRITE ${CMAKE_CURRENT_SOURCE_DIR}/version_generated ${${VER_PROJ_NAME}_VERSION_STRING} | ||
"*" ${${VER_PROJ_NAME}_VERSION_MAJOR} | ||
"*" ${${VER_PROJ_NAME}_VERSION_MINOR} | ||
"*" ${${VER_PROJ_NAME}_VERSION_PATCH} | ||
"*" ${${VER_PROJ_NAME}_VERSION_TWEAK} | ||
"*" ${${VER_PROJ_NAME}_VERSION_AHEAD} | ||
"*" ${${VER_PROJ_NAME}_VERSION_GIT_SHA}) | ||
|
||
else() | ||
|
||
# Git not available, get version from file | ||
file(STRINGS ${CMAKE_CURRENT_SOURCE_DIR}/version_generated ${VER_PROJ_NAME}_VERSION_LIST) | ||
string(REPLACE "*" ";" ${VER_PROJ_NAME}_VERSION_LIST "${${VER_PROJ_NAME}_VERSION_LIST}") | ||
# Set partial versions | ||
list(GET ${VER_PROJ_NAME}_VERSION_LIST 0 ${VER_PROJ_NAME}_VERSION_STRING) | ||
list(GET ${VER_PROJ_NAME}_VERSION_LIST 1 ${VER_PROJ_NAME}_VERSION_MAJOR) | ||
list(GET ${VER_PROJ_NAME}_VERSION_LIST 2 ${VER_PROJ_NAME}_VERSION_MINOR) | ||
list(GET ${VER_PROJ_NAME}_VERSION_LIST 3 ${VER_PROJ_NAME}_VERSION_PATCH) | ||
list(GET ${VER_PROJ_NAME}_VERSION_LIST 4 ${VER_PROJ_NAME}_VERSION_TWEAK) | ||
list(GET ${VER_PROJ_NAME}_VERSION_LIST 5 ${VER_PROJ_NAME}_VERSION_AHEAD) | ||
list(GET ${VER_PROJ_NAME}_VERSION_LIST 6 ${VER_PROJ_NAME}_VERSION_GIT_SHA) | ||
|
||
endif() | ||
|
||
# Set full project version string | ||
if (${VER_PROJ_NAME}_VERSION_AHEAD GREATER 0) | ||
set(${VER_PROJ_NAME}_VERSION_STRING_FULL | ||
${${VER_PROJ_NAME}_VERSION_STRING}+${${VER_PROJ_NAME}_VERSION_AHEAD}.${${VER_PROJ_NAME}_VERSION_GIT_SHA}) | ||
else() | ||
set(${VER_PROJ_NAME}_VERSION_STRING_FULL | ||
${${VER_PROJ_NAME}_VERSION_STRING}.${${VER_PROJ_NAME}_VERSION_GIT_SHA}) | ||
endif() | ||
|
||
# Set project version (without the preceding 'v') | ||
set(${VER_PROJ_NAME}_VERSION ${${VER_PROJ_NAME}_VERSION_MAJOR}.${${VER_PROJ_NAME}_VERSION_MINOR}.${${VER_PROJ_NAME}_VERSION_PATCH}) | ||
if (${VER_PROJ_NAME}_VERSION_TWEAK) | ||
set(${VER_PROJ_NAME}_VERSION ${${VER_PROJ_NAME}_VERSION}-${${VER_PROJ_NAME}_VERSION_TWEAK}) | ||
endif() | ||
|
||
target_compile_definitions(${VER_PROJ_NAME} PRIVATE | ||
VERSION_STRING_FULL="${${VER_PROJ_NAME}_VERSION_STRING_FULL}" | ||
VERSION_STRING="${${VER_PROJ_NAME}_VERSION_STRING}" | ||
VERSION_MAJOR=${${VER_PROJ_NAME}_VERSION_MAJOR} | ||
VERSION_MINOR=${${VER_PROJ_NAME}_VERSION_MINOR} | ||
VERSION_PATCH=${${VER_PROJ_NAME}_VERSION_PATCH} | ||
VERSION_TWEAK="${${VER_PROJ_NAME}_VERSION_TWEAK}" | ||
VERSION_AHEAD="${${VER_PROJ_NAME}_VERSION_AHEAD}" | ||
VERSION_GIT_SHA="${${VER_PROJ_NAME}_VERSION_GIT_SHA}" | ||
) | ||
endmacro() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,14 +2,15 @@ | |
|
||
#include "winres.h" | ||
|
||
101 DIALOG DISCARDABLE 0, 0, 240, 130 | ||
101 DIALOG DISCARDABLE 0, 0, 240, 155 | ||
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | ||
CAPTION "About D2RMH" | ||
FONT 10, "Arial Bold" | ||
BEGIN | ||
LTEXT "D2RMH, a map revealing tool for Diablo II Resurrected",IDC_STATIC,20,20,200,10 | ||
LTEXT "by Soar Qin <[email protected]>",IDC_STATIC,70,35,150,10 | ||
DEFPUSHBUTTON "OK",IDOK,100,103,40,12 | ||
CONTROL "Project page: <a href=""https://github.com/soarqin/D2RMH"">https://github.com/soarqin/D2RMH</a>",1001,"SysLink",WS_TABSTOP,20,65,200,10 | ||
CONTROL "New releases: <a href=""https://github.com/soarqin/D2RMH/releases"">https://github.com/soarqin/D2RMH/releases</a>",1002,"SysLink",WS_TABSTOP,20,80,200,10 | ||
LTEXT "D2RMH",1000,20,20,200,20,SS_CENTER | ||
LTEXT "a map revealing tool for Diablo II Resurrected",IDC_STATIC,20,45,200,10,SS_CENTER | ||
LTEXT "by Soar Qin<[email protected]>",IDC_STATIC,20,60,200,10,SS_CENTER | ||
DEFPUSHBUTTON "OK",IDOK,100,128,40,12 | ||
CONTROL "Project page: <a href=""https://github.com/soarqin/D2RMH"">https://github.com/soarqin/D2RMH</a>",1001,"SysLink",WS_TABSTOP,20,90,200,10 | ||
CONTROL "New releases: <a href=""https://github.com/soarqin/D2RMH/releases"">https://github.com/soarqin/D2RMH/releases</a>",1002,"SysLink",WS_TABSTOP,20,105,200,10 | ||
END |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters