From 59ae1dd217a11b58ab16824cbefdf910c8459626 Mon Sep 17 00:00:00 2001 From: jeanlf Date: Fri, 4 Mar 2016 15:22:28 +0100 Subject: [PATCH] Fixed revision.h generation for msvc10 --- build/msvc10/libgpac.vcxproj | 6 ++---- version.bat | 22 ++++++++++++++++++++++ 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/build/msvc10/libgpac.vcxproj b/build/msvc10/libgpac.vcxproj index 9a1a4c73d..3b242034f 100644 --- a/build/msvc10/libgpac.vcxproj +++ b/build/msvc10/libgpac.vcxproj @@ -595,8 +595,7 @@ - - + "$(ProjectDir)..\..\version.bat" /MP %(AdditionalOptions) @@ -635,8 +634,7 @@ - - + "$(ProjectDir)..\..\version.bat" /MP %(AdditionalOptions) diff --git a/version.bat b/version.bat index 23cc86291..c37217c6a 100644 --- a/version.bat +++ b/version.bat @@ -1,6 +1,9 @@ @echo off set OLDDIR=%CD% cd /d %~dp0 + +IF NOT EXIST .\.git\NUL GOTO not_git + for /f "delims=" %%a in ('git describe --tags --long') do @set VERSION=%%a for /f "delims=" %%a in ('git describe --tags --abbrev^=0') do @set TAG=%%a- for /f "delims=" %%a in ('git rev-parse --abbrev-ref HEAD') do @set BRANCH=%%a @@ -9,6 +12,8 @@ setlocal enabledelayedexpansion call set VERSION=%%VERSION:!TAG!=%% setlocal disabledelayedexpansion echo #define GPAC_GIT_REVISION "%VERSION%-%BRANCH%" > test.h + +:write_file if not exist include\gpac\revision.h goto create ECHO n|COMP test.h include\gpac\revision.h > nul if errorlevel 1 goto create @@ -17,6 +22,23 @@ goto done :create MOVE /Y test.h include\gpac\revision.h +goto done + +:not_git +echo "not a git dir" +find /c "-DEV" include\gpac\version.h >nul +if %errorlevel% equ 1 goto rel_tag +echo "unknwon tag" +@echo off +echo #define GPAC_GIT_REVISION "UNKNOWN_REV" > test.h +goto write_file + +:rel_tag +echo "release tag" +@echo off +echo #define GPAC_GIT_REVISION "release" > test.h +goto write_file + :done cd /d %OLDDIR%