Skip to content

Commit 29a3138

Browse files
fix: version
1 parent 65c6fbd commit 29a3138

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

.github/workflows/release.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,8 @@ jobs:
330330
331331
# Use cmd to call vcvarsall and then cl
332332
$outName = "win-witr-${{ matrix.arch }}.exe"
333-
cmd /c "`"$vcvarsPath`" $vcvarsArch && cl /O2 /Ot /GL /std:c++20 /EHsc main.cpp /DUNICODE /D_UNICODE /Fe:$outName"
333+
$ver = "${{ needs.prepare.outputs.version_number }}"
334+
cmd /c "`"$vcvarsPath`" $vcvarsArch && cl /O2 /Ot /GL /std:c++20 /EHsc main.cpp /DUNICODE /D_UNICODE /DVERSION_NUMBER=\"$ver\" /Fe:$outName"
334335
if ($LASTEXITCODE -ne 0) {
335336
Write-Host "Build failed with exit code $LASTEXITCODE"
336337
Exit $LASTEXITCODE

main.cpp

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -94,15 +94,11 @@ Less words to type ;)
9494
*/
9595
std::string forkAuthor = ""; // if this is a fork of this project, put your name here! Please be nice and leave my name too :)
9696
std::string version = []() {
97-
`#ifdef` VERSION_NUMBER
98-
return std::string(VERSION_NUMBER);
99-
`#else`
100-
char buf[256];
101-
if (GetEnvironmentVariableA("VERSION_NUMBER", buf, sizeof(buf)) > 0) {
102-
return std::string(buf);
103-
}
104-
return std::string("v0.1.0");
105-
`#endif`
97+
#ifdef VERSION_NUMBER
98+
return std::string(VERSION_NUMBER); // Release builds only
99+
#else
100+
return std::string("dev-build"); // Local builds - no env var check
101+
#endif
106102
}();
107103
thread_local std::string currentParentExe = ""; // to store the name of our own parent process for error hints
108104

0 commit comments

Comments
 (0)