Merge pull request #912 from bnnm/build2

- builds: misc fixes
This commit is contained in:
bnnm 2021-08-12 20:10:36 +02:00 committed by GitHub
commit 138984ef82
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
28 changed files with 1323 additions and 996 deletions

3
.gitattributes vendored
View File

@ -4,6 +4,9 @@
#*.h text=auto
#* -text
*.cpp text eol=lf
*.cc text eol=lf
*.sh text eol=lf
*.bat text eol=crlf
*.vcxproj text eol=crlf

2
.gitignore vendored
View File

@ -44,7 +44,7 @@ Release
/xmplay/Release
/xmplay/*.dll
/dependencies
/version.h
/version_auto.h
/msvc-build.config.ps1
/**/vgmstream-win.zip

View File

@ -85,13 +85,17 @@ endif()
# Set autogenerated version
if(MSVC)
set(VGM_VERSION_GENERATOR version-make.bat)
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)
else()
# linux uses 'sh' so git-less (src zip) builds can run without chmod -x (script)
set(VGM_VERSION_GENERATOR version-make.sh)
add_custom_command(OUTPUT ${VGM_SOURCE_DIR}/version_auto.h
COMMAND sh "${VGM_SOURCE_DIR}/${VGM_VERSION_GENERATOR}"
DEPENDS ${VGM_SOURCE_DIR}/${VGM_VERSION_GENERATOR})
endif()
add_custom_target(version_h ALL DEPENDS ${VGM_SOURCE_DIR}/version_auto.h)
# FFmpeg detection
if(USE_FFMPEG)

100
Makefile
View File

@ -89,73 +89,133 @@ LIBS_LDFLAGS=
LIBS_TARGET_EXT_LIBS=
# config libs
VGM_ENABLE_G7221 = 1
ifeq ($(VGM_ENABLE_G7221),1)
VGM_G7221 = 1
ifneq ($(VGM_G7221),0)
LIBS_CFLAGS += -DVGM_USE_G7221
endif
### external libs
# (call "make VGM_xxx = 0/1" to override 0/1 defaults, as Make does)
ifeq ($(TARGET_OS),Windows_NT)
VGM_ENABLE_VORBIS = 1
ifeq ($(VGM_ENABLE_VORBIS),1)
# enabled by default on Windows
VGM_VORBIS = 1
ifneq ($(VGM_VORBIS),0)
LIBS_CFLAGS += -DVGM_USE_VORBIS
LIBS_LDFLAGS += -lvorbis
LIBS_TARGET_EXT_LIBS += libvorbis.a
endif
VGM_ENABLE_MPEG = 1
ifeq ($(VGM_ENABLE_MPEG),1)
VGM_MPEG = 1
ifneq ($(VGM_MPEG),0)
LIBS_CFLAGS += -DVGM_USE_MPEG
LIBS_LDFLAGS += -lmpg123-0
LIBS_TARGET_EXT_LIBS += libmpg123-0.a
endif
VGM_ENABLE_G719 = 1
ifeq ($(VGM_ENABLE_G719),1)
VGM_G719 = 1
ifneq ($(VGM_G719),0)
LIBS_CFLAGS += -DVGM_USE_G719
LIBS_LDFLAGS += -lg719_decode
LIBS_TARGET_EXT_LIBS += libg719_decode.a
endif
VGM_ENABLE_MAIATRAC3PLUS = 0
ifeq ($(VGM_ENABLE_MAIATRAC3PLUS),1)
VGM_MAT3P = 0
ifneq ($(VGM_MAT3P),0)
LIBS_CFLAGS += -DVGM_USE_MAIATRAC3PLUS
LIBS_LDFLAGS += -lat3plusdecoder
LIBS_TARGET_EXT_LIBS += libat3plusdecoder.a
endif
VGM_ENABLE_FFMPEG = 1
ifeq ($(VGM_ENABLE_FFMPEG),1)
VGM_FFMPEG = 1
ifneq ($(VGM_FFMPEG),0)
LIBS_CFLAGS += -DVGM_USE_FFMPEG
LIBS_LDFLAGS += -lavcodec -lavformat -lavutil -lswresample
LIBS_TARGET_EXT_LIBS += libavcodec.a libavformat.a libavutil.a libswresample.a
endif
VGM_ENABLE_ATRAC9 = 1
ifeq ($(VGM_ENABLE_ATRAC9),1)
VGM_ATRAC9 = 1
ifneq ($(VGM_ATRAC9),0)
LIBS_CFLAGS += -DVGM_USE_ATRAC9
LIBS_LDFLAGS += -latrac9
LIBS_TARGET_EXT_LIBS += libatrac9.a
endif
VGM_ENABLE_CELT = 1
ifeq ($(VGM_ENABLE_CELT),1)
VGM_CELT = 1
ifneq ($(VGM_CELT),0)
LIBS_CFLAGS += -DVGM_USE_CELT
LIBS_LDFLAGS += -lcelt-0061 -lcelt-0110
LIBS_TARGET_EXT_LIBS += libcelt-0061.a libcelt-0110.a
endif
VGM_ENABLE_SPEEX = 1
ifeq ($(VGM_ENABLE_SPEEX),1)
VGM_SPEEX = 1
ifneq ($(VGM_SPEEX),0)
LIBS_CFLAGS += -DVGM_USE_SPEEX
LIBS_LDFLAGS += -L../ext_libs/libspeex -lspeex
LIBS_TARGET_EXT_LIBS += libspeex/libspeex.a
endif
endif #if WIN32
else
# must install system libs and enable manually on Linux
VGM_VORBIS = 0
ifneq ($(VGM_VORBIS),0)
LIBS_CFLAGS += -DVGM_USE_VORBIS
LIBS_LDFLAGS += -lvorbis -lvorbisfile
endif
VGM_MPEG = 0
ifneq ($(VGM_MPEG),0)
LIBS_CFLAGS += -DVGM_USE_MPEG
LIBS_LDFLAGS += -lmpg123
endif
VGM_G719 = 0
ifneq ($(VGM_G719),0)
LIBS_CFLAGS += -DVGM_USE_G719
LIBS_LDFLAGS += -lg719_decode
endif
VGM_MAT3P = 0
ifneq ($(VGM_MAT3P),0)
LIBS_CFLAGS += -DVGM_USE_MAIATRAC3PLUS
LIBS_LDFLAGS += -lat3plusdecoder
endif
VGM_FFMPEG = 0
ifneq ($(VGM_FFMPEG),0)
LIBS_CFLAGS += -DVGM_USE_FFMPEG
LIBS_LDFLAGS += -lavcodec -lavformat -lavutil -lswresample
endif
VGM_ATRAC9 = 0
ifneq ($(VGM_ATRAC9),0)
LIBS_CFLAGS += -DVGM_USE_ATRAC9
ifeq ($(VGM_ATRAC9),1)
LIBS_LDFLAGS += -latrac9
endif
ifeq ($(VGM_ATRAC9),2)
LIBS_LDFLAGS += -l:libatrac9.a
endif
endif
VGM_CELT = 0
ifneq ($(VGM_CELT),0)
LIBS_CFLAGS += -DVGM_USE_CELT
ifeq ($(VGM_CELT),1)
LIBS_LDFLAGS += -lcelt-0061 -lcelt-0110
endif
ifeq ($(VGM_CELT),2)
LIBS_LDFLAGS += -l:libcelt-0061.a -l:libcelt-0110.a
endif
endif
VGM_SPEEX = 0
ifneq ($(VGM_SPEEX),0)
LIBS_CFLAGS += -DVGM_USE_SPEEX
LIBS_LDFLAGS += -lspeex
endif
endif
export DEF_CFLAGS LIBS_CFLAGS LIBS_LDFLAGS LIBS_TARGET_EXT_LIBS

