mirror of
https://github.com/vgmstream/vgmstream.git
synced 2024-11-27 16:10:48 +01:00
builds: modify how version.h is used to fix issues
- version.h is now static (should increase on new releases) - if compiler flag is passed, will try to use version_auto.h (autogen) (auto only on compiler flag to avoid include'ing a non-existant file) - avoid clobbered version.h as may force recompiles
This commit is contained in:
parent
372cd75076
commit
0b14f9a446
2
.gitignore
vendored
2
.gitignore
vendored
@ -44,7 +44,7 @@ Release
|
||||
/xmplay/Release
|
||||
/xmplay/*.dll
|
||||
/dependencies
|
||||
/version.h
|
||||
/version_auto.h
|
||||
/msvc-build.config.ps1
|
||||
|
||||
/**/vgmstream-win.zip
|
||||
|
@ -88,10 +88,10 @@ if(MSVC)
|
||||
else()
|
||||
set(VGM_VERSION_GENERATOR version-make.sh)
|
||||
endif()
|
||||
add_custom_command(OUTPUT ${VGM_SOURCE_DIR}/version.h
|
||||
add_custom_command(OUTPUT ${VGM_SOURCE_DIR}/version_auto.h
|
||||
COMMAND "${VGM_SOURCE_DIR}/${VGM_VERSION_GENERATOR}"
|
||||
DEPENDS ${VGM_SOURCE_DIR}/${VGM_VERSION_GENERATOR})
|
||||
add_custom_target(version_h ALL DEPENDS ${VGM_SOURCE_DIR}/version.h)
|
||||
add_custom_target(version_h ALL DEPENDS ${VGM_SOURCE_DIR}/version_auto.h)
|
||||
|
||||
# FFmpeg detection
|
||||
if(USE_FFMPEG)
|
||||
|
@ -9,4 +9,4 @@ if HAVE_AUDACIOUS
|
||||
SUBDIRS += audacious
|
||||
endif
|
||||
|
||||
EXTRA_DIST = version.h
|
||||
EXTRA_DIST = version_auto.h
|
||||
|
@ -72,7 +72,7 @@
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>..;../ext_libs/Getopt;../ext_includes;../ext_includes/ffmpeg;$(DependenciesDir)/qaac/mp4v2/include;$(DependenciesDir)/fdk-aac/libSYS/include;$(DependenciesDir)/fdk-aac/libAACdec/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;VGM_USE_VORBIS;VGM_USE_MPEG;VGM_USE_FFMPEG;VGM_USE_G7221;VGM_USE_ATRAC9;VGM_USE_CELT;VGM_USE_SPEEX;HAVE_JSON;_DEBUG;_WINDOWS;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>WIN32;VGMSTREAM_VERSION_AUTO;VGM_USE_VORBIS;VGM_USE_MPEG;VGM_USE_FFMPEG;VGM_USE_G7221;VGM_USE_ATRAC9;VGM_USE_CELT;VGM_USE_SPEEX;HAVE_JSON;_DEBUG;_WINDOWS;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<PrecompiledHeader>
|
||||
@ -97,7 +97,7 @@
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>..;../ext_libs/Getopt;../ext_includes;../ext_includes/ffmpeg;$(DependenciesDir)/qaac/mp4v2/include;$(DependenciesDir)/fdk-aac/libSYS/include;$(DependenciesDir)/fdk-aac/libAACdec/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;VGM_USE_VORBIS;VGM_USE_MPEG;VGM_USE_FFMPEG;VGM_USE_G7221;VGM_USE_ATRAC9;VGM_USE_CELT;VGM_USE_SPEEX;HAVE_JSON;NDEBUG;_WINDOWS;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>WIN32;VGMSTREAM_VERSION_AUTO;VGM_USE_VORBIS;VGM_USE_MPEG;VGM_USE_FFMPEG;VGM_USE_G7221;VGM_USE_ATRAC9;VGM_USE_CELT;VGM_USE_SPEEX;HAVE_JSON;NDEBUG;_WINDOWS;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
|
@ -71,7 +71,7 @@
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>..;../ext_includes;../ext_includes/ffmpeg;$(DependenciesDir)/WTL/Include;$(DependenciesDir)/foobar/foobar2000/SDK;$(DependenciesDir)/foobar/foobar2000/shared;$(DependenciesDir)/foobar/foobar2000;$(DependenciesDir)/qaac/mp4v2/include;$(DependenciesDir)/fdk-aac/libSYS/include;$(DependenciesDir)/fdk-aac/libAACdec/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;VGM_USE_VORBIS;VGM_USE_MPEG;VGM_USE_FFMPEG;VGM_USE_G7221;VGM_USE_ATRAC9;VGM_USE_CELT;VGM_USE_SPEEX;_DEBUG;_WINDOWS;_USRDLL;IN_VGMSTREAM_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>WIN32;VGMSTREAM_VERSION_AUTO;VGM_USE_VORBIS;VGM_USE_MPEG;VGM_USE_FFMPEG;VGM_USE_G7221;VGM_USE_ATRAC9;VGM_USE_CELT;VGM_USE_SPEEX;_DEBUG;_WINDOWS;_USRDLL;IN_VGMSTREAM_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<PrecompiledHeader>
|
||||
@ -97,7 +97,7 @@
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>..;../ext_includes;../ext_includes/ffmpeg;$(DependenciesDir)/WTL/Include;$(DependenciesDir)/foobar/foobar2000/SDK;$(DependenciesDir)/foobar/foobar2000/shared;$(DependenciesDir)/foobar/foobar2000;$(DependenciesDir)/qaac/mp4v2/include;$(DependenciesDir)/fdk-aac/libSYS/include;$(DependenciesDir)/fdk-aac/libAACdec/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;VGM_USE_VORBIS;VGM_USE_MPEG;VGM_USE_FFMPEG;VGM_USE_G7221;VGM_USE_ATRAC9;VGM_USE_CELT;VGM_USE_SPEEX;NDEBUG;_WINDOWS;_USRDLL;IN_VGMSTREAM_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>WIN32;VGMSTREAM_VERSION_AUTO;VGM_USE_VORBIS;VGM_USE_MPEG;VGM_USE_FFMPEG;VGM_USE_G7221;VGM_USE_ATRAC9;VGM_USE_CELT;VGM_USE_SPEEX;NDEBUG;_WINDOWS;_USRDLL;IN_VGMSTREAM_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
|
@ -59,7 +59,7 @@
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>../ext_includes;../ext_includes/ffmpeg;$(DependenciesDir)/qaac/mp4v2/include;$(DependenciesDir)/fdk-aac/libSYS/include;$(DependenciesDir)/fdk-aac/libAACdec/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;VGM_USE_VORBIS;VGM_USE_MPEG;VGM_USE_FFMPEG;VGM_USE_G7221;VGM_USE_G719;VGM_USE_ATRAC9;VGM_USE_CELT;VGM_USE_SPEEX;USE_ALLOCA;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>WIN32;VGMSTREAM_VERSION_AUTO;VGM_USE_VORBIS;VGM_USE_MPEG;VGM_USE_FFMPEG;VGM_USE_G7221;VGM_USE_G719;VGM_USE_ATRAC9;VGM_USE_CELT;VGM_USE_SPEEX;USE_ALLOCA;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<PrecompiledHeader>
|
||||
@ -72,7 +72,7 @@
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>../ext_includes;../ext_includes/ffmpeg;$(DependenciesDir)/qaac/mp4v2/include;$(DependenciesDir)/fdk-aac/libSYS/include;$(DependenciesDir)/fdk-aac/libAACdec/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_WIN32_WINNT=0x501;WIN32;VGM_USE_VORBIS;VGM_USE_MPEG;VGM_USE_FFMPEG;VGM_USE_G7221;VGM_USE_G719;VGM_USE_ATRAC9;VGM_USE_CELT;VGM_USE_SPEEX;USE_ALLOCA;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>_WIN32_WINNT=0x501;WIN32;VGMSTREAM_VERSION_AUTO;VGM_USE_VORBIS;VGM_USE_MPEG;VGM_USE_FFMPEG;VGM_USE_G7221;VGM_USE_G719;VGM_USE_ATRAC9;VGM_USE_CELT;VGM_USE_SPEEX;USE_ALLOCA;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
|
@ -1,6 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
# echo current git version (doesn't make version.h)
|
||||
# echo current git version (doesn't make version_auto.h)
|
||||
|
||||
# test if git exists
|
||||
if ! command -v git > /dev/null
|
||||
|
@ -1,37 +1,47 @@
|
||||
@echo off
|
||||
setlocal enableextensions enabledelayedexpansion
|
||||
|
||||
REM creates or updates version.h
|
||||
REM params: $1=filename (usually version.h), $2=VARNAME (usually VGMSTREAM_VERSION)
|
||||
REM creates or updates version_auto.h
|
||||
REM params: $1=filename (usually version_auto.h), $2=VARNAME (usually VGMSTREAM_VERSION)
|
||||
|
||||
|
||||
REM defaults
|
||||
set VERSION_DEFAULT=unknown
|
||||
set VERSION_FILE=%1
|
||||
set VERSION_NAME=%2
|
||||
if "%~1" == "" set VERSION_FILE=version.h
|
||||
if "%~1" == "" set VERSION_FILE=version_auto.h
|
||||
if "%~2" == "" set VERSION_NAME=VGMSTREAM_VERSION
|
||||
|
||||
if not "%version%"=="" set version=!version:^:=_!
|
||||
if not "%VERSION%"=="" set VERSION=!VERSION:^:=_!
|
||||
|
||||
cd /d "%~dp0"
|
||||
|
||||
|
||||
REM try get version from Git, leave original version.h untouched if not possible
|
||||
for /f %%v in ('git describe --always') do set version=%%v
|
||||
|
||||
if not "%version%"=="" set version=!version:^:=_!
|
||||
if not "%version%"=="" goto :got_version
|
||||
|
||||
echo Git version not found, can't autogenerate version.h
|
||||
REM try get version from Git (dynamic)
|
||||
:get_version_git
|
||||
for /f %%v in ('git describe --always') do set VERSION=%%v
|
||||
if not "%VERSION%"=="" set VERSION=!VERSION:^:=_!
|
||||
if "%VERSION%"=="" goto :get_version_h
|
||||
if %VERSION%==%VERSION_DEFAULT% goto :get_version_h
|
||||
set LINE=#define %VERSION_NAME% "%VERSION%" /* autogenerated */
|
||||
echo %LINE% > %VERSION_FILE%
|
||||
goto :exit
|
||||
|
||||
|
||||
REM overwrite version.h
|
||||
:got_version
|
||||
if %version%==%VERSION_DEFAULT% goto :exit
|
||||
REM try to get version from version.h (static)
|
||||
:get_version_h
|
||||
echo Git version not found, can't autogenerate version_auto.h
|
||||
set LINE=#define %VERSION_NAME% "%VERSION_DEFAULT%" /* autogenerated */
|
||||
if exist "version.h" (
|
||||
for /F "tokens=*" %%v in (version.h) do (
|
||||
set TOKEN=%%v
|
||||
REM set COMP=#define %VERSION_NAME% #todo
|
||||
if /i "!TOKEN:~0,25!"=="#define VGMSTREAM_VERSION" set LINE=%%v
|
||||
)
|
||||
)
|
||||
|
||||
echo #define %VERSION_NAME% "%version%" /* autogenerated */ > %VERSION_FILE%
|
||||
echo %LINE% > %VERSION_FILE%
|
||||
goto :exit
|
||||
|
||||
|
||||
REM done
|
||||
|
@ -1,8 +1,8 @@
|
||||
#!/bin/sh
|
||||
|
||||
# make current git version (overwrites version.h)
|
||||
# make current git version (overwrites version_auto.h)
|
||||
VERSION_NAME=VGMSTREAM_VERSION
|
||||
VERSION_FILE=version.h
|
||||
VERSION_FILE=version_auto.h
|
||||
|
||||
|
||||
# test if git exists
|
||||
@ -17,5 +17,5 @@ fi
|
||||
if [[ $VERSION != fatal* ]] && [ ! -z "$VERSION" ] ; then
|
||||
echo "#define $VERSION_NAME \"$VERSION\" /* autogenerated */" > $VERSION_FILE
|
||||
else
|
||||
echo "Git version not found, can't autogenerate version.h"
|
||||
echo "Git version not found, can't autogenerate version_auto.h"
|
||||
fi;
|
||||
|
18
version.h
18
version.h
@ -1,4 +1,18 @@
|
||||
#ifndef _VGMSTREAM_H_
|
||||
#define _VGMSTREAM_H_
|
||||
/* autogenerated version passed by param */
|
||||
//todo detect if VGMSTREAM_VERSION is "" (may happen on script error)
|
||||
#ifndef VGMSTREAM_VERSION
|
||||
/* autogenerated version on file */
|
||||
#ifdef VGMSTREAM_VERSION_AUTO
|
||||
#include "version_auto.h"
|
||||
#else
|
||||
/* Static/fallback version.
|
||||
* Version is autogenerated from Git (passed via compiler args, or updated with scripts), but this file is
|
||||
* for Git-less builds (not installed or downloaded master) and builds that don't do the above should still work. */
|
||||
#define VGMSTREAM_VERSION "unknown"
|
||||
* for Git-less builds (not installed or downloaded master) and builds that don't do the above should still work
|
||||
* (compiling a well-behaved src shouldn't depend on calling arbitrary scripts). */
|
||||
#define VGMSTREAM_VERSION "r1050"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -71,7 +71,7 @@
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>..;../ext_includes;../ext_includes/ffmpeg;$(DependenciesDir)/qaac/mp4v2/include;$(DependenciesDir)/fdk-aac/libSYS/include;$(DependenciesDir)/fdk-aac/libAACdec/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;VGM_USE_VORBIS;VGM_USE_MPEG;VGM_USE_FFMPEG;VGM_USE_G7221;VGM_USE_ATRAC9;VGM_USE_CELT;VGM_USE_SPEEX;_DEBUG;_WINDOWS;_USRDLL;IN_VGMSTREAM_EXPORTS;VGM_WINAMP_UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>WIN32;VGMSTREAM_VERSION_AUTO;VGM_USE_VORBIS;VGM_USE_MPEG;VGM_USE_FFMPEG;VGM_USE_G7221;VGM_USE_ATRAC9;VGM_USE_CELT;VGM_USE_SPEEX;_DEBUG;_WINDOWS;_USRDLL;IN_VGMSTREAM_EXPORTS;VGM_WINAMP_UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<PrecompiledHeader>
|
||||
@ -98,7 +98,7 @@
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>..;../ext_includes;../ext_includes/ffmpeg;$(DependenciesDir)/qaac/mp4v2/include;$(DependenciesDir)/fdk-aac/libSYS/include;$(DependenciesDir)/fdk-aac/libAACdec/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;VGM_USE_VORBIS;VGM_USE_MPEG;VGM_USE_FFMPEG;VGM_USE_G7221;VGM_USE_ATRAC9;VGM_USE_CELT;VGM_USE_SPEEX;NDEBUG;_WINDOWS;_USRDLL;IN_VGMSTREAM_EXPORTS;VGM_WINAMP_UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>WIN32;VGMSTREAM_VERSION_AUTO;VGM_USE_VORBIS;VGM_USE_MPEG;VGM_USE_FFMPEG;VGM_USE_G7221;VGM_USE_ATRAC9;VGM_USE_CELT;VGM_USE_SPEEX;NDEBUG;_WINDOWS;_USRDLL;IN_VGMSTREAM_EXPORTS;VGM_WINAMP_UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
|
@ -62,7 +62,7 @@
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>..;../ext_includes;../ext_includes/ffmpeg;$(DependenciesDir)/qaac/mp4v2/include;$(DependenciesDir)/fdk-aac/libSYS/include;$(DependenciesDir)/fdk-aac/libAACdec/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;VGM_USE_VORBIS;VGM_USE_MPEG;VGM_USE_FFMPEG;VGM_USE_G7221;VGM_USE_ATRAC9;VGM_USE_CELT;VGM_USE_SPEEX;_DEBUG;_WINDOWS;_USRDLL;IN_VGMSTREAM_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>WIN32;VGMSTREAM_VERSION_AUTO;VGM_USE_VORBIS;VGM_USE_MPEG;VGM_USE_FFMPEG;VGM_USE_G7221;VGM_USE_ATRAC9;VGM_USE_CELT;VGM_USE_SPEEX;_DEBUG;_WINDOWS;_USRDLL;IN_VGMSTREAM_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
@ -86,7 +86,7 @@
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>..;../ext_includes;../ext_includes/ffmpeg;$(DependenciesDir)/qaac/mp4v2/include;$(DependenciesDir)/fdk-aac/libSYS/include;$(DependenciesDir)/fdk-aac/libAACdec/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_WIN32_WINNT=0x501;WIN32;VGM_USE_VORBIS;VGM_USE_MPEG;VGM_USE_FFMPEG;VGM_USE_G7221;VGM_USE_ATRAC9;VGM_USE_CELT;VGM_USE_SPEEX;NDEBUG;_WINDOWS;_USRDLL;IN_VGMSTREAM_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>_WIN32_WINNT=0x501;WIN32;VGMSTREAM_VERSION_AUTO;VGM_USE_VORBIS;VGM_USE_MPEG;VGM_USE_FFMPEG;VGM_USE_G7221;VGM_USE_ATRAC9;VGM_USE_CELT;VGM_USE_SPEEX;NDEBUG;_WINDOWS;_USRDLL;IN_VGMSTREAM_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
|
Loading…
Reference in New Issue
Block a user