Skip to content

Commit

Permalink
improve: git version generation will no longer be done at build time
Browse files Browse the repository at this point in the history
now use: tools/generate_git_version.bat
  • Loading branch information
mehah committed Feb 28, 2023
1 parent 3b3e55f commit 9c2195e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 30 deletions.
13 changes: 13 additions & 0 deletions tools/generate_git_version.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
WHERE git
IF %ERRORLEVEL% EQU 0 (
IF EXIST ../.git/ (
echo | set /p dummyName=#define GIT_BRANCH > ../src/gitinfo.h
git rev-parse --abbrev-ref HEAD >> ../src/gitinfo.h

echo | set /p dummyName=#define GIT_VERSION >> ../src/gitinfo.h
git describe --abbrev=0 --tag >> ../src/gitinfo.h

echo | set /p dummyName=#define GIT_COMMITS >> ../src/gitinfo.h
git rev-list --count head >> ../src/gitinfo.h
)
)
33 changes: 3 additions & 30 deletions vc17/otclient.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -169,20 +169,7 @@ cmd /c "start ../vcpkg_installed\$(VcpkgTriplet)\$(VcpkgTriplet)\tools\protobuf\
</Link>
<PreBuildEvent>
<Command>if NOT EXIST "../src/protobuf/appearances.pb.cc" (
cmd /c "start ../vcpkg_installed\$(VcpkgTriplet)\$(VcpkgTriplet)\tools\protobuf\protoc" --cpp_out=../src/protobuf/ --proto_path=../src/protobuf/ appearances.proto
)
WHERE git
IF %ERRORLEVEL% EQU 0 (
IF EXIST ../.git/ (
echo | set /p dummyName=#define GIT_BRANCH &gt; ../src/gitinfo.h
git rev-parse --abbrev-ref HEAD &gt;&gt; ../src/gitinfo.h

echo | set /p dummyName=#define GIT_VERSION &gt;&gt; ../src/gitinfo.h
git describe --abbrev=0 --tag &gt;&gt; ../src/gitinfo.h

echo | set /p dummyName=#define GIT_COMMITS &gt;&gt; ../src/gitinfo.h
git rev-list --count head &gt;&gt; ../src/gitinfo.h
)
cmd /c "start ../vcpkg_installed\$(VcpkgTriplet)\$(VcpkgTriplet)\tools\protobuf\protoc" --cpp_out=../src/protobuf/ --proto_path=../src/protobuf/ appearances.proto
)
</Command>
</PreBuildEvent>
Expand All @@ -208,22 +195,8 @@ IF %ERRORLEVEL% EQU 0 (
</Link>
<PreBuildEvent>
<Command>if NOT EXIST "../src/protobuf/appearances.pb.cc" (
cmd /c "start ../vcpkg_installed\$(VcpkgTriplet)\$(VcpkgTriplet)\tools\protobuf\protoc" --cpp_out=../src/protobuf/ --proto_path=../src/protobuf/ appearances.proto
)
WHERE git
IF %ERRORLEVEL% EQU 0 (
IF EXIST ../.git/ (
echo | set /p dummyName=#define GIT_BRANCH &gt; ../src/gitinfo.h
git rev-parse --abbrev-ref HEAD &gt;&gt; ../src/gitinfo.h

echo | set /p dummyName=#define GIT_VERSION &gt;&gt; ../src/gitinfo.h
git describe --abbrev=0 --tag &gt;&gt; ../src/gitinfo.h

echo | set /p dummyName=#define GIT_COMMITS &gt;&gt; ../src/gitinfo.h
git rev-list --count head &gt;&gt; ../src/gitinfo.h
)
)
</Command>
cmd /c "start ../vcpkg_installed\$(VcpkgTriplet)\$(VcpkgTriplet)\tools\protobuf\protoc" --cpp_out=../src/protobuf/ --proto_path=../src/protobuf/ appearances.proto
)</Command>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
Expand Down

0 comments on commit 9c2195e

Please sign in to comment.