View File

@ -9,4 +9,4 @@ if HAVE_AUDACIOUS
SUBDIRS += audacious
endif
EXTRA_DIST = version.h
EXTRA_DIST = version_auto.h

View File

@ -22,9 +22,7 @@ extern "C" {
#include "vfs.h"
#ifndef VGMSTREAM_VERSION
#include "../version.h"
#endif
#ifndef VGMSTREAM_VERSION
#define VGMSTREAM_VERSION "(unknown-version)"
#endif

View File

@ -5,30 +5,38 @@
###############################################################################
### main defs
LIBAO_IPATH = ../../libao/include
LIBAO_LPATH = ../../libao/bin
CFLAGS += $(DEF_CFLAGS) -DVAR_ARRAYS $(EXTRA_CFLAGS)
LDFLAGS += -L../src -lvgmstream -lm $(EXTRA_LDFLAGS)
TARGET_EXT_LIBS =
ifeq ($(TARGET_OS),Windows_NT)
OUTPUT_CLI = test.exe
OUTPUT_123 = vgmstream123.exe
# -DUSE_ALLOCA
CFLAGS += -DWIN32 -I../ext_includes -I../ext_libs/Getopt -I../ext_includes/ffmpeg
LDFLAGS += -L../ext_libs
LIBAO_INC = -I$(LIBAO_IPATH)
LIBAO_LIB = -L$(LIBAO_LPATH) -lao
else
OUTPUT_CLI = vgmstream-cli
OUTPUT_123 = vgmstream123
endif
# -DUSE_ALLOCA
ifeq ($(TARGET_OS),Windows_NT)
CFLAGS += -DWIN32 -I../ext_libs/Getopt -I../ext_includes/ffmpeg
endif
#todo move clhca/etc and remove
CFLAGS += -I../ext_includes
CFLAGS += $(DEF_CFLAGS) -DVAR_ARRAYS -I../ext_includes $(EXTRA_CFLAGS)
LDFLAGS += -L../src -L../ext_libs -lvgmstream -lm $(EXTRA_LDFLAGS)
TARGET_EXT_LIBS =
LIBAO_LIB = -lao
endif
CFLAGS += $(LIBS_CFLAGS)
LDFLAGS += $(LIBS_LDFLAGS)
TARGET_EXT_LIBS += $(LIBS_TARGET_EXT_LIBS)
LIBAO_INC_PATH = ../../libao/include
LIBAO_LIB_PATH = ../../libao/bin
export CFLAGS LDFLAGS
@ -41,7 +49,7 @@ vgmstream_cli: libvgmstream.a $(TARGET_EXT_LIBS)
$(STRIP) $(OUTPUT_CLI)
vgmstream123: libvgmstream.a $(TARGET_EXT_LIBS)
$(CC) $(CFLAGS) -I$(LIBAO_INC_PATH) "-DVGMSTREAM_VERSION=\"$(VGMSTREAM_VERSION_PREV)\"" vgmstream123.c $(LDFLAGS) -L$(LIBAO_LIB_PATH) -lao -o $(OUTPUT_123)
$(CC) $(CFLAGS) $(LIBAO_INC) "-DVGMSTREAM_VERSION=\"$(VGMSTREAM_VERSION_PREV)\"" vgmstream123.c $(LDFLAGS) $(LIBAO_LIB) -o $(OUTPUT_123)
$(STRIP) $(OUTPUT_123)
libvgmstream.a:

View File

@ -39,9 +39,7 @@
#include "../src/vgmstream.h"
#include "../src/plugins.h"
#ifndef VGMSTREAM_VERSION
#include "../version.h"
#endif
#ifndef VGMSTREAM_VERSION
# define VGMSTREAM_VERSION "(unknown version)"
#endif

View File

@ -16,9 +16,7 @@
#define STDOUT_FILENO 1
#endif
#ifndef VGMSTREAM_VERSION
#include "../version.h"
#endif
#ifndef VGMSTREAM_VERSION
#define VGMSTREAM_VERSION "(unknown version)"
#endif

View File

@ -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>
@ -126,12 +126,12 @@
<ClCompile Include="vgmstream_cli.c" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="$(DependenciesDir)/fdk-aac/msvc/fdk-aac.vcxproj">
<!--<ProjectReference Include="$(DependenciesDir)/fdk-aac/msvc/fdk-aac.vcxproj">
<Project>{308e2ad5-be31-4770-9441-a8d50f56895c}</Project>
</ProjectReference>
<ProjectReference Include="$(DependenciesDir)/qaac/vcproject/mp4v2/mp4v2.vcxproj">
<Project>{86a064e2-c81b-4eee-8be0-a39a2e7c7c76}</Project>
</ProjectReference>
</ProjectReference>-->
<ProjectReference Include="..\ext_libs\ext_libs.vcxproj">
<Project>{10e6bfc6-1e5b-46e4-ba42-f04dfbd0abff}</Project>
</ProjectReference>

View File

@ -42,9 +42,9 @@ PKG_CHECK_MODULES(SPEEX, [speex], have_libspeex=yes,
AM_CONDITIONAL(HAVE_LIBSPEEX, test "$have_libspeex" = yes)
have_ffmpeg=no
#PKG_CHECK_MODULES(FFMPEG, [libavformat libavcodec libavutil libswresample], have_ffmpeg=yes,
# [AC_MSG_WARN([Cannot find ffmpeg - will not enable FFmpeg formats])]
#)
PKG_CHECK_MODULES(FFMPEG, [libavformat libavcodec libavutil libswresample], have_ffmpeg=yes,
[AC_MSG_WARN([Cannot find ffmpeg - will not enable FFmpeg formats])]
)
AM_CONDITIONAL(HAVE_FFMPEG, test "$have_ffmpeg" = yes)
have_audacious=no

View File

@ -70,7 +70,22 @@ It's also possible to call MSBuild and pass those values from the CMD, see fooba
Once finished resulting binaries are in the *./Release* folder. Remember you need to copy extra `.dll` to run them (see [README.md](../README.md)).
**For GCC/CLang**: there are basic Makefiles that work like usual with *make* (like `make vgmstream_cli EXTRA_CFLAGS="-DVGM_DEBUG_OUTPUT`). On Windows this compiles with extra libs enabled, but not on Linux (try CMake or autotools for those). Artifacts are usually in their subdir (*./cli*, *./winamp*, etc).
**For GCC/CLang**: there are basic Makefiles that work like usual with *make* (like `make vgmstream_cli EXTRA_CFLAGS="-DVGM_DEBUG_OUTPUT`). Artifacts are usually in their subdir (*./cli*, *./winamp*, etc).
On Windows this compiles with extra libs enabled by default. On Linux there is no fancy autodetection (try CMake or autotools for that), so you need to make sure libs are in your system and pass flags to enable them manually (install/compile libs then `make vgmstream_cli VGM_VORBIS=1 ...`). Check or run `make-build.sh` for a basic example that builds CLI and vgmstream123 with most libs enabled for a Ubuntu-style distro (if you get errors on your system just tweak or comment out offending parts).
Linux example:
```
sudo apt-get install -y git
git clone https://github.com/vgmstream/vgmstream
cd vgmstream
# in case they weren't set
chmod +x version-get.sh version-make.sh make-build.sh
# warning: installs stuff, check all "apt install"
./make-build.sh
```
### CMake (builds)
Tool used to generate common build files (for *make*, *VS/MSBuild*, etc), that in turn can be used to compile vgmstream's modules instead of existing scripts/files. Needs v3.6 or later:
@ -78,7 +93,7 @@ Tool used to generate common build files (for *make*, *VS/MSBuild*, etc), that i
If you wish to use CMake see [CMAKE.md](CMAKE.md). Some extra info is only mentioned in this doc though.
Note that doing in-source builds of CMake (`cmake .` / selecting `./vgmstream` as output dir) is not recommended and may clobber default build files.
Note that doing in-source builds of CMake (`cmake .` / selecting `./vgmstream` as output dir) is not recommended and may clobber default build files (try `cmake -S . -B build` / using some `./build` subfolder).
### autotools (builds)
Autogenerated *make* scripts, used by some modules (mainly Audacious for Linux, and external libs).
@ -138,7 +153,7 @@ If you use Mac (or Linux), there is a *Homebrew* script that may automate the pr
You may try CMake instead as it may be simpler and handle libs better. Some older distros may not work though (CMake version needs to recognize FILTER command). You may also need to install resulting artifacts manually. Check the *CMAKE.md* doc for some extra info too.
```
sudo apt-get update
sudo apt-get install -y gcc g++ make build-essential
sudo apt-get install -y gcc g++ make build-essential git
sudo apt-get install -y libmpg123-dev libvorbis-dev libspeex-dev
sudo apt-get install -y libavformat-dev libavcodec-dev libavutil-dev libswresample-dev
sudo apt-get install -y libao-dev audacious-dev
@ -161,7 +176,6 @@ set PATH=C:\Program Files (x86)\mingw-w64\i686-5.4.0-win32-sjlj-rt_v5-rev0\mingw
cd vgmstream
mingw32-make.exe vgmstream_cli -f Makefile ^
VGM_ENABLE_MAIATRAC3PLUS=0 ^
EXTRA_CFLAGS="-DVGM_DEBUG_OUTPUT -g -Wimplicit-function-declaration" ^
SHELL=sh.exe CC=gcc.exe AR=ar.exe STRIP=strip.exe DLLTOOL=dlltool.exe WINDRES=windres.exe ^
STRIP=echo ^
@ -246,7 +260,7 @@ Take note of other plugins stealing extensions (see README). To change Audacious
You can try building with CMake. Some older distros may not work though (CMake version needs to recognize FILTER command), and may need to install resulting artifacts manually (check ./audacious dir).
```
sudo apt-get update
sudo apt-get install -y gcc g++ make build-essential
sudo apt-get install -y gcc g++ make build-essential git
sudo apt-get install -y libmpg123-dev libvorbis-dev libspeex-dev
sudo apt-get install -y libavformat-dev libavcodec-dev libavutil-dev libswresample-dev
sudo apt-get install -y libao-dev audacious-dev
@ -266,9 +280,8 @@ Instead of CMake you can use autotools. Terminal example, assuming a Ubuntu-base
# default requirements
sudo apt-get update
sudo apt-get install gcc g++ make
sudo apt-get install gcc g++ make git
sudo apt-get install autoconf automake libtool
sudo apt-get install git
# vgmstream dependencies
sudo apt-get install libmpg123-dev libvorbis-dev libspeex-dev
#sudo apt-get install libavformat-dev libavcodec-dev libavutil-dev libswresample-dev
@ -367,6 +380,7 @@ MSVC needs a .lib helper to link .dll files, but libs below usually only create
Adds support for Vorbis, inside Ogg as `.ogg` (plain or encrypted) or custom variations like `.wem`, `.fsb`, `.ogl`, etc.
- Source: http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.6.zip
- DLL: `libvorbis.dll`
- lib: `-lvorbis -lvorbisfile`
- licensed under the 3-clause BSD license.
Should be buildable with MSVC (in /win32 dir are .sln files) or autotools (use `autogen.sh`).
@ -377,6 +391,7 @@ Adds support for MPEG (MP1/MP2/MP3), used in formats that may have custom MPEG l
- Source: https://sourceforge.net/projects/mpg123/files/mpg123/1.25.10/
- Builds: http://www.mpg123.de/download/win32/1.25.10/
- DLL: `libmpg123-0.dll`
- lib: `-lmpg123`
- licensed under the LGPL v2.1
Must use autotools (sh configure, make, make install), though some scripts simplify the process: `makedll.sh`, `windows-builds.sh`.
@ -386,6 +401,7 @@ Must use autotools (sh configure, make, make install), though some scripts simpl
Adds support for ITU-T G.719 (standardization of Polycom Siren 22), used in a few Namco `.bnsf` games.
- Source: https://github.com/kode54/libg719_decode
- DLL: `libg719_decode.dll`
- lib: ---
- unknown license (possibly invalid and Polycom's)
Use MSVC (use `g719.sln`). It can be built with GCC too, but you'll need to manually create scripts/makefiles.
@ -395,6 +411,7 @@ Use MSVC (use `g719.sln`). It can be built with GCC too, but you'll need to manu
Adds support for multiple codecs: ATRAC3 (`.at3`), ATRAC3plus (`.at3`), XMA1/2 (`.xma`), WMA v1 (`.wma`), WMA v2 (`.wma`), WMAPro (`.xwma`), AAC (`.mp4`, `.aac`), Bink (`.bik`), AC3/SPDIF (`.ac3`), Opus (`.opus`), Musepack (`.mpc`), FLAC (`.flac`), etc.
- Source: https://github.com/FFmpeg/FFmpeg/
- DLLs: `avcodec-vgmstream-58.dll`, `avformat-vgmstream-58.dll`, `avutil-vgmstream-56.dll`, `swresample-vgmstream-3.dll`
- lib: `-lavcodec -lavformat -lavutil -lswresample`
- primarily licensed under the LGPL v2.1 or later, with portions licensed under the GPL v2
vgmstream's FFmpeg builds for Windows remove many unnecessary parts of FFmpeg to trim down its gigantic size, and are also built with the "vgmstream-" prefix to avoid clashing with other plugins. Current options can be seen in `ffmpeg_options.txt`. Linux usually links to the system's FFmpeg without issues.
@ -410,6 +427,7 @@ Both may need yasm somewhere in PATH to properly compile: https://yasm.tortall.n
Adds support for ATRAC9, used in `.at9` and other formats for the PS4 and Vita.
- Source: https://github.com/Thealexbarney/LibAtrac9
- DLL: `libatrac9.dll`
- lib: `-latrac9` / `-l:libatrac9.a`
- licensed under the MIT license
Use MSCV and `libatrac9.sln`, or GCC and the Makefile included.
@ -420,6 +438,7 @@ Adds support for FSB CELT versions 0.6.1 and 0.11.0, used in a handful of older
- Source (0.6.1): http://downloads.us.xiph.org/releases/celt/celt-0.6.1.tar.gz
- Source (0.11.0): http://downloads.xiph.org/releases/celt/celt-0.11.0.tar.gz
- DLL: `libcelt-0061.dll`, `libcelt-0110.dll`
- lib: `-lcelt-0061` `-lcelt-0110` / `-l:libcelt-0110.a` `-l:libcelt-0061.a`
- licensed under the MIT license
FSB uses two incompatible, older libcelt versions. Both libraries export the same symbols so normally can't coexist together. To get them working we need to make sure symbols are renamed first. This may be solved in various ways:
@ -433,7 +452,7 @@ To compile we'll use autotools with GCC preprocessor renaming:
- in the celt-0.6.1 dir:
```
# creates Makefiles with Automake
sh.exe ./configure --build=mingw32 --prefix=/c/celt-0.11.0/bin/ --exec-prefix=/c/celt-0.11.0/bin/
sh.exe ./configure --build=mingw32 --prefix=/c/celt0.6.1/bin/ --exec-prefix=/c/celt-0.6.1/bin/
# LDFLAGS are needed to create the .dll (Automake whinning)
# CFLAGS rename a few CELT functions (we don't import the rest so they won't clash)
@ -456,17 +475,19 @@ To compile we'll use autotools with GCC preprocessor renaming:
For Linux, an option is using AUR's scripts (https://aur.archlinux.org/packages/vgmstream-git/) that similarly patch celt libs in PKGBUILD.
You can also get them from the official git (https://gitlab.xiph.org/xiph/celt) call `./autogen.sh` first, then pass call configure/make with renames (see `./make-build.sh`).
### libspeex
Adds support for Speex (inside custom containers), used in a few *EA* formats (`.sns`, `.sps`) for voices.
- Source: http://downloads.us.xiph.org/releases/speex/speex-1.2.0.tar.gz
- DLL: `libspeex.dll`
- lib: `-lspeex`
- licensed under the Xiph.Org variant of the BSD license.
https://www.xiph.org/licenses/bsd/speex/
Should be buildable with MSVC (in /win32 dir are .sln files, but not up to date and may need to convert .vcproj to vcxproj) or autotools (use `autogen.sh`, or script below).
You can also find a release on Github (https://github.com/xiph/speex/releases/tag/Speex-1.2.0). It has newer timestamps and some different helper files vs Xiph's release, but actual lib should be the same. Notably, Github's release *needs* `autogen.sh` that calls `autoreconf` to generate a base `configure` script, while Xiph's pre-includes `configure`. Since getting autoreconf working on Windows can be quite involved, Xiph's release is recommended.
You can also find a release on Github (https://github.com/xiph/speex/releases/tag/Speex-1.2.0). It has newer timestamps and some different helper files vs Xiph's release, but actual lib should be the same. Notably, Github's release *needs* `autogen.sh` that calls `autoreconf` to generate a base `configure` script, while Xiph's pre-includes `configure`. Since getting autoreconf working on Windows can be quite involved, Xiph's release is recommended on that platform.
Windows CMD example:
```

View File

@ -2,10 +2,10 @@
# external libs
#
# needed?
ifneq ($(TARGET_OS),Windows_NT)
$(error option must be built with TARGET_OS = Windows_NT)
endif
# don't barf in case it's target "clean"
#ifneq ($(TARGET_OS),Windows_NT)
#$(error option must be built with TARGET_OS = Windows_NT)
#endif
libvorbis.a: libvorbis.def

View File

@ -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>
@ -139,9 +139,12 @@
<ClCompile Include="foo_vgmstream.cpp" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="$(DependenciesDir)/fdk-aac/msvc/fdk-aac.vcxproj">
<!--<ProjectReference Include="$(DependenciesDir)/fdk-aac/msvc/fdk-aac.vcxproj">
<Project>{308e2ad5-be31-4770-9441-a8d50f56895c}</Project>
</ProjectReference>
<ProjectReference Include="$(DependenciesDir)/qaac/vcproject/mp4v2/mp4v2.vcxproj">
<Project>{86a064e2-c81b-4eee-8be0-a39a2e7c7c76}</Project>
</ProjectReference>-->
<ProjectReference Include="$(DependenciesDir)/foobar/foobar2000/ATLHelpers/foobar2000_ATL_helpers.vcxproj">
<Project>{622e8b19-8109-4717-bd4d-9657aa78363e}</Project>
</ProjectReference>
@ -157,9 +160,6 @@
<ProjectReference Include="$(DependenciesDir)/foobar/pfc/pfc.vcxproj">
<Project>{ebfffb4e-261d-44d3-b89c-957b31a0bf9c}</Project>
</ProjectReference>
<ProjectReference Include="$(DependenciesDir)/qaac/vcproject/mp4v2/mp4v2.vcxproj">
<Project>{86a064e2-c81b-4eee-8be0-a39a2e7c7c76}</Project>
</ProjectReference>
<ProjectReference Include="..\ext_libs\ext_libs.vcxproj">
<Project>{10e6bfc6-1e5b-46e4-ba42-f04dfbd0abff}</Project>
</ProjectReference>

View File

@ -19,9 +19,7 @@ extern "C" {
#include "foo_vgmstream.h"
#include "foo_filetypes.h"
#ifndef VGMSTREAM_VERSION
#include "../version.h"
#endif
#ifndef VGMSTREAM_VERSION
#define PLUGIN_VERSION __DATE__
#else

185
make-build.sh Executable file
View File

@ -0,0 +1,185 @@
#!/bin/sh
# example script that builds vgmstream with most libs enabled using the basic makefiles
# (needs some manual fiddling)
# most libs use system libs if possible, but should be possible to download them, compile, and
# pass INCS/LIBSs that use static libs
# todo more testing
# - don't use ext_libs includes for linux (uses system libs)
# - libcelt 0.6 works but 11.0 gives "Floating point exception (core dumped)" (VM?)
exit
# config for make
INCS=
LIBS=
FLAGS=
###############################################################################
# base deps
sudo apt-get install -y gcc g++ make build-essential git
###############################################################################
# vgmstream123 deps
sudo apt-get install -y libao-dev
###############################################################################
# vorbis deps
sudo apt-get install -y libvorbis-dev
FLAGS+=" VGM_VORBIS=1"
###############################################################################
# mpeg deps
sudo apt-get install -y libmpg123-dev
FLAGS+=" VGM_MPEG=1"
###############################################################################
# speex deps
sudo apt-get install -y libspeex-dev
FLAGS+=" VGM_SPEEX=1"
###############################################################################
# ffmpeg deps
sudo apt-get install -y libavformat-dev libavcodec-dev libavutil-dev libswresample-dev
FLAGS+=" VGM_FFMPEG=1"
###############################################################################
# atrac9 deps (compile)
mkdir dependencies
cd dependencies
git clone https://github.com/Thealexbarney/LibAtrac9
cd LibAtrac9/C
make
cd ../../../
FLAGS+=" VGM_ATRAC9=2"
#INCS+=" -I../dependencies/LibAtrac9/C/src"
LIBS+=" -L../dependencies/LibAtrac9/C/bin"
###############################################################################
# celt deps (compile x2)
mkdir dependencies
cd dependencies
# used renames followed by unused renamed (but seems needed to avoid clashes)
CELT0061_RENAMES=" \
-Dcelt_decode=celt_0061_decode \
-Dcelt_decoder_create=celt_0061_decoder_create \
-Dcelt_decoder_destroy=celt_0061_decoder_destroy \
-Dcelt_mode_create=celt_0061_mode_create \
-Dcelt_mode_destroy=celt_0061_mode_destroy \
-Dcelt_mode_info=celt_0061_mode_info \
\
-Dalg_quant=alg_quant_0061 \
-Dalg_unquant=alg_unquant_0061 \
-Dcelt_decoder_create_custom=celt_decoder_create_custom_0061 \
-Dcelt_encoder_destroy=celt_encoder_destroy_0061 \
-Dcelt_encoder_create=celt_encoder_create_0061 \
-Dcelt_encode=celt_encode_0061 \
-Dcelt_encode_float=celt_encode_float_0061 \
-Dcelt_encoder_ctl=celt_encoder_ctl_0061 \
-Dcelt_decode_float=celt_decode_float_0061 \
-Dcelt_decoder_ctl=celt_decoder_ctl_0061 \
-Dcompute_allocation=compute_allocation_0061 \
-Dcompute_band_energies=compute_band_energies_0061 \
-Ddenormalise_bands=denormalise_bands_0061 \
-Dec_dec_init=ec_dec_init_0061 \
-Dec_decode=ec_decode_0061 \
-Dec_decode_bin=ec_decode_bin_0061 \
-Dec_dec_update=ec_dec_update_0061 \
-Dec_dec_uint=ec_dec_uint_0061 \
-Dec_dec_bits=ec_dec_bits_0061 \
-Dec_enc_init=ec_enc_init_0061 \
-Dec_encode=ec_encode_0061 \
-Dec_encode_bin=ec_encode_bin_0061 \
-Dec_enc_uint=ec_enc_uint_0061 \
-Dec_enc_bits=ec_enc_bits_0061 \
-Dec_enc_done=ec_enc_done_0061 \
-Dnormalise_bands=normalise_bands_0061 \
-Drenormalise_vector=renormalise_vector_0061 \
-Dquant_coarse_energy=quant_coarse_energy_0061 \
-Dquant_fine_energy=quant_fine_energy_0061 \
-Dquant_energy_finalise=quant_energy_finalise_0061 \
-Dunquant_coarse_energy=unquant_coarse_energy_0061 \
-Dunquant_energy_finalise=unquant_energy_finalise_0061 \
-Dunquant_fine_energy=unquant_fine_energy_0061 \
"
# same as the above but I don't know sh enough to normalize
CELT0110_RENAMES=" \
-Dcelt_decode=celt_0110_decode \
-Dcelt_decoder_create_custom=celt_0110_decoder_create_custom \
-Dcelt_decoder_destroy=celt_0110_decoder_destroy \
-Dcelt_mode_create=celt_0110_mode_create \
-Dcelt_mode_destroy=celt_0110_mode_destroy \
-Dcelt_mode_info=celt_0110_mode_info \
\
-Dalg_quant=alg_quant_0110 \
-Dalg_unquant=alg_unquant_0110 \
-Dcelt_encoder_destroy=celt_encoder_destroy_0110 \
-Dcelt_encoder_create=celt_encoder_create_0110 \
-Dcelt_encode=celt_encode_0110 \
-Dcelt_encode_float=celt_encode_float_0110 \
-Dcelt_encoder_ctl=celt_encoder_ctl_0110 \
-Dcelt_decode_float=celt_decode_float_0110 \
-Dcelt_decoder_ctl=celt_decoder_ctl_0110 \
-Dcompute_allocation=compute_allocation_0110 \
-Dcompute_band_energies=compute_band_energies_0110 \
-Ddenormalise_bands=denormalise_bands_0110 \
-Dec_dec_init=ec_dec_init_0110 \
-Dec_decode=ec_decode_0110 \
-Dec_decode_bin=ec_decode_bin_0110 \
-Dec_dec_update=ec_dec_update_0110 \
-Dec_dec_uint=ec_dec_uint_0110 \
-Dec_dec_bits=ec_dec_bits_0110 \
-Dec_enc_init=ec_enc_init_0110 \
-Dec_encode=ec_encode_0110 \
-Dec_encode_bin=ec_encode_bin_0110 \
-Dec_enc_uint=ec_enc_uint_0110 \
-Dec_enc_bits=ec_enc_bits_0110 \
-Dec_enc_done=ec_enc_done_0110 \
-Dnormalise_bands=normalise_bands_0110 \
-Drenormalise_vector=renormalise_vector_0110 \
-Dquant_coarse_energy=quant_coarse_energy_0110 \
-Dquant_fine_energy=quant_fine_energy_0110 \
-Dquant_energy_finalise=quant_energy_finalise_0110 \
-Dunquant_coarse_energy=unquant_coarse_energy_0110 \
-Dunquant_energy_finalise=unquant_energy_finalise_0110 \
-Dunquant_fine_energy=unquant_fine_energy_0110 \
"
git clone --depth 1 --branch v0.6.1 https://gitlab.xiph.org/xiph/celt.git celt-0061
cd celt-0061
./autogen.sh
./configure
make LDFLAGS="-no-undefined" AM_CFLAGS="$CELT0061_RENAMES"
mv ./libcelt/.libs/libcelt.a ./libcelt/.libs/libcelt-0061.a
cd ..
git clone --depth 1 --branch v0.11 https://gitlab.xiph.org/xiph/celt.git celt-0110
cd celt-0110
./autogen.sh
./configure
make LDFLAGS="-no-undefined" AM_CFLAGS="-DCUSTOM_MODES=1 $CELT0110_RENAMES"
mv ./libcelt/.libs/libcelt0.a ./libcelt/.libs/libcelt-0110.a
cd ..
cd ..
FLAGS+="VGM_CELT=2"
#INCS+=" -I../dependencies/celt-0061/libcelt/.libs/"
LIBS+=" -L../dependencies/celt-0061/libcelt/.libs/ -L../dependencies/celt-0110/libcelt/.libs/"
###############################################################################
# vgmstream
make vgmstream_cli $FLAGS EXTRA_CFLAGS=$INCS EXTRA_LDFLAGS=$LIBS
make vgmstream123 $FLAGS EXTRA_CFLAGS=$INCS EXTRA_LDFLAGS=$LIBS

View File

@ -232,7 +232,9 @@ int mpeg_custom_parse_frame_default(VGMSTREAMCHANNEL* stream, mpeg_codec_data* d
fail:
return 0;
}
#endif
//TODO: move to a better place
/*****************/
/* FRAME HELPERS */
@ -475,5 +477,3 @@ fail:
VGM_LOG("MPEG: sample reader failed at %lx\n", offset);
return 0;
}
#endif

View File

@ -1,21 +1,12 @@
#ifndef _MPEG_DECODER_H_
#define _MPEG_DECODER_H_
#include <mpg123.h>
#include "../vgmstream.h"
#include "../coding/coding.h"
/* used by mpeg_decoder.c, but scattered in other .c files */
#ifdef VGM_USE_MPEG
typedef struct {
int version;
int layer;
int bit_rate;
int sample_rate;
int frame_samples;
int frame_size; /* bytes */
int channels;
} mpeg_frame_info;
#include <mpg123.h>
/* represents a single MPEG stream */
typedef struct {
@ -70,12 +61,22 @@ struct mpeg_codec_data {
};
int mpeg_get_frame_info(STREAMFILE *streamfile, off_t offset, mpeg_frame_info * info);
typedef struct {
int version;
int layer;
int bit_rate;
int sample_rate;
int frame_samples;
int frame_size; /* bytes */
int channels;
} mpeg_frame_info;
int mpeg_custom_setup_init_default(STREAMFILE *streamFile, off_t start_offset, mpeg_codec_data *data, coding_t *coding_type);
int mpeg_custom_setup_init_ealayer3(STREAMFILE *streamFile, off_t start_offset, mpeg_codec_data *data, coding_t *coding_type);
int mpeg_custom_setup_init_awc(STREAMFILE *streamFile, off_t start_offset, mpeg_codec_data *data, coding_t *coding_type);
int mpeg_custom_setup_init_eamp3(STREAMFILE *streamFile, off_t start_offset, mpeg_codec_data *data, coding_t *coding_type);
int mpeg_get_frame_info(STREAMFILE* sf, off_t offset, mpeg_frame_info* info);
int mpeg_custom_setup_init_default(STREAMFILE* sf, off_t start_offset, mpeg_codec_data* data, coding_t* coding_type);
int mpeg_custom_setup_init_ealayer3(STREAMFILE* sf, off_t start_offset, mpeg_codec_data* data, coding_t* coding_type);
int mpeg_custom_setup_init_awc(STREAMFILE* sf, off_t start_offset, mpeg_codec_data* data, coding_t* coding_type);
int mpeg_custom_setup_init_eamp3(STREAMFILE* sf, off_t start_offset, mpeg_codec_data* data, coding_t* coding_type);
int mpeg_custom_parse_frame_default(VGMSTREAMCHANNEL* stream, mpeg_codec_data* data, int num_stream);
int mpeg_custom_parse_frame_ahx(VGMSTREAMCHANNEL* stream, mpeg_codec_data* data, int num_stream);

View File

@ -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>

View File

@ -80,7 +80,6 @@ VGMSTREAM* init_vgmstream_ffmpeg(STREAMFILE* sf) {
}
}
#ifdef VGM_USE_MPEG
/* hack for MP3 files (will return 0 samples if not an actual file)
* .mus: Marc Ecko's Getting Up (PC) */
if (!num_samples && check_extensions(sf, "mp3,lmp3,mus")) {
@ -89,7 +88,6 @@ VGMSTREAM* init_vgmstream_ffmpeg(STREAMFILE* sf) {
/* this seems correct thankfully */
//ffmpeg_set_skip_samples(data, encoder_delay);
}
#endif
/* hack for MPC */
if (is_id32be(0x00, sf, "MP+\x07") || /* Musepack V7 */

2
version-get.sh Normal file → Executable file
View File

@ -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

View File

@ -1,38 +1,63 @@
@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
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 */
goto :got_version
if not "%version%"=="" set version=!version:^:=_!
if not "%version%"=="" goto :got_version
echo Git version not found, can't autogenerate version.h
REM try to get version from version.h (static)
:get_version_h
echo Git version not found, can't autogenerate version (using default)
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
)
)
goto :got_version
REM avoid overwritting if contents are the same, as some systems rebuild on timestamp
:got_version
set LINE_ORIGINAL=none
if exist %VERSION_FILE% set /p LINE_ORIGINAL=<%VERSION_FILE%
if not "%LINE%"=="%LINE_ORIGINAL%" (
REM no spaces!
echo %LINE%>%VERSION_FILE%
)
goto :exit
REM overwrite version.h
:got_version
if %version%==%VERSION_DEFAULT% goto :exit
echo #define %VERSION_NAME% "%version%" /* autogenerated */ > %VERSION_FILE%
REM * alt full file comp test
REM echo %LINE% > %VERSION_FILE%_temp
REM echo n | comp %VERSION_FILE%_temp %VERSION_FILE% > NUL 2> NUL
REM if not errorlevel 1 goto :got_version_done
REM copy /y %VERSION_FILE%_temp %VERSION_FILE% > NUL 2> NUL
REM :got_version_done
REM del %VERSION_FILE%_temp
REM :exit
REM done
:exit

32
version-make.sh Normal file → Executable file
View File

@ -1,11 +1,12 @@
#!/bin/sh
# make current git version (overwrites version.h)
# make current git version (overwrites version_auto.h)
VERSION_DEFAULT=unknown
VERSION_NAME=VGMSTREAM_VERSION
VERSION_FILE=version.h
VERSION_FILE=version_auto.h
# test if git exists
# try get version from Git (dynamic)
if ! command -v git > /dev/null ; then
VERSION=""
else
@ -15,7 +16,26 @@ fi
# ignore git stderr "fatal:*" or blank
if [[ $VERSION != fatal* ]] && [ ! -z "$VERSION" ] ; then
echo "#define $VERSION_NAME \"$VERSION\" /* autogenerated */" > $VERSION_FILE
LINE="#define $VERSION_NAME \"$VERSION\" /* autogenerated */"
else
echo "Git version not found, can't autogenerate version.h"
fi;
# try to get version from version.h (static)
echo "Git version not found, can't autogenerate version (using default)"
LINE="#define $VERSION_NAME \"$VERSION_DEFAULT\" /* autogenerated */"
while IFS= read -r -u3 item; do
COMP="#define $VERSION_NAME*"
if [[ $item == $COMP ]] ; then
LINE=$item
fi
done 3< "version.h"
fi
# avoid overwritting if contents are the same, as some systems rebuild on timestamp
LINE_ORIGINAL="none"
if test -f "version_auto.h"; then
LINE_ORIGINAL=$(<version_auto.h)
fi
if [[ $LINE != $LINE_ORIGINAL ]] ; then
echo "$LINE" > "$VERSION_FILE"
fi

View File

@ -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

View File

@ -3,9 +3,7 @@
*/
#include "in_vgmstream.h"
#ifndef VGMSTREAM_VERSION
#include "../version.h"
#endif
#ifndef VGMSTREAM_VERSION
#define VGMSTREAM_VERSION "(unknown version)"
#endif

View File

@ -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>
@ -138,12 +138,12 @@
<ClCompile Include="in_vgmstream.c" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="$(DependenciesDir)/fdk-aac/msvc/fdk-aac.vcxproj">
<!--<ProjectReference Include="$(DependenciesDir)/fdk-aac/msvc/fdk-aac.vcxproj">
<Project>{308e2ad5-be31-4770-9441-a8d50f56895c}</Project>
</ProjectReference>
<ProjectReference Include="$(DependenciesDir)/qaac/vcproject/mp4v2/mp4v2.vcxproj">
<Project>{86a064e2-c81b-4eee-8be0-a39a2e7c7c76}</Project>
</ProjectReference>
</ProjectReference>-->
<ProjectReference Include="..\ext_libs\ext_libs.vcxproj">
<Project>{10e6bfc6-1e5b-46e4-ba42-f04dfbd0abff}</Project>
</ProjectReference>

View File

@ -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>
@ -124,12 +124,12 @@
<None Include="xmpin.def" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="$(DependenciesDir)/fdk-aac/msvc/fdk-aac.vcxproj">
<!--<ProjectReference Include="$(DependenciesDir)/fdk-aac/msvc/fdk-aac.vcxproj">
<Project>{308e2ad5-be31-4770-9441-a8d50f56895c}</Project>
</ProjectReference>
<ProjectReference Include="$(DependenciesDir)/qaac/vcproject/mp4v2/mp4v2.vcxproj">
<Project>{86a064e2-c81b-4eee-8be0-a39a2e7c7c76}</Project>
</ProjectReference>
</ProjectReference>-->
<ProjectReference Include="..\ext_libs\ext_libs.vcxproj">
<Project>{10e6bfc6-1e5b-46e4-ba42-f04dfbd0abff}</Project>
</ProjectReference>

View File

@ -16,9 +16,7 @@
#include "../src/plugins.h"
#ifndef VGMSTREAM_VERSION
#include "../version.h"
#endif
#ifndef VGMSTREAM_VERSION
#define VGMSTREAM_VERSION "(unknown version)"
#endif