Merge pull request #370 from CyberBotX/CMake

Add CMake scripts
This commit is contained in:
Christopher Snowhill 2019-03-20 22:15:34 -07:00 committed by GitHub
commit a236069775
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
32 changed files with 1797 additions and 26 deletions

265
CMakeLists.txt Normal file
View File

@ -0,0 +1,265 @@
cmake_minimum_required(VERSION 3.5)
project(vgmstream C)
enable_language(CXX)
# TODO: Figure out how to build audacious plugin via CMake
# TODO: Figure out how to build XMPlay plugin via CMake
# TODO: Figure out why MinGW-w64 doesn't build
if(MINGW)
message(FATAL_ERROR "Cannot currently build with MinGW")
endif()
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
include(vgmstream)
# Options
option(USE_FDKAAC "Use FDK-AAC/QAAC for support of MP4 AAC" ON)
set(QAAC_PATH CACHE PATH "Path to QAAC")
set(FDK_AAC_PATH CACHE PATH "Path to FDK-AAC")
option(USE_MPEG "Use libmpg123 for support of MPEG (MP1/MP2/MP3)" ON)
option(USE_VORBIS "Use libvorbis for support of Vorbis" ON)
option(USE_FFMPEG "Use FFmpeg for support of many codecs" ON)
option(USE_MAIATRAC3PLUS "Use MAIATRAC3+ for support of ATRAC3+" OFF)
set(MAIATRAC3PLUS_PATH CACHE PATH "Path to MAIATRAC3+")
if(WIN32)
# May need to see if it is possible to get these to work on non-Windows systems too
option(USE_G7221 "Use libg7221_decode for support of ITU-T G.722.1 annex C" ON)
option(USE_G719 "Use libg719_decode for support ITU-T G.719" ON)
option(USE_ATRAC9 "Use LibAtrac9 for support of ATRAC9" ON)
option(USE_CELT "Use libcelt for support of FSB CELT versions 0.6.1 and 0.11.0" ON)
endif()
# Build choices
option(BUILD_CLI "Build vgmstream CLI" ON)
if(WIN32)
option(BUILD_FB2K "Build foobar2000 component" ON)
set(FB2K_SDK_PATH CACHE PATH "Path to foobar2000 SDK")
set(WTL_INCLUDE_PATH CACHE PATH "Path to WTL include directory")
set(FB2K_COMPONENT_INSTALL_PREFIX CACHE PATH "Path to foobar2000 component installation directory")
option(BUILD_WINAMP "Build Winamp plugin" ON)
set(WINAMP_INSTALL_PREFIX CACHE PATH "Path to Winamp installation directory")
option(BUILD_XMPLAY "Build XMPlay plugin" ON)
set(XMPLAY_INSTALL_PREFIX CACHE PATH "Path to XMPlay installation directory")
else()
option(BUILD_AUDACIOUS "Build Audacious plugin" ON)
endif()
if(WIN32)
# Enable support for the resource compiler when using MinGW
if(MINGW)
enable_language(RC)
# Not 100% sure this is needed, but in the past, MinGW's command for compiling resources was incorrect
set(CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> <FLAGS> -O coff <DEFINES> -i <SOURCE> -o <OBJECT>")
endif(MINGW)
# Update the version
set(CMAKE_EXECUTABLE_SUFFIX .exe)
if(MSVC)
file(TO_NATIVE_PATH "${CMAKE_BINARY_DIR}/version.h" VERSION_H_PATH)
add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/version.h
COMMAND "${CMAKE_SOURCE_DIR}/version.bat"
ARGS ${VERSION_H_PATH} VERSION
DEPENDS ${CMAKE_SOURCE_DIR}/version.bat)
add_custom_target(version_h DEPENDS ${CMAKE_BINARY_DIR}/version.h)
else()
find_package(Git)
if(GIT_FOUND)
execute_process(COMMAND ${GIT_EXECUTABLE} describe --always --tags
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE VGMSTREAM_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE)
endif()
endif()
else()
# Update the version
find_package(Git)
if(GIT_FOUND)
execute_process(COMMAND ${GIT_EXECUTABLE} describe --always --tags
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE VGMSTREAM_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE)
endif()
# Find the relevant packages
if(USE_MPEG)
find_package(MPG123)
if(NOT MPG123_FOUND)
set(USE_MPEG OFF)
endif()
endif()
if(USE_VORBIS)
find_package(VorbisFile)
if(NOT VORBISFILE_FOUND)
set(USE_VORBIS OFF)
endif()
endif()
if(USE_FFMPEG)
find_package(FFmpeg)
if(NOT FFMPEG_LIBRARIES)
set(USE_FFMPEG OFF)
endif()
endif()
# If building the CLI, we need to include AO as well
if(BUILD_CLI)
find_package(AO)
if(NOT AO_FOUND)
message(FATAL_ERROR "Cannot build vgmstream123 without libao")
endif()
endif()
# If building Audacious, we need to make sure we can find its pkg-config module as well as GTK's
if(BUILD_AUDACIOUS)
include(FindPkgConfig)
pkg_search_module(AUDACIOUS REQUIRED audacious>=3.6)
pkg_get_variable(AUDACIOUS_PLUGIN_DIR audacious plugin_dir)
pkg_search_module(GTK REQUIRED gtk+-3.0 gtk+-2.0)
endif()
endif()
# Set compiler flags
if(CMAKE_CXX_COMPILER_ID MATCHES Clang OR CMAKE_CXX_COMPILER_ID MATCHES GNU)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
if(CMAKE_CXX_COMPILER_ID MATCHES Clang)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-parentheses-equality -Wno-header-guard -Wno-unused-function -Wno-shift-negative-value -Wno-deprecated-register")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-parentheses-equality -Wno-header-guard -Wno-unused-function -Wno-shift-negative-value -Wno-deprecated-register")
elseif()
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 5.9)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-misleading-indentation")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-misleading-indentation")
endif()
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.0)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-attributes")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-attributes")
endif()
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 2.99)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-function")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-function")
endif()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-format -Wno-sign-compare")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-format -Wno-sign-compare")
endif()
elseif(MSVC)
if(CMAKE_C_FLAGS MATCHES "/W[0-4]")
string(REGEX REPLACE "/W[0-4]" "/W3" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
else()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W3")
endif()
if(CMAKE_CXX_FLAGS MATCHES "/W[0-4]")
string(REGEX REPLACE "/W[0-4]" "/W3" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W3")
endif()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4005 /wd4018 /wd4244 /wd4302 /wd4838")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4005 /wd4018 /wd4244 /wd4302 /wd4838")
endif()
# Add other projects and subdirectories as needed
if(USE_FDKAAC)
if(FDK_AAC_PATH)
include(fdk-aac)
else()
message(FATAL_ERROR "Path to FDK-AAC must be set. (Use FDK_AAC_PATH)")
endif()
if(QAAC_PATH)
include(mp4v2)
else()
message(FATAL_ERROR "Path to QAAC must be set. (Use QAAC_PATH)")
endif()
endif()
if(USE_MAIATRAC3PLUS)
if(MAIATRAC3PLUS_PATH)
add_subdirectory(${MAIATRAC3PLUS_PATH}/MaiAT3PlusDecoder ${CMAKE_BINARY_DIR}/maitrac3plus)
else()
message(FATAL_ERROR "Path to MAIATRAC3+ must be set. (Use MAIATRAC3PLUS_PATH)")
endif()
endif()
add_subdirectory(src)
if(WIN32)
add_subdirectory(ext_libs)
if(BUILD_WINAMP)
if(NOT WINAMP_INSTALL_PREFIX)
message(FATAL_ERROR "The path to Winamp must be set. (Use WINAMP_INSTALL_PREFIX, the plugin will be installed into the Plugins directory)")
endif()
add_subdirectory(winamp)
endif()
if(BUILD_FB2K)
if(NOT FB2K_SDK_PATH)
message(FATAL_ERROR "The path to the foobar2000 SDK must be set. (Use FB2K_SDK_PATH)")
endif()
if(NOT WTL_INCLUDE_PATH)
message(FATAL_ERROR "The path to the WTL include directory must be set. (Use WTL_INCLUDE_PATH)")
endif()
if(NOT FB2K_COMPONENT_INSTALL_PREFIX)
message(FATAL_ERROR "The path to foobar2000 must be set. (Use FB2K_COMPONENT_INSTALL_PREFIX, this is where the component will be installed)")
endif()
include_external_msproject(fb2k_sdk ${FB2K_SDK_PATH}/foobar2000/SDK/foobar2000_SDK.vcxproj)
include_external_msproject(fb2k_sdk_helpers ${FB2K_SDK_PATH}/foobar2000/helpers/foobar2000_sdk_helpers.vcxproj)
include_external_msproject(fb2k_atl_helpers ${FB2K_SDK_PATH}/foobar2000/ATLHelpers/foobar2000_ATL_helpers.vcxproj)
include_external_msproject(fb2k_component_client ${FB2K_SDK_PATH}/foobar2000/foobar2000_component_client/foobar2000_component_client.vcxproj)
include_external_msproject(pfc ${FB2K_SDK_PATH}/pfc/pfc.vcxproj)
add_subdirectory(fb2k)
endif()
if(BUILD_XMPLAY)
if(NOT XMPLAY_INSTALL_PREFIX)
message(FATAL_ERROR "The path to XMPlay must be set. (Use XMPlay_INSTALL_PREFIX, this is where the plugin will be installed)")
endif()
add_subdirectory(xmplay)
endif()
else()
if(BUILD_AUDACIOUS)
add_subdirectory(audacious)
endif()
endif()
if(BUILD_CLI)
if(WIN32)
add_subdirectory(ext_libs/Getopt)
endif()
add_subdirectory(cli)
endif()
# Option Summary
message(STATUS " Option Summary")
message(STATUS "=================")
message(STATUS "FKD-AAC/QAAC: ${USE_FDKAAC}")
message(STATUS " MPEG: ${USE_MPEG}")
message(STATUS " Vorbis: ${USE_VORBIS}")
message(STATUS " FFmpeg: ${USE_FFMPEG}")
message(STATUS " MAIATRAC3+: ${USE_MAIATRAC3PLUS}")
if(WIN32)
message(STATUS " G.722.1: ${USE_G7221}")
message(STATUS " G.719: ${USE_G719}")
message(STATUS " ATRAC9: ${USE_ATRAC9}")
message(STATUS " FSB CELT: ${USE_CELT}")
endif()
message(STATUS "")
# Build Summary
message(STATUS " Building")
message(STATUS "=========================")
if(WIN32)
message(STATUS " CLI: ${BUILD_CLI}")
message(STATUS "foobar2000 component: ${BUILD_FB2K}")
message(STATUS " Winamp plugin: ${BUILD_WINAMP}")
message(STATUS " XMPlay plugin: ${BUILD_XMPLAY}")
else()
message(STATUS "CLI/vgmstream123: ${BUILD_CLI}")
message(STATUS "Audacious plugin: ${BUILD_AUDACIOUS}")
endif()
message(STATUS "")
# Install Summary
message(STATUS " Install Paths")
message(STATUS "=========================")
if(WIN32)
message(STATUS " CLI: ${CMAKE_INSTALL_PREFIX}/bin")
message(STATUS "foobar2000 component: ${FB2K_COMPONENT_INSTALL_PREFIX}")
message(STATUS " Winamp plugin: ${WINAMP_INSTALL_PREFIX}/Plugins")
message(STATUS " XMPlay plugin: ${XMPLAY_INSTALL_PREFIX}")
else()
message(STATUS "CLI/vgmstream123: ${CMAKE_INSTALL_PREFIX}/bin")
message(STATUS "Audacious plugin: ${AUDACIOUS_PLUGIN_DIR}/Input")
endif()
message(STATUS "")

71
audacious/CMakeLists.txt Normal file
View File

@ -0,0 +1,71 @@
add_library(audacious_vgmstream SHARED
plugin.h
vfs.h
plugin.cc
vfs.cc)
# Link to the vgmstream library and audacious library
target_link_libraries(audacious_vgmstream
libvgmstream
${AUDACIOUS_LINK_LIBRARIES}
${GTK_LINK_LIBRARIES})
setup_target(audacious_vgmstream TRUE)
# Remove the prefix and set output name
set_target_properties(audacious_vgmstream PROPERTIES
PREFIX ""
OUTPUT_NAME "vgmstream")
macro(extract_defines CFLAGS CFLAGS_COPY)
set(${CFLAGS_COPY} ${${CFLAGS}})
if(${CFLAGS_COPY})
list(FILTER ${CFLAGS_COPY} INCLUDE REGEX "^-D.*")
endif()
endmacro()
macro(extract_non_defines CFLAGS CFLAGS_COPY)
set(${CFLAGS_COPY} ${${CFLAGS}})
if(${CFLAGS_COPY})
list(FILTER ${CFLAGS_COPY} EXCLUDE REGEX "^-D.*")
endif()
endmacro()
extract_defines(AUDACIOUS_CFLAGS_OTHER AUDACIOUS_DEFINES)
extract_defines(GTK_CFLAGS_OTHER GTK_DEFINES)
extract_non_defines(AUDACIOUS_CFLAGS_OTHER AUDACIOUS_CFLAGS_OTHER)
extract_non_defines(GTK_CFLAGS_OTHER GTK_CFLAGS_OTHER)
# Include compile definitions for Audacious and GTK, as well as the version string
target_compile_definitions(audacious_vgmstream PRIVATE
${AUDACIOUS_DEFINES}
${GTK_DEFINES}
VERSION="${VGMSTREAM_VERSION}")
# Include compile flags for Audacious and GTK
set_target_properties(audacious_vgmstream PROPERTIES
COMPILE_FLAGS "${AUDACIOUS_CFLAGS_OTHER} ${GTK_CFLAGS_OTHER}")
# Make sure that the binary directory is included (for version.h) as well as the Audacious and GTK include directories
target_include_directories(audacious_vgmstream PRIVATE
${CMAKE_BINARY_DIR}
${AUDACIOUS_INCLUDE_DIRS}
${GTK_INCLUDE_DIRS})
# Make sure that whatever compiler we use can handle these features
target_compile_features(audacious_vgmstream PRIVATE
cxx_auto_type
cxx_constexpr
cxx_decltype
cxx_defaulted_move_initializers
cxx_deleted_functions
cxx_nullptr
cxx_rvalue_references
cxx_static_assert
cxx_strong_enums
cxx_variadic_macros
cxx_variadic_templates)
# Install the plugin
install(TARGETS audacious_vgmstream
DESTINATION ${AUDACIOUS_PLUGIN_DIR}/Input)

View File

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

View File

@ -24,7 +24,7 @@ public:
//constexpr VgmstreamPlugin() : InputPlugin(info, iinfo) {}
//constexpr VgmstreamPlugin() : InputPlugin (info, InputInfo().with_exts(exts)) {}
constexpr VgmstreamPlugin() : InputPlugin (info, NULL) {}
constexpr VgmstreamPlugin() : InputPlugin (info, InputInfo()) {}
bool init();
void cleanup();

View File

@ -70,12 +70,12 @@ STREAMFILE *open_vfs_by_VFSFILE(VFSFile *file, const char *path) {
// success, set our pointers
memset(streamfile, 0, sizeof(VFSSTREAMFILE));
streamfile->sf.read = read_vfs;
streamfile->sf.get_size = get_size_vfs;
streamfile->sf.get_offset = get_offset_vfs;
streamfile->sf.get_name = get_name_vfs;
streamfile->sf.open = open_vfs_impl;
streamfile->sf.close = close_vfs;
streamfile->sf.read = (size_t (*)(STREAMFILE *, uint8_t *, off_t, size_t))read_vfs;
streamfile->sf.get_size = (size_t (*)(STREAMFILE *))get_size_vfs;
streamfile->sf.get_offset = (off_t (*)(STREAMFILE *))get_offset_vfs;
streamfile->sf.get_name = (void (*)(STREAMFILE *, char *, size_t))get_name_vfs;
streamfile->sf.open = (STREAMFILE *(*)(STREAMFILE *, const char *, size_t))open_vfs_impl;
streamfile->sf.close = (void (*)(STREAMFILE *))close_vfs;
streamfile->vfsFile = file;
streamfile->offset = 0;

74
cli/CMakeLists.txt Normal file
View File

@ -0,0 +1,74 @@
# CLI
add_executable(vgmstream_cli
vgmstream_cli.c)
# Link to the vgmstream library
target_link_libraries(vgmstream_cli libvgmstream)
setup_target(vgmstream_cli TRUE)
if(WIN32)
# Add the preprocessor definitions
target_compile_definitions(vgmstream_cli PRIVATE _CONSOLE)
# Link to the getopt library
target_link_libraries(vgmstream_cli getopt)
# Make sure that the binary directory is included (for version.h), as well as the getopt library include directory
target_include_directories(vgmstream_cli PRIVATE
${CMAKE_BINARY_DIR}
${CMAKE_SOURCE_DIR}/ext_libs/Getopt)
# Include the version string
if(MSVC)
add_dependencies(vgmstream_cli version_h)
elseif(MINGW)
if(VGMSTREAM_VERSION)
target_compile_definitions(vgmstream_cli PRIVATE VERSION="${VGMSTREAM_VERSION}")
endif()
# Also, on MinGW when using GCC, these flags need to be included to prevent requiring MinGW's runtime DLLs from being included, which does unfortunately increase the size of the EXE
if(NOT CMAKE_CXX_COMPILER_ID MATCHES Clang)
set_target_properties(vgmstream_cli PROPERTIES
LINK_FLAGS "-static-libgcc -static-libstdc++")
endif()
endif()
# Install the DLLs
install_dlls(${CMAKE_INSTALL_PREFIX}/bin)
elseif(VGMSTREAM_VERSION)
# Include the version string
target_compile_definitions(vgmstream_cli PRIVATE VERSION="${VGMSTREAM_VERSION}")
endif()
# Install the CLI program
install(TARGETS vgmstream_cli
RUNTIME DESTINATION bin)
# TODO: Make it so vgmstream123 can build with Windows (this probably needs a libao.dll included with vgmstream, though)
if(NOT WIN32)
# vgmstream123
add_executable(vgmstream123
vgmstream123.c)
# Link to the vgmstream library as well as libao
target_link_libraries(vgmstream123
libvgmstream
${AO_LIBRARY})
setup_target(vgmstream123 TRUE)
# Add AO include directory
target_include_directories(vgmstream123 PRIVATE
${AO_INCLUDE_DIR})
# Include the version string
target_compile_definitions(vgmstream123 PRIVATE VERSION="${VGMSTREAM_VERSION}")
# Install vgmstream123
install(TARGETS vgmstream123
RUNTIME DESTINATION bin)
endif()

View File

@ -33,12 +33,14 @@
#else
# include <signal.h>
# include <unistd.h>
# include <sys/wait.h>
#endif
#include "../src/vgmstream.h"
#undef VERSION
#include "../version.h"
#ifndef VERSION
# include "version.h"
#endif
#ifndef VERSION
# define VERSION "(unknown version)"
#endif

View File

@ -15,7 +15,7 @@
#endif
#ifndef VERSION
#include "../version.h"
#include "version.h"
#endif
#ifndef VERSION
#define VERSION "(unknown version)"

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
@ -71,7 +71,7 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>../ext_libs/Getopt;../ext_includes;$(DependenciesDir)/qaac/mp4v2/include;$(DependenciesDir)/fdk-aac/libSYS/include;$(DependenciesDir)/fdk-aac/libAACdec/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>..;../ext_libs/Getopt;../ext_includes;$(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_MP4V2;VGM_USE_FDKAAC;VGM_USE_ATRAC9;VGM_USE_CELT;_DEBUG;_WINDOWS;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
@ -97,7 +97,7 @@
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<AdditionalIncludeDirectories>../ext_libs/Getopt;../ext_includes;$(DependenciesDir)/qaac/mp4v2/include;$(DependenciesDir)/fdk-aac/libSYS/include;$(DependenciesDir)/fdk-aac/libAACdec/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>..;../ext_libs/Getopt;../ext_includes;$(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_MP4V2;VGM_USE_FDKAAC;VGM_USE_ATRAC9;VGM_USE_CELT;NDEBUG;_WINDOWS;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<PrecompiledHeader>

42
cmake/FindAO.cmake Normal file
View File

@ -0,0 +1,42 @@
if(AO_INCLUDE_DIR)
# Already in cache, be silent
set(AO_FIND_QUIETLY TRUE)
endif(AO_INCLUDE_DIR)
find_path(AO_INCLUDE_DIR ao/ao.h
/opt/local/include
/usr/local/include
/usr/include
)
set(AO_NAMES ao)
find_library(AO_LIBRARY
NAMES ${AO_NAMES}
PATHS /usr/lib /usr/local/lib /opt/local/lib
)
if(AO_INCLUDE_DIR AND AO_LIBRARY)
set(AO_FOUND TRUE)
set(AO_LIBRARIES ${AO_LIBRARY})
else(AO_INCLUDE_DIR AND AO_LIBRARY)
set(AO_FOUND FALSE)
set(AO_LIBRARIES)
endif(AO_INCLUDE_DIR AND AO_LIBRARY)
if(AO_FOUND)
if(NOT AO_FIND_QUIETLY)
message(STATUS "Found AO: ${AO_LIBRARY}")
endif(NOT AO_FIND_QUIETLY)
else(AO_FOUND)
if(AO_FIND_REQUIRED)
message(STATUS "Looked for ao libraries named ${AO_NAMES}.")
message(STATUS "Include file detected: [${AO_INCLUDE_DIR}].")
message(STATUS "Lib file detected: [${AO_LIBRARY}].")
message(FATAL_ERROR "=========> Could NOT find ao library")
endif(AO_FIND_REQUIRED)
endif(AO_FOUND)
mark_as_advanced(
AO_LIBRARY
AO_INCLUDE_DIR
)

146
cmake/FindFFmpeg.cmake Normal file
View File

@ -0,0 +1,146 @@
# vim: ts=2 sw=2
# - Try to find the required ffmpeg components(default: AVFORMAT, AVUTIL, AVCODEC)
#
# Once done this will define
# FFMPEG_FOUND - System has the all required components.
# FFMPEG_INCLUDE_DIRS - Include directory necessary for using the required components headers.
# FFMPEG_LIBRARIES - Link these to use the required ffmpeg components.
# FFMPEG_DEFINITIONS - Compiler switches required for using the required ffmpeg components.
#
# For each of the components it will additionally set.
# - AVCODEC
# - AVDEVICE
# - AVFORMAT
# - AVFILTER
# - AVUTIL
# - POSTPROC
# - SWSCALE
# the following variables will be defined
# <component>_FOUND - System has <component>
# <component>_INCLUDE_DIRS - Include directory necessary for using the <component> headers
# <component>_LIBRARIES - Link these to use <component>
# <component>_DEFINITIONS - Compiler switches required for using <component>
# <component>_VERSION - The components version
#
# Copyright (c) 2006, Matthias Kretz, <kretz@kde.org>
# Copyright (c) 2008, Alexander Neundorf, <neundorf@kde.org>
# Copyright (c) 2011, Michael Jansen, <kde@michael-jansen.biz>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
# Comes from https://github.com/snikulov/cmake-modules/blob/master/FindFFmpeg.cmake
include(FindPackageHandleStandardArgs)
# The default components were taken from a survey over other FindFFMPEG.cmake files
if(NOT FFmpeg_FIND_COMPONENTS)
set(FFmpeg_FIND_COMPONENTS AVCODEC AVFORMAT AVUTIL)
endif()
#
### Macro: set_component_found
#
# Marks the given component as found if both *_LIBRARIES AND *_INCLUDE_DIRS is present.
#
macro(set_component_found _component)
if(${_component}_LIBRARIES AND ${_component}_INCLUDE_DIRS)
# message(STATUS " - ${_component} found.")
set(${_component}_FOUND TRUE)
else()
# message(STATUS " - ${_component} not found.")
endif()
endmacro()
#
### Macro: find_component
#
# Checks for the given component by invoking pkgconfig and then looking up the libraries and
# include directories.
#
macro(find_component _component _pkgconfig _library _header)
if(NOT WIN32)
# use pkg-config to get the directories and then use these values
# in the FIND_PATH() and FIND_LIBRARY() calls
find_package(PkgConfig)
if(PKG_CONFIG_FOUND)
pkg_check_modules(PC_${_component} ${_pkgconfig})
endif()
endif(NOT WIN32)
find_path(${_component}_INCLUDE_DIRS ${_header}
HINTS
${PC_LIB${_component}_INCLUDEDIR}
${PC_LIB${_component}_INCLUDE_DIRS}
PATH_SUFFIXES ffmpeg)
find_library(${_component}_LIBRARIES NAMES ${_library}
HINTS
${PC_LIB${_component}_LIBDIR}
${PC_LIB${_component}_LIBRARY_DIRS})
set(${_component}_DEFINITIONS ${PC_${_component}_CFLAGS_OTHER} CACHE STRING "The ${_component} CFLAGS.")
set(${_component}_VERSION ${PC_${_component}_VERSION} CACHE STRING "The ${_component} version number.")
set_component_found(${_component})
mark_as_advanced(
${_component}_INCLUDE_DIRS
${_component}_LIBRARIES
${_component}_DEFINITIONS
${_component}_VERSION)
endmacro()
# Check for cached results. If there are skip the costly part.
if(NOT FFMPEG_LIBRARIES)
# Check for all possible component.
find_component(AVCODEC libavcodec avcodec libavcodec/avcodec.h)
find_component(AVFORMAT libavformat avformat libavformat/avformat.h)
find_component(AVDEVICE libavdevice avdevice libavdevice/avdevice.h)
find_component(AVUTIL libavutil avutil libavutil/avutil.h)
find_component(AVFILTER libavfilter avfilter libavfilter/avfilter.h)
find_component(SWSCALE libswscale swscale libswscale/swscale.h)
find_component(POSTPROC libpostproc postproc libpostproc/postprocess.h)
find_component(SWRESAMPLE libswresample swresample libswresample/swresample.h)
# Check if the required components were found and add their stuff to the FFMPEG_* vars.
foreach(_component ${FFmpeg_FIND_COMPONENTS})
if(${_component}_FOUND)
# message(STATUS "Required component ${_component} present.")
set(FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} ${${_component}_LIBRARIES})
set(FFMPEG_DEFINITIONS ${FFMPEG_DEFINITIONS} ${${_component}_DEFINITIONS})
list(APPEND FFMPEG_INCLUDE_DIRS ${${_component}_INCLUDE_DIRS})
else()
# message(STATUS "Required component ${_component} missing.")
endif()
endforeach()
# Build the include path with duplicates removed.
if(FFMPEG_INCLUDE_DIRS)
list(REMOVE_DUPLICATES FFMPEG_INCLUDE_DIRS)
endif()
# cache the vars.
set(FFMPEG_INCLUDE_DIRS ${FFMPEG_INCLUDE_DIRS} CACHE STRING "The FFmpeg include directories." FORCE)
set(FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} CACHE STRING "The FFmpeg libraries." FORCE)
set(FFMPEG_DEFINITIONS ${FFMPEG_DEFINITIONS} CACHE STRING "The FFmpeg cflags." FORCE)
mark_as_advanced(
FFMPEG_INCLUDE_DIRS
FFMPEG_LIBRARIES
FFMPEG_DEFINITIONS)
endif()
# Now set the noncached _FOUND vars for the components.
foreach(_component AVCODEC AVDEVICE AVFORMAT AVUTIL POSTPROCESS SWSCALE)
set_component_found(${_component})
endforeach()
# Compile the list of required vars
set(_FFmpeg_REQUIRED_VARS FFMPEG_LIBRARIES FFMPEG_INCLUDE_DIRS)
foreach(_component ${FFmpeg_FIND_COMPONENTS})
list(APPEND _FFmpeg_REQUIRED_VARS ${_component}_LIBRARIES ${_component}_INCLUDE_DIRS)
endforeach()
# Give a nice error message if some of the required vars are missing.
find_package_handle_standard_args(FFmpeg DEFAULT_MSG ${_FFmpeg_REQUIRED_VARS})

24
cmake/FindMPG123.cmake Normal file
View File

@ -0,0 +1,24 @@
# - Find mpg123
# Find the native mpg123 includes and library
#
# MPG123_INCLUDE_DIR - where to find mpg123.h
# MPG123_LIBRARIES - List of libraries when using mpg123.
# MPG123_FOUND - True if mpg123 found.
# Comes from https://github.com/coelckers/gzdoom/blob/master/cmake/FindMPG123.cmake
if(MPG123_INCLUDE_DIR AND MPG123_LIBRARIES)
# Already in cache, be silent
set(MPG123_FIND_QUIETLY TRUE)
endif()
find_path(MPG123_INCLUDE_DIR mpg123.h PATHS "${MPG123_DIR}" PATH_SUFFIXES include)
find_library(MPG123_LIBRARIES NAMES mpg123 mpg123-0 PATHS "${MPG123_DIR}" PATH_SUFFIXES lib)
# MARK_AS_ADVANCED(MPG123_LIBRARIES MPG123_INCLUDE_DIR)
# handle the QUIETLY and REQUIRED arguments and set MPG123_FOUND to TRUE if
# all listed variables are TRUE
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(MPG123 DEFAULT_MSG MPG123_LIBRARIES MPG123_INCLUDE_DIR)

63
cmake/FindOgg.cmake Normal file
View File

@ -0,0 +1,63 @@
# - Find ogg
# Find the native ogg includes and libraries
#
# OGG_INCLUDE_DIRS - where to find ogg.h, etc.
# OGG_LIBRARIES - List of libraries when using ogg.
# OGG_FOUND - True if ogg found.
# Comes from https://github.com/erikd/libsndfile/blob/master/cmake/FindOgg.cmake
if(OGG_INCLUDE_DIR)
# Already in cache, be silent
set(OGG_FIND_QUIETLY TRUE)
endif()
find_package(PkgConfig QUIET)
pkg_check_modules(PC_OGG QUIET ogg>=1.3.0)
set(OGG_VERSION ${PC_OGG_VERSION})
find_path(OGG_INCLUDE_DIR ogg/ogg.h
HINTS
${PC_OGG_INCLUDEDIR}
${PC_OGG_INCLUDE_DIRS}
${OGG_ROOT}
)
# MSVC built ogg may be named ogg_static.
# The provided project files name the library with the lib prefix.
find_library(OGG_LIBRARY
NAMES
ogg
ogg_static
libogg
libogg_static
HINTS
${PC_OGG_LIBDIR}
${PC_OGG_LIBRARY_DIRS}
${OGG_ROOT}
)
# Handle the QUIETLY and REQUIRED arguments and set OGG_FOUND
# to TRUE if all listed variables are TRUE.
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args (Ogg
REQUIRED_VARS
OGG_LIBRARY
OGG_INCLUDE_DIR
VERSION_VAR
OGG_VERSION
)
if(OGG_FOUND)
set(OGG_LIBRARIES ${OGG_LIBRARY})
set(OGG_INCLUDE_DIRS ${OGG_INCLUDE_DIR})
if(NOT TARGET Ogg::Ogg)
add_library(Ogg::Ogg UNKNOWN IMPORTED)
set_target_properties(Ogg::Ogg PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${OGG_INCLUDE_DIRS}"
IMPORTED_LOCATION "${OGG_LIBRARIES}"
)
endif()
endif()
mark_as_advanced(OGG_INCLUDE_DIR OGG_LIBRARY)

66
cmake/FindVorbis.cmake Normal file
View File

@ -0,0 +1,66 @@
# - Find vorbisenc
# Find the native vorbisenc includes and libraries
#
# VORBIS_INCLUDE_DIRS - where to find vorbis.h, etc.
# VORBIS_LIBRARIES - List of libraries when using vorbis.
# VORBIS_FOUND - True if vorbis found.
# Comes from https://github.com/erikd/libsndfile/blob/master/cmake/FindVorbis.cmake
if(VORBIS_INCLUDE_DIR)
# Already in cache, be silent
set(VORBIS_FIND_QUIETLY TRUE)
endif()
find_package(Ogg QUIET)
find_package(PkgConfig QUIET)
pkg_check_modules(PC_VORBIS QUIET vorbis)
set(VORBIS_VERSION ${PC_VORBIS_VERSION})
find_path(VORBIS_INCLUDE_DIR vorbis/codec.h
HINTS
${PC_VORBIS_INCLUDEDIR}
${PC_VORBIS_INCLUDE_DIRS}
${VORBIS_ROOT}
)
find_library(VORBIS_LIBRARY
NAMES
vorbis
vorbis_static
libvorbis
libvorbis_static
HINTS
${PC_VORBIS_LIBDIR}
${PC_VORBIS_LIBRARY_DIRS}
${VORBIS_ROOT}
)
# Handle the QUIETLY and REQUIRED arguments and set VORBIS_FOUND
# to TRUE if all listed variables are TRUE.
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Vorbis
REQUIRED_VARS
VORBIS_LIBRARY
VORBIS_INCLUDE_DIR
OGG_FOUND
VERSION_VAR
VORBIS_VERSION
)
if(VORBIS_FOUND)
set(VORBIS_INCLUDE_DIRS ${VORBIS_INCLUDE_DIR})
set(VORBIS_LIBRARIES ${VORBIS_LIBRARY} ${OGG_LIBRARIES})
if(NOT TARGET Vorbis::Vorbis)
add_library(Vorbis::Vorbis UNKNOWN IMPORTED)
set_target_properties(Vorbis::Vorbis PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${VORBIS_INCLUDE_DIR}"
IMPORTED_LOCATION "${VORBIS_LIBRARY}"
INTERFACE_LINK_LIBRARIES Ogg::Ogg
)
endif()
endif()
mark_as_advanced(VORBIS_INCLUDE_DIR VORBIS_LIBRARY)

View File

@ -0,0 +1,66 @@
# - Find vorbisfile
# Find the native vorbisfile includes and libraries
#
# VORBISFILE_INCLUDE_DIRS - where to find vorbisfile.h, etc.
# VORBISFILE_LIBRARIES - List of libraries when using vorbisfile.
# VORBISFILE_FOUND - True if vorbisfile found.
# Adapted from https://github.com/erikd/libsndfile/blob/master/cmake/FindVorbisEnc.cmake
if(VORBISFILE_INCLUDE_DIR)
# Already in cache, be silent
set(VORBISFILE_FIND_QUIETLY TRUE)
endif()
find_package(Vorbis QUIET)
find_package(PkgConfig QUIET)
pkg_check_modules(PC_VORBISFILE QUIET vorbisfile)
set(VORBISFILE_VERSION ${PC_VORBISFILE_VERSION})
find_path(VORBISFILE_INCLUDE_DIR vorbis/vorbisfile.h
HINTS
${PC_VORBISFILE_INCLUDEDIR}
${PC_VORBISFILE_INCLUDE_DIRS}
${VORBISFILE_ROOT}
)
find_library(VORBISFILE_LIBRARY
NAMES
vorbisfile
vorbisfile_static
libvorbisfile
libvorbisfile_static
HINTS
${PC_VORBISFILE_LIBDIR}
${PC_VORBISFILE_LIBRARY_DIRS}
${VORBISFILE_ROOT}
)
# Handle the QUIETLY and REQUIRED arguments and set VORBISFILE_FOUND
# to TRUE if all listed variables are TRUE.
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(VorbisFile
REQUIRED_VARS
VORBISFILE_LIBRARY
VORBISFILE_INCLUDE_DIR
VORBIS_FOUND
VERSION_VAR
VORBISFILE_VERSION
)
if(VORBISFILE_FOUND)
set(VORBISFILE_INCLUDE_DIRS ${VORBISFILE_INCLUDE_DIR})
set(VORBISFILE_LIBRARIES ${VORBISFILE_LIBRARY} ${VORBIS_LIBRARIES})
if(NOT TARGET Vorbis::VorbisFile)
add_library(Vorbis::VorbisFile UNKNOWN IMPORTED)
set_target_properties(Vorbis::VorbisFile PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${VORBISFILE_INCLUDE_DIR}"
IMPORTED_LOCATION "${VORBISFILE_LIBRARY}"
INTERFACE_LINK_LIBRARIES Vorbis::Vorbis
)
endif()
endif()
mark_as_advanced(VORBISFILE_INCLUDE_DIR VORBISFILE_LIBRARY)

83
cmake/fdk-aac.cmake Normal file
View File

@ -0,0 +1,83 @@
# ALthough fdk-aac does have a Visual Studio project for Windows, this will also cover other compilers and platforms
file(GLOB LIBAACDEC_HEADERS "${FDK_AAC_PATH}/libAACdec/include/*.h" "${FDK_AAC_PATH}/libAACdec/src/*.h")
file(GLOB LIBAACDEC_SOURCES "${FDK_AAC_PATH}/libAACdec/src/*.cpp")
file(GLOB LIBAACENC_HEADERS "${FDK_AAC_PATH}/libAACenc/include/*.h" "${FDK_AAC_PATH}/libAACenc/src/*.h")
file(GLOB LIBAACENC_SOURCES "${FDK_AAC_PATH}/libAACenc/src/*.cpp")
file(GLOB LIBFDK_HEADERS "${FDK_AAC_PATH}/libFDK/include/*.h" "${FDK_AAC_PATH}/libFDK/include/x86/*h")
file(GLOB LIBFDK_SOURCES "${FDK_AAC_PATH}/libFDK/src/*.cpp")
file(GLOB LIBMPEGTPDEC_HEADERS "${FDK_AAC_PATH}/libMpegTPDec/include/*.h" "${FDK_AAC_PATH}/libMpegTPDec/src/*.h")
file(GLOB LIBMPEGTPDEC_SOURCES "${FDK_AAC_PATH}/libMpegTPDec/src/*.cpp")
file(GLOB LIBMPEGTPENC_HEADERS "${FDK_AAC_PATH}/libMpegTPEnc/include/*.h" "${FDK_AAC_PATH}/libMpegTPEnc/src/*.h")
file(GLOB LIBMPEGTPENC_SOURCES "${FDK_AAC_PATH}/libMpegTPEnc/src/*.cpp")
file(GLOB LIBPCMUTILS_HEADERS "${FDK_AAC_PATH}/libPCMutils/include/*.h")
file(GLOB LIBPCMUTILS_SOURCES "${FDK_AAC_PATH}/libPCMutils/src/*.cpp")
file(GLOB LIBSBRDEC_HEADERS "${FDK_AAC_PATH}/libSBRdec/include/*.h" "${FDK_AAC_PATH}/libSBRdec/src/*.h")
file(GLOB LIBSBRDEC_SOURCES "${FDK_AAC_PATH}/libSBRdec/src/*.cpp")
file(GLOB LIBSBRENC_HEADERS "${FDK_AAC_PATH}/libSBRenc/include/*.h" "${FDK_AAC_PATH}/libSBRenc/src/*.h")
file(GLOB LIBSBRENC_SOURCES "${FDK_AAC_PATH}/libSBRenc/src/*.cpp")
file(GLOB LIBSYS_HEADERS "${FDK_AAC_PATH}/libSYS/include/*.h")
file(GLOB LIBSYS_SOURCES "${FDK_AAC_PATH}/libSYS/src/*.cpp")
if(NOT WIN32)
file(GLOB LIBSYS_LINUX_SOURCES "${FDK_AAC_PATH}/libSYS/linux/*.cpp")
endif()
# Setup source groups, mainly for Visual Studio
source_group("Header Files\\libAACdec" FILES ${LIBAACDEC_HEADERS})
source_group("Header Files\\libAACenc" FILES ${LIBAACENC_HEADERS})
source_group("Header Files\\libFDK" FILES ${LIBFDK_HEADERS})
source_group("Header Files\\libMpegTPDec" FILES ${LIBMPEGTPDEC_HEADERS})
source_group("Header Files\\libMpegTPEnc" FILES ${LIBMPEGTPENC_HEADERS})
source_group("Header Files\\libPCMutils" FILES ${LIBPCMUTILS_HEADERS})
source_group("Header Files\\libSBRdec" FILES ${LIBSBRDEC_HEADERS})
source_group("Header Files\\libSBRenc" FILES ${LIBSBRENC_HEADERS})
source_group("Header Files\\libSYS" FILES ${LIBSYS_HEADERS})
source_group("Source Files\\libAACdec" FILES ${LIBAACDEC_SOURCES})
source_group("Source Files\\libAACenc" FILES ${LIBAACENC_SOURCES})
source_group("Source Files\\libFDK" FILES ${LIBFDK_SOURCES})
source_group("Source Files\\libMpegTPDec" FILES ${LIBMPEGTPDEC_SOURCES})
source_group("Source Files\\libMpegTPEnc" FILES ${LIBMPEGTPENC_SOURCES})
source_group("Source Files\\libPCMutils" FILES ${LIBPCMUTILS_SOURCES})
source_group("Source Files\\libSBRdec" FILES ${LIBSBRDEC_SOURCES})
source_group("Source Files\\libSBRenc" FILES ${LIBSBRENC_SOURCES})
source_group("Source Files\\libSYS" FILES ${LIBSYS_SOURCES} ${LIBSYS_LINUX_SOURCES})
add_library(fdk-aac STATIC
${LIBAACDEC_HEADERS}
${LIBAACDEC_SOURCES}
${LIBAACENC_HEADERS}
${LIBAACENC_SOURCES}
${LIBFDK_HEADERS}
${LIBFDK_SOURCES}
${LIBMPEGTPDEC_HEADERS}
${LIBMPEGTPDEC_SOURCES}
${LIBMPEGTPENC_HEADERS}
${LIBMPEGTPENC_SOURCES}
${LIBPCMUTILS_HEADERS}
${LIBPCMUTILS_SOURCES}
${LIBSBRDEC_HEADERS}
${LIBSBRDEC_SOURCES}
${LIBSBRENC_HEADERS}
${LIBSBRENC_SOURCES}
${LIBSYS_HEADERS}
${LIBSYS_SOURCES}
${LIBSYS_LINUX_SOURCES})
# Set up the proper include directories
target_include_directories(fdk-aac PRIVATE
${FDK_AAC_PATH}/libAACdec/include
${FDK_AAC_PATH}/libAACenc/include
${FDK_AAC_PATH}/libSBRdec/include
${FDK_AAC_PATH}/libSBRenc/include
${FDK_AAC_PATH}/libMpegTPDec/include
${FDK_AAC_PATH}/libMpegTPEnc/include
${FDK_AAC_PATH}/libSYS/include
${FDK_AAC_PATH}/libFDK/include
${FDK_AAC_PATH}/libPCMutils/include)
# Make sure that whatever compiler we use can handle these features
target_compile_features(fdk-aac PRIVATE cxx_long_long_type)
# Set up position-independent code
set_target_properties(fdk-aac PROPERTIES
POSITION_INDEPENDENT_CODE TRUE)

115
cmake/mp4v2.cmake Normal file
View File

@ -0,0 +1,115 @@
# qaac doesn't have a Visual Studio project for Windows, so this not only allows things to build for Visual Studio, but also covers other compilers and platforms
configure_file(${QAAC_PATH}/mp4v2/libplatform/config.h.in ${CMAKE_BINARY_DIR}/mp4v2/include/libplatform/config.h COPYONLY)
file(GLOB INCLUDE_HEADERS "${QAAC_PATH}/mp4v2/include/mp4v2/*.h")
file(GLOB LIBPLATFORM_HEADERS "${QAAC_PATH}/mp4v2/libplatform/*.h")
file(GLOB LIBPLATFORM_IO_HEADERS "${QAAC_PATH}/mp4v2/libplatform/io/*.h")
file(GLOB LIBPLATFORM_IO_SOURCES "${QAAC_PATH}/mp4v2/libplatform/io/*.cpp")
file(GLOB LIBPLATFORM_NUMBER_HEADERS "${QAAC_PATH}/mp4v2/libplatform/number/*.h")
file(GLOB LIBPLATFORM_PROCESS_HEADERS "${QAAC_PATH}/mp4v2/libplatform/process/*.h")
file(GLOB LIBPLATFORM_PROG_HEADERS "${QAAC_PATH}/mp4v2/libplatform/prog/*.h")
list(FILTER LIBPLATFORM_PROG_HEADERS EXCLUDE REGEX ".*commandline.*")
file(GLOB LIBPLATFORM_PROG_SOURCES "${QAAC_PATH}/mp4v2/libplatform/prog/*.cpp")
list(FILTER LIBPLATFORM_PROG_SOURCES EXCLUDE REGEX ".*commandline.*")
file(GLOB LIBPLATFORM_SYS_HEADERS "${QAAC_PATH}/mp4v2/libplatform/sys/*.h")
file(GLOB LIBPLATFORM_SYS_SOURCES "${QAAC_PATH}/mp4v2/libplatform/sys/*.cpp")
file(GLOB LIBPLATFORM_TIME_HEADERS "${QAAC_PATH}/mp4v2/libplatform/time/*.h")
file(GLOB LIBPLATFORM_TIME_SOURCES "${QAAC_PATH}/mp4v2/libplatform/time/*.cpp")
file(GLOB SRC_HEADERS "${QAAC_PATH}/mp4v2/src/*.h")
file(GLOB SRC_SOURCES "${QAAC_PATH}/mp4v2/src/*.cpp")
file(GLOB SRC_BMFF_HEADERS "${QAAC_PATH}/mp4v2/src/bmff/*.h")
file(GLOB SRC_BMFF_SOURCES "${QAAC_PATH}/mp4v2/src/bmff/*.cpp")
file(GLOB SRC_ITMF_HEADERS "${QAAC_PATH}/mp4v2/src/itmf/*.h")
file(GLOB SRC_ITMF_SOURCES "${QAAC_PATH}/mp4v2/src/itmf/*.cpp")
file(GLOB SRC_QTFF_HEADERS "${QAAC_PATH}/mp4v2/src/qtff/*.h")
file(GLOB SRC_QTFF_SOURCES "${QAAC_PATH}/mp4v2/src/qtff/*.cpp")
if(WIN32)
list(FILTER LIBPLATFORM_HEADERS EXCLUDE REGEX ".*posix.*")
set(LIBPLATFORM_SOURCES
${QAAC_PATH}/mp4v2/libplatform/platform_win32.cpp)
list(FILTER LIBPLATFORM_IO_SOURCES EXCLUDE REGEX ".*posix.*")
set(LIBPLATFORM_NUMBER_SOURCES
${QAAC_PATH}/mp4v2/libplatform/number/random_win32.cpp)
set(LIBPLATFORM_PROCESS_SOURCES
${QAAC_PATH}/mp4v2/libplatform/process/process_win32.cpp)
list(FILTER LIBPLATFORM_TIME_SOURCES EXCLUDE REGEX ".*posix.*")
else()
list(FILTER LIBPLATFORM_HEADERS EXCLUDE REGEX ".*win32.*")
list(FILTER LIBPLATFORM_IO_SOURCES EXCLUDE REGEX ".*win32.*")
set(LIBPLATFORM_NUMBER_SOURCES
${QAAC_PATH}/mp4v2/libplatform/number/random_posix.cpp)
set(LIBPLATFORM_PROCESS_SOURCES
${QAAC_PATH}/mp4v2/libplatform/process/process_posix.cpp)
list(FILTER LIBPLATFORM_TIME_SOURCES EXCLUDE REGEX ".*win32.*")
endif()
# Setup source groups, mainly for Visual Studio
source_group("Header Files\\libplatform" FILES ${LIBPLATFORM_HEADERS})
source_group("Header Files\\libplatform\\io" FILES ${LIBPLATFORM_IO_HEADERS})
source_group("Header Files\\libplatform\\number" FILES ${LIBPLATFORM_NUMBER_HEADERS})
source_group("Header Files\\libplatform\\process" FILES ${LIBPLATFORM_PROCESS_HEADERS})
source_group("Header Files\\libplatform\\prog" FILES ${LIBPLATFORM_PROG_HEADERS})
source_group("Header Files\\libplatform\\sys" FILES ${LIBPLATFORM_SYS_HEADERS})
source_group("Header Files\\libplatform\\time" FILES ${LIBPLATFORM_TIME_HEADERS})
source_group("Header Files\\src" FILES ${SRC_HEADERS})
source_group("Header Files\\src\\bmff" FILES ${SRC_BMFF_HEADERS})
source_group("Header Files\\src\\itmf" FILES ${SRC_ITMF_HEADERS})
source_group("Header Files\\src\\qtff" FILES ${SRC_QTFF_HEADERS})
source_group("Source Files\\libplatform" FILES ${LIBPLATFORM_SOURCES})
source_group("Source Files\\libplatform\\io" FILES ${LIBPLATFORM_IO_SOURCES})
source_group("Source Files\\libplatform\\number" FILES ${LIBPLATFORM_NUMBER_SOURCES})
source_group("Source Files\\libplatform\\process" FILES ${LIBPLATFORM_PROCESS_SOURCES})
source_group("Source Files\\libplatform\\prog" FILES ${LIBPLATFORM_PROG_SOURCES})
source_group("Source Files\\libplatform\\sys" FILES ${LIBPLATFORM_SYS_SOURCES})
source_group("Source Files\\libplatform\\time" FILES ${LIBPLATFORM_TIME_SOURCES})
source_group("Source Files\\src" FILES ${SRC_SOURCES})
source_group("Source Files\\src\\bmff" FILES ${SRC_BMFF_SOURCES})
source_group("Source Files\\src\\itmf" FILES ${SRC_ITMF_SOURCES})
source_group("Source Files\\src\\qtff" FILES ${SRC_QTFF_SOURCES})
add_library(mp4v2 STATIC
${INCLUDE_HEADERS}
${LIBPLATFORM_HEADERS}
${LIBPLATFORM_SOURCES}
${LIBPLATFORM_IO_HEADERS}
${LIBPLATFORM_IO_SOURCES}
${LIBPLATFORM_NUMBER_HEADERS}
${LIBPLATFORM_NUMBER_SOURCES}
${LIBPLATFORM_PROCESS_HEADERS}
${LIBPLATFORM_PROCESS_SOURCES}
${LIBPLATFORM_PROG_HEADERS}
${LIBPLATFORM_PROG_SOURCES}
${LIBPLATFORM_SYS_HEADERS}
${LIBPLATFORM_SYS_SOURCES}
${LIBPLATFORM_TIME_HEADERS}
${LIBPLATFORM_TIME_SOURCES}
${SRC_HEADERS}
${SRC_SOURCES}
${SRC_BMFF_HEADERS}
${SRC_BMFF_SOURCES}
${SRC_ITMF_HEADERS}
${SRC_ITMF_SOURCES}
${SRC_QTFF_HEADERS}
${SRC_QTFF_SOURCES})
# Add the preprocessor definitions
target_compile_definitions(mp4v2 PRIVATE
UNICODE
_UNICODE)
# Set up the proper include directories
target_include_directories(mp4v2 PRIVATE
${QAAC_PATH}/mp4v2
${QAAC_PATH}/mp4v2/include
${CMAKE_BINARY_DIR}/mp4v2/include)
# Make sure that whatever compiler we use can handle these features
target_compile_features(mp4v2 PRIVATE
cxx_long_long_type
cxx_variadic_macros)
# Set up position-independent code
set_target_properties(mp4v2 PROPERTIES
POSITION_INDEPENDENT_CODE TRUE)

163
cmake/vgmstream.cmake Normal file
View File

@ -0,0 +1,163 @@
# Setup a target to have the proper preprocessor definitions, include directories, dependencies and link libraries
# Can take either 1 argument, the target, or 2 arguments, the target and a boolean that, if set to TRUE, will add the link libraries
macro(setup_target TARGET)
set(LINK FALSE)
if(${ARGC} GREATER 1)
if(${ARGV1})
set(LINK TRUE)
endif()
endif()
# Common preprocessor definitions and include directories
if(WIN32)
target_compile_definitions(${TARGET} PRIVATE
_WIN32_WINNT=0x501
_CRT_SECURE_NO_WARNINGS)
endif()
target_include_directories(${TARGET} PRIVATE ${CMAKE_SOURCE_DIR}/ext_includes)
# Set up position-independent code for all targets
set_target_properties(${TARGET} PROPERTIES
POSITION_INDEPENDENT_CODE TRUE)
if(USE_FDKAAC)
target_compile_definitions(${TARGET} PRIVATE
VGM_USE_MP4V2
VGM_USE_FDKAAC)
target_include_directories(${TARGET} PRIVATE
${QAAC_PATH}/mp4v2/include
${CMAKE_BINARY_DIR}/mp4v2/include
${FDK_AAC_PATH}/libSYS/include
${FDK_AAC_PATH}/libAACdec/include)
if(LINK)
target_link_libraries(${TARGET}
fdk-aac
mp4v2)
endif()
endif()
if(USE_MPEG)
target_compile_definitions(${TARGET} PRIVATE VGM_USE_MPEG)
if(WIN32)
if(LINK)
add_dependencies(${TARGET} libmpg123)
target_link_libraries(${TARGET} ${CMAKE_BINARY_DIR}/ext_libs/libmpg123-0.lib)
endif()
else()
target_include_directories(${TARGET} PRIVATE ${MPG123_INCLUDE_DIR})
if(LINK)
target_link_libraries(${TARGET} ${MPG123_LIBRARIES})
endif()
endif()
endif()
if(USE_VORBIS)
target_compile_definitions(${TARGET} PRIVATE VGM_USE_VORBIS)
if(WIN32)
if(LINK)
add_dependencies(${TARGET} libvorbis)
target_link_libraries(${TARGET} ${CMAKE_BINARY_DIR}/ext_libs/libvorbis.lib)
endif()
else()
target_include_directories(${TARGET} PRIVATE ${VORBISFILE_INCLUDE_DIRS})
if(LINK)
target_link_libraries(${TARGET} Vorbis::VorbisFile)
endif()
endif()
endif()
if(USE_FFMPEG)
target_compile_definitions(${TARGET} PRIVATE VGM_USE_FFMPEG)
if(WIN32)
if(LINK)
add_dependencies(${TARGET} ffmpeg)
target_link_libraries(${TARGET}
${CMAKE_BINARY_DIR}/ext_libs/avcodec.lib
${CMAKE_BINARY_DIR}/ext_libs/avformat.lib
${CMAKE_BINARY_DIR}/ext_libs/avutil.lib)
endif()
else()
target_include_directories(${TARGET} PRIVATE ${FFMPEG_INCLUDE_DIRS})
if(LINK)
target_link_libraries(${TARGET} ${FFMPEG_LIBRARIES})
endif()
endif()
endif()
if(USE_G7221)
target_compile_definitions(${TARGET} PRIVATE VGM_USE_G7221)
if(LINK)
add_dependencies(${TARGET} libg7221_decode)
target_link_libraries(${TARGET} ${CMAKE_BINARY_DIR}/ext_libs/libg7221_decode.lib)
endif()
endif()
if(USE_G719)
target_compile_definitions(${TARGET} PRIVATE VGM_USE_G719)
if(LINK)
add_dependencies(${TARGET} libg719_decode)
target_link_libraries(${TARGET} ${CMAKE_BINARY_DIR}/ext_libs/libg719_decode.lib)
endif()
endif()
if(USE_MAIATRAC3PLUS)
target_compile_definitions(${TARGET} PRIVATE VGM_USE_MAIATRAC3PLUS)
target_include_directories(${TARGET} PRIVATE ${MAIATRAC3PLUS_PATH}/MaiAT3PlusDecoder)
if(LINK)
target_link_libraries(${TARGET} at3plusdecoder)
endif()
endif()
if(USE_ATRAC9)
target_compile_definitions(${TARGET} PRIVATE VGM_USE_ATRAC9)
if(LINK)
add_dependencies(${TARGET} libatrac9)
target_link_libraries(${TARGET} ${CMAKE_BINARY_DIR}/ext_libs/libatrac9.lib)
endif()
endif()
if(USE_CELT)
target_compile_definitions(${TARGET} PRIVATE VGM_USE_CELT)
if(LINK)
add_dependencies(${TARGET} libcelt)
target_link_libraries(${TARGET}
${CMAKE_BINARY_DIR}/ext_libs/libcelt-0061.lib
${CMAKE_BINARY_DIR}/ext_libs/libcelt-0110.lib)
endif()
endif()
endmacro()
# Installs the DLLs to the given install prefix
macro(install_dlls INSTALL_PREFIX)
# Paths to the DLLs
set(MPEG_DLL ${CMAKE_SOURCE_DIR}/ext_libs/libmpg123-0.dll)
set(VORBIS_DLL ${CMAKE_SOURCE_DIR}/ext_libs/libvorbis.dll)
set(G7221_DLL ${CMAKE_SOURCE_DIR}/ext_libs/libg7221_decode.dll)
set(G719_DLL ${CMAKE_SOURCE_DIR}/ext_libs/libg719_decode.dll)
set(FFMPEG_DLL
${CMAKE_SOURCE_DIR}/ext_libs/avcodec-vgmstream-58.dll
${CMAKE_SOURCE_DIR}/ext_libs/avformat-vgmstream-58.dll
${CMAKE_SOURCE_DIR}/ext_libs/avutil-vgmstream-56.dll
${CMAKE_SOURCE_DIR}/ext_libs/swresample-vgmstream-3.dll)
set(ATRAC9_DLL ${CMAKE_SOURCE_DIR}/ext_libs/libatrac9.dll)
set(CELT_DLL
${CMAKE_SOURCE_DIR}/ext_libs/libcelt-0061.dll
${CMAKE_SOURCE_DIR}/ext_libs/libcelt-0110.dll)
# List of DLLs to check for install
set(DLLS
MPEG
VORBIS
G7221
G719
FFMPEG
ATRAC9
CELT)
# Loop over DLLs and only install if the USE_* is set for that DLL
foreach(DLL ${DLLS})
if(${USE_${DLL}})
install(FILES ${${DLL}_DLL}
DESTINATION ${INSTALL_PREFIX})
endif()
endforeach()
endmacro()

View File

@ -1,5 +1,7 @@
# vgmstream build help
If you wish to use CMake, see [CMAKE.md](CMAKE.md).
## Compilation requirements
**GCC / Make**: In Windows this means one of these two somewhere in PATH:

161
doc/CMAKE.md Normal file
View File

@ -0,0 +1,161 @@
# CMake Build Instructions
## Build requirements
**CMake**: Needs v3.5 or later
- https://cmake.org/download/
**Git**: optional, to generate version numbers:
- Git for Windows: https://git-scm.com/download/win
If building for Windows, you need one of the following:
**GCC / Make**: In Windows this means one of these two somewhere in PATH:
- MinGW-w64 (32bit version): https://sourceforge.net/projects/mingw-w64/
- Use this for easier standalone executables
- Latest online installer with any config should work (for example: gcc-7.2.0, i686, win32, sjlj).
- MSYS2 with the MinGW-w64_shell (32bit) package: https://msys2.github.io/
**MSVC / Visual Studio**: Microsoft's Visual C++ and MSBuild, bundled in either:
- Visual Studio (2015/2017/latest): https://www.visualstudio.com/downloads/
- Visual Studio Community should work (free, but must register after trial period)
- Visual C++ Build Tools (no IDE): http://landinghub.visualstudio.com/visual-cpp-build-tools
If building the CLI for *nix-based OSes, vgmstream123 also needs the following:
- **LibAO**
If building for *nix-based OSes, the following libraries are optional:
- **libmpg123**
- **libvorbis** (really libvorbisfile, though)
- **FFmpeg**
## Build directions
It is recommended to do out-of-source builds as opposed to in-source builds. Out-of-source builds have been tested to work, while in-source builds have not been tested at all.
***NOTE:*** The CMake scripts attempt to collect all the source files are configuration time. If you are following vgmstream development through git or adding your own source files, you **MUST** re-run CMake manually to regenerate the files. Failure to do so can result in either missing functionality or compile errors.
First you will need to run CMake to generate the build setup. You can use either the CMake GUI or run CMake from the command line.
### CMake GUI
If you have access to the CMake GUI, you can use that to create your build setup. Select where the source code is (that should be the directory just above this one) and where you wish to build to.
You may have to add some entries before configuring will succeed. See the [CMake Cache Entries](#cmake-cache-entries) section for details on the entries.
Once the entries are in place, you can click on Generate (or Configure then Generate). This should ask you what build system you wish to use. As long as there are no errors, you should see the following at the bottom of the window:
```
Configuring done
Generating done
```
Before that you'll see what options are enabled and disabled, what is going to be built and where they will be installed to.
If you decided to build for a project-based GUI, you can click on Open Project to open that. (NOTE: Only Visual Studio has been tested as a project-based GUI.) If you decided to build for a command line build system, you can open up the command line for the build directory and run your build system.
### CMake command line
If you don't have access to the CMake GUI or would prefer to only use the command line, you can run CMake from there. Navigate to the directory you wish to build to and run the following:
```
cmake -G "<generator>" <options> <path to source code>
```
Replace `<generator>` with the CMake generator you wish to use as your build system. Make note of the quotes, and use `cmake -h` to get a list of generators for your system.
You may have to add some entries before configuring will success. See the [CMake Cache Entries](#cmake-cache-entries) section for details on the entries.
Place your entries in the `<options>` section of the above command, with each option in the form of `-D<optionname>:<type>=<value>`. Replace `<path to source code>` with the path where the source code is (that should be the directory just above this one).
Once you have run the command, as long as there are no errors, you should see the following at the bottom of the window:
```
Configuring done
Generating done
```
Before that you'll see what options are enabled and disabled, what is going to be built and where they will be installed to.
You can now run the build system you chose as your generator above, whether that be a command line build system like Unix Make or a project-based GUI like Eclipse.
### CMake Cache Entries
The following are the various options and cache entries that you can choose to use when building vgmstream.
If not using a project-based GUI, then you will also need to set what build type you want. This can be set with the `CMAKE_BUILD_TYPE` option and takes one of the following values:
- **Debug**
- **Release**
- **RelWithDebInfo**: Like Release but with debugging information included
- **MinSizeRel**: Like Release but aims for minimum size
#### Library Options
All of these options are of type BOOL and can be set to either `ON` or `OFF`. Most of the details on these libraries can be found in the [External Libraries section of BUILD.md](BUILD.md#external-libraries).
- **USE_FDKAAC**: Chooses if you wish to use FDK-AAC/QAAC for support of MP4 AAC. Note that this requires `QAAC_PATH` and `FDK_AAC_PATH` to also be given if the option is `ON`. The default for is `ON`. See the foobar2000 plugin section of [BUILD.md](BUILD.md) for more information on this.
- **USE_MPEG**: Chooses if you wish to use libmpg123 for support of MP1/MP2/MP3. The default is `ON`.
- **USE_VORBIS**: Chooses if you wish to use libvorbis for support of Vorbis. The default is `ON`.
- **USE_FFMPEG**: Chooses if you wish to use FFmpeg for support of many codecs. The default is `ON`.
- **USE_MAIATRAC3PLUS**: Chooses if you wish to use MAIATRAC3+ for support of ATRAC3+. The default is `OFF`. It is not recommended to enable.
The following options are currently only available for Windows:
- **USE_G7221**: Chooses if you wish to use libg7221_decode for support of ITU-T G.722.1 annex C. The default is `ON`.
- **USE_G719**: Chooses if you wish to use libg719_decode for support ITU-T G.719. The default is `ON`.
- **USE_ATRAC9**: Chooses if you wish to use LibAtrac9 for support of ATRAC9. The default is `ON`.
- **USE_CELT**: Chooses if you wish to use libcelt for support of FSB CELT versions 0.6.1 and 0.11.0. The default is `ON`.
#### Build Options
All of these options are of type BOOL and can be set to either `ON` or `OFF`.
- **BUILD_CLI**: Chooses if you wish to build the vgmstream CLI program (as well as vgmstream123 on *nix-based OSes). The default is `ON`.
The following options are only available for Windows:
- **BUILD_FB2K**: Chooses if you wish to build the foobar2000 component. Note that this requires `FB2K_SDK_PATH` and `WTL_INCLUDE_PATH` to also be given if this option is `ON`. The default for is `ON`.
- **BUILD_WINAMP**: Chooses if you wish to build the Winamp plugin. The default is `ON`.
- **BUILD_XMPLAY**: Chooses if you wish to build the XMPlay plugin. The default is `ON`.
The following option is only available for *nix-based OSes:
- **BUILD_AUDACIOUS**: Chooses if you wish to build the Audacious plugin. The default is `ON`.
#### Paths
All of these paths are of type PATH.
If FDK-AAC/QAAC support is enabled, the following paths are required (with more details in the foobar2000 plugin section of [BUILD.md](BUILD.md)):
- **QAAC_PATH**: The path to the QAAC library. It can be obtained at https://github.com/kode54/qaac
- **FDK_AAC_PATH**: The path to the FDK-AAC library. It can be obtained at https://github.com/kode54/fdk-aac
If MAIATRAC3+ support is enabled, the following path is required:
- **MAIATRAC3PLUS_PATH**: The path to the MAIATRAC3+ library. It is not recommended to use.
The CLI/vgmstream123 programs are normally installed to `CMAKE_INSTALL_PREFIX`, changing this will change where those are installed.
If building the foobar2000 component, the following paths are required:
- **FB2K_SDK_PATH**: The path to the foobar2000 SDK.
- **WTL_INCLUDE_PATH**: The path to the include directory of the WTL.
- **FB2K_COMPONENT_INSTALL_PREFIX**: The path to the foobar2000 component installation directory. If you want to install the plugin for all users, you could set this to the `components` directory of the foobar2000 installation. Otherwise you'll want to set this to the `user-components` directory of your foobar2000 folder within your profile, the location of which depends on your current OS. The component as well as the required DLLs will be installed in this directory.
If building the Winamp plugin, the following path is required:
- **WINAMP_INSTALL_PREFIX**: The path to the Winamp installation. The required DLLs will be installed next to `winamp.exe` and the plugin itself will be installed to the `Plugins` directory.
If building the XMPlay plugin, the following path is required:
- **XMPLAY_INSTALL_PLUGIN**: The path to the XMPlay installation. The required DLLs and the plugin will be installed in this directory.
If building the Audacious plugin, no path needs to be given, it will be found by CMake.
## Installation
After the above build has been done, the programs and plugins can be installed with CMake as well. For project-based GUIs, running the `INSTALL` target will install the files. For command line build systems, use the `install` target.

203
ext_libs/CMakeLists.txt Normal file
View File

@ -0,0 +1,203 @@
if(MSVC)
if(USE_MPEG)
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/libmpg123-0.lib ${CMAKE_CURRENT_BINARY_DIR}/libmpg123-0.exp
COMMAND lib
ARGS /def:${CMAKE_CURRENT_SOURCE_DIR}/libmpg123-0.def /machine:x86 /out:${CMAKE_CURRENT_BINARY_DIR}/libmpg123-0.lib
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/libmpg123-0.def)
add_custom_target(libmpg123
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/libmpg123-0.lib
SOURCES
${CMAKE_SOURCE_DIR}/ext_includes/fmt123.h
${CMAKE_SOURCE_DIR}/ext_includes/mpg123.h)
endif()
if(USE_VORBIS)
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/libvorbis.lib ${CMAKE_CURRENT_BINARY_DIR}/libvorbis.exp
COMMAND lib
ARGS /def:${CMAKE_CURRENT_SOURCE_DIR}/libvorbis.def /machine:x86 /out:${CMAKE_CURRENT_BINARY_DIR}/libvorbis.lib
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/libvorbis.def)
file(GLOB OGG_HEADERS "${CMAKE_SOURCE_DIR}/ext_includes/ogg/*.h")
file(GLOB VORBIS_HEADERS "${CMAKE_SOURCE_DIR}/ext_includes/vorbis/*h")
add_custom_target(libvorbis
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/libvorbis.lib
SOURCES
${OGG_HEADERS}
${VORBIS_HEADERS})
source_group("Header Files\\ogg" FILES ${OGG_HEADERS})
source_group("Header Files\\vorbis" FILES ${VORBIS_HEADERS})
endif()
if(USE_G7221)
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/libg7221_decode.lib ${CMAKE_CURRENT_BINARY_DIR}/libg7221_decode.exp
COMMAND lib
ARGS /def:${CMAKE_CURRENT_SOURCE_DIR}/libg7221_decode.def /machine:x86 /out:${CMAKE_CURRENT_BINARY_DIR}/libg7221_decode.lib
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/libg7221_decode.def)
add_custom_target(libg7221_decode
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/libg7221_decode.lib
SOURCES ${CMAKE_SOURCE_DIR}/ext_includes/g7221.h)
endif()
if(USE_G719)
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/libg719_decode.lib ${CMAKE_CURRENT_BINARY_DIR}/libg719_decode.exp
COMMAND lib
ARGS /def:${CMAKE_CURRENT_SOURCE_DIR}/libg719_decode.def /machine:x86 /out:${CMAKE_CURRENT_BINARY_DIR}/libg719_decode.lib
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/libg719_decode.def)
add_custom_target(libg719_decode
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/libg719_decode.lib
SOURCES ${CMAKE_SOURCE_DIR}/ext_includes/g719.h)
endif()
if(USE_FFMPEG)
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/avcodec.lib ${CMAKE_CURRENT_BINARY_DIR}/avcodec.exp
COMMAND lib
ARGS /def:${CMAKE_CURRENT_SOURCE_DIR}/avcodec-vgmstream-58.def /machine:x86 /out:${CMAKE_CURRENT_BINARY_DIR}/avcodec.lib
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/avcodec-vgmstream-58.def)
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/avformat.lib ${CMAKE_CURRENT_BINARY_DIR}/avformat.exp
COMMAND lib
ARGS /def:${CMAKE_CURRENT_SOURCE_DIR}/avformat-vgmstream-58.def /machine:x86 /out:${CMAKE_CURRENT_BINARY_DIR}/avformat.lib
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/avformat-vgmstream-58.def)
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/avutil.lib ${CMAKE_CURRENT_BINARY_DIR}/avutil.exp
COMMAND lib
ARGS /def:${CMAKE_CURRENT_SOURCE_DIR}/avutil-vgmstream-56.def /machine:x86 /out:${CMAKE_CURRENT_BINARY_DIR}/avutil.lib
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/avutil-vgmstream-56.def)
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/swresample.lib ${CMAKE_CURRENT_BINARY_DIR}/swresample.exp
COMMAND lib
ARGS /def:${CMAKE_CURRENT_SOURCE_DIR}/swresample-vgmstream-3.def /machine:x86 /out:${CMAKE_CURRENT_BINARY_DIR}/swresample.lib
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/swresample-vgmstream-3.def)
file(GLOB AVCODEC_HEADERS "${CMAKE_SOURCE_DIR}/ext_includes/libavcodec/*.h")
file(GLOB AVFORMAT_HEADERS "${CMAKE_SOURCE_DIR}/ext_includes/libavformat/*.h")
file(GLOB AVUTIL_HEADERS "${CMAKE_SOURCE_DIR}/ext_includes/libavutil/*.h")
file(GLOB SWRESAMPLE_HEADERS "${CMAKE_SOURCE_DIR}/ext_includes/libswresample/*.h")
add_custom_target(ffmpeg
DEPENDS
${CMAKE_CURRENT_BINARY_DIR}/avcodec.lib
${CMAKE_CURRENT_BINARY_DIR}/avformat.lib
${CMAKE_CURRENT_BINARY_DIR}/avutil.lib
${CMAKE_CURRENT_BINARY_DIR}/swresample.lib
SOURCES
${AVCODEC_HEADERS}
${AVFORMAT_HEADERS}
${AVUTIL_HEADERS}
${SWRESAMPLE_HEADERS})
source_group("Header Files\\libavcodec" FILES ${AVCODEC_HEADERS})
source_group("Header Files\\libavformat" FILES ${AVFORMAT_HEADERS})
source_group("Header Files\\libavutil" FILES ${AVUTIL_HEADERS})
source_group("Header Files\\libswresample" FILES ${SWRESAMPLE_HEADERS})
endif()
if(USE_ATRAC9)
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/libatrac9.lib ${CMAKE_CURRENT_BINARY_DIR}/libatrac9.exp
COMMAND lib
ARGS /def:${CMAKE_CURRENT_SOURCE_DIR}/libatrac9.def /machine:x86 /out:${CMAKE_CURRENT_BINARY_DIR}/libatrac9.lib
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/libatrac9.def)
add_custom_target(libatrac9
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/libatrac9.lib
SOURCES ${CMAKE_SOURCE_DIR}/ext_includes/libatrac9.h)
endif()
if(USE_CELT)
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/libcelt-0061.lib ${CMAKE_CURRENT_BINARY_DIR}/libcelt-0061.exp
COMMAND lib
ARGS /def:${CMAKE_CURRENT_SOURCE_DIR}/libcelt-0061.def /machine:x86 /out:${CMAKE_CURRENT_BINARY_DIR}/libcelt-0061.lib
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/libcelt-0061.def)
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/libcelt-0110.lib ${CMAKE_CURRENT_BINARY_DIR}/libcelt-0110.exp
COMMAND lib
ARGS /def:${CMAKE_CURRENT_SOURCE_DIR}/libcelt-0110.def /machine:x86 /out:${CMAKE_CURRENT_BINARY_DIR}/libcelt-0110.lib
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/libcelt-0110.def)
file(GLOB CELT_HEADERS "${CMAKE_SOURCE_DIR}/ext_includes/celt/*.h")
add_custom_target(libcelt
DEPENDS
${CMAKE_CURRENT_BINARY_DIR}/libcelt-0061.lib
${CMAKE_CURRENT_BINARY_DIR}/libcelt-0110.lib
SOURCES ${CELT_HEADERS})
endif()
elseif(MINGW)
if(NOT DLLTOOL)
set(DLLTOOL dlltool)
endif()
if(USE_MPEG)
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/libmpg123-0.lib
COMMAND ${DLLTOOL}
ARGS -d ${CMAKE_CURRENT_SOURCE_DIR}/libmpg123-0.def -l ${CMAKE_CURRENT_BINARY_DIR}/libmpg123-0.lib
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/libmpg123-0.def)
add_custom_target(libmpg123
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/libmpg123-0.lib)
endif()
if(USE_VORBIS)
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/libvorbis.lib
COMMAND ${DLLTOOL}
ARGS -d ${CMAKE_CURRENT_SOURCE_DIR}/libvorbis.def -l ${CMAKE_CURRENT_BINARY_DIR}/libvorbis.lib
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/libvorbis.def)
add_custom_target(libvorbis
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/libvorbis.lib)
endif()
if(USE_G7221)
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/libg7221_decode.lib
COMMAND ${DLLTOOL}
ARGS -d ${CMAKE_CURRENT_SOURCE_DIR}/libg7221_decode.def -l ${CMAKE_CURRENT_BINARY_DIR}/libg7221_decode.lib
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/libg7221_decode.def)
add_custom_target(libg7221_decode
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/libg7221_decode.lib)
endif()
if(USE_G719)
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/libg719_decode.lib
COMMAND ${DLLTOOL}
ARGS -d ${CMAKE_CURRENT_SOURCE_DIR}/libg719_decode.def -l ${CMAKE_CURRENT_BINARY_DIR}/libg719_decode.lib
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/libg719_decode.def)
add_custom_target(libg719_decode
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/libg719_decode.lib)
endif()
if(USE_FFMPEG)
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/avcodec.lib
COMMAND ${DLLTOOL}
ARGS -d ${CMAKE_CURRENT_SOURCE_DIR}/avcodec-vgmstream-58.def -l ${CMAKE_CURRENT_BINARY_DIR}/avcodec.lib -D avcodec-vgmstream-58.dll
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/avcodec-vgmstream-58.def)
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/avformat.lib
COMMAND ${DLLTOOL}
ARGS -d ${CMAKE_CURRENT_SOURCE_DIR}/avformat-vgmstream-58.def -l ${CMAKE_CURRENT_BINARY_DIR}/avformat.lib -D avformat-vgmstream-58.dll
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/avformat-vgmstream-58.def)
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/avutil.lib
COMMAND ${DLLTOOL}
ARGS -d ${CMAKE_CURRENT_SOURCE_DIR}/avutil-vgmstream-56.def -l ${CMAKE_CURRENT_BINARY_DIR}/avutil.lib -D avutil-vgmstream-56.dll
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/avutil-vgmstream-56.def)
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/swresample.lib
COMMAND ${DLLTOOL}
ARGS -d ${CMAKE_CURRENT_SOURCE_DIR}/swresample-vgmstream-3.def -l ${CMAKE_CURRENT_BINARY_DIR}/swresample.lib -D swresample-vgmstream-3.dll
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/swresample-vgmstream-3.def)
add_custom_target(ffmpeg
DEPENDS
${CMAKE_CURRENT_BINARY_DIR}/avcodec.lib
${CMAKE_CURRENT_BINARY_DIR}/avformat.lib
${CMAKE_CURRENT_BINARY_DIR}/avutil.lib
${CMAKE_CURRENT_BINARY_DIR}/swresample.lib)
endif()
if(USE_ATRAC9)
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/libatrac9.lib
COMMAND ${DLLTOOL}
ARGS -d ${CMAKE_CURRENT_SOURCE_DIR}/libatrac9.def -l ${CMAKE_CURRENT_BINARY_DIR}/libatrac9.lib
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/libatrac9.def)
add_custom_target(libatrac9
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/libatrac9.lib)
endif()
if(USE_CELT)
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/libcelt-0061.lib
COMMAND ${DLLTOOL}
ARGS -d ${CMAKE_CURRENT_SOURCE_DIR}/libcelt-0061.def -l ${CMAKE_CURRENT_BINARY_DIR}/libcelt-0061.lib
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/libcelt-0061.def)
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/libcelt-0110.lib
COMMAND ${DLLTOOL}
ARGS -d ${CMAKE_CURRENT_SOURCE_DIR}/libcelt-0110.def -l ${CMAKE_CURRENT_BINARY_DIR}/libcelt-0110.lib
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/libcelt-0110.def)
add_custom_target(libcelt
DEPENDS
${CMAKE_CURRENT_BINARY_DIR}/libcelt-0061.lib
${CMAKE_CURRENT_BINARY_DIR}/libcelt-0110.lib)
endif()
endif()

View File

@ -0,0 +1,3 @@
add_library(getopt STATIC
getopt.h
getopt.c)

81
fb2k/CMakeLists.txt Normal file
View File

@ -0,0 +1,81 @@
# NOTE: Although this does include a section for handling MinGW, it might not be possible to build the foobar2000 component using MinGW using only CMake, as foobar2000's SDK only includes Visual Studio projects
set(RESOURCES ${CMAKE_CURRENT_SOURCE_DIR}/foo_input_vgmstream.rc)
# Setup source groups, mainly for Visual Studio
source_group("Resource Files" FILES ${RESOURCES})
add_library(foo_input_vgmstream SHARED
foo_filetypes.h
foo_prefs.h
foo_vgmstream.h
resource.h
foo_prefs.cpp
foo_streamfile.cpp
foo_vgmstream.cpp
${RESOURCES})
# Link to the vgmstream library and foobar2000's shared library
target_link_libraries(foo_input_vgmstream
libvgmstream
${FB2K_SDK_PATH}/foobar2000/shared/shared.lib)
setup_target(foo_input_vgmstream TRUE)
# Remove the prefix and set the suffix to .dll
set_target_properties(foo_input_vgmstream PROPERTIES
PREFIX ""
SUFFIX ".dll")
# Add the preprocessor definitions
target_compile_definitions(foo_input_vgmstream PRIVATE
__STDC_CONSTANT_MACROS
UNICODE
_UNICODE)
# Make sure that the binary directory is included (for version.h), as well as foobar2000's include directories and the WTL include directory
target_include_directories(foo_input_vgmstream PRIVATE
${CMAKE_BINARY_DIR}
${FB2K_SDK_PATH}/foobar2000/SDK
${FB2K_SDK_PATH}/foobar2000/ATLHelpers
${FB2K_SDK_PATH}/foobar2000/shared
${FB2K_SDK_PATH}/foobar2000
${WTL_INCLUDE_PATH})
# Add dependencies to foobar2000's SDK
add_dependencies(foo_input_vgmstream
fb2k_sdk
fb2k_sdk_helpers
fb2k_atl_helpers
fb2k_component_client
pfc)
# Make sure that whatever compiler we use can handle these features
target_compile_features(foo_input_vgmstream PRIVATE
cxx_auto_type
cxx_nullptr
cxx_rvalue_references
cxx_static_assert
cxx_variadic_templates)
# Include the version string
if(MSVC)
add_dependencies(foo_input_vgmstream version_h)
elseif(MINGW)
if(VGMSTREAM_VERSION)
target_compile_definitions(foo_input_vgmstream PRIVATE VERSION="${VGMSTREAM_VERSION}")
endif()
# Also, on MinGW when using GCC, these flags need to be included to prevent requiring MinGW's runtime DLLs from being included, which does unfortunately increase the size of the DLL
if(NOT CMAKE_CXX_COMPILER_ID MATCHES Clang)
set_target_properties(foo_input_vgmstream PROPERTIES
LINK_FLAGS "-static-libgcc -static-libstdc++")
endif()
endif()
# Install the DLLs
install_dlls(${FB2K_COMPONENT_INSTALL_PREFIX}/foo_input_vgmstream)
# Install the component
install(TARGETS foo_input_vgmstream
DESTINATION ${FB2K_COMPONENT_INSTALL_PREFIX}/foo_input_vgmstream)

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
@ -70,7 +70,7 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>../ext_includes;$(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>
<AdditionalIncludeDirectories>..;../ext_includes;$(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_MP4V2;VGM_USE_FDKAAC;VGM_USE_ATRAC9;VGM_USE_CELT;_DEBUG;_WINDOWS;_USRDLL;IN_VGMSTREAM_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
@ -97,7 +97,7 @@
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<AdditionalIncludeDirectories>../ext_includes;$(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>
<AdditionalIncludeDirectories>..;../ext_includes;$(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_MP4V2;VGM_USE_FDKAAC;VGM_USE_ATRAC9;VGM_USE_CELT;NDEBUG;_WINDOWS;_USRDLL;IN_VGMSTREAM_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<PrecompiledHeader>

View File

@ -20,7 +20,7 @@ extern "C" {
#include "foo_filetypes.h"
#ifndef VERSION
#include "../version.h"
#include "version.h"
#endif
#ifndef VERSION

47
src/CMakeLists.txt Normal file
View File

@ -0,0 +1,47 @@
file(GLOB CODING_HEADERS "${CMAKE_CURRENT_SOURCE_DIR}/coding/*.h")
file(GLOB CODING_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/coding/*.c")
file(GLOB LAYOUT_HEADERS "${CMAKE_CURRENT_SOURCE_DIR}/layout/*.h")
file(GLOB LAYOUT_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/layout/*.c")
file(GLOB META_HEADERS "${CMAKE_CURRENT_SOURCE_DIR}/meta/*.h")
file(GLOB META_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/meta/*.c")
set(EXT_HEADERS
${CMAKE_SOURCE_DIR}/ext_includes/clHCA.h
${CMAKE_SOURCE_DIR}/ext_includes/pstdint.h)
set(EXT_SOURCES
${CMAKE_SOURCE_DIR}/ext_libs/clHCA.c)
file(GLOB MAIN_HEADERS "${CMAKE_CURRENT_SOURCE_DIR}/*.h")
file(GLOB MAIN_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/*.c")
# stack_allow.h is not being used, so no need to include it in the sources
list(REMOVE_ITEM MAIN_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/stack_alloc.h)
# Setup source groups, mainly for Visual Studio
source_group("Header Files\\coding" FILES ${CODING_HEADERS})
source_group("Header Files\\layout" FILES ${LAYOUT_HEADERS})
source_group("Header Files\\meta" FILES ${META_HEADERS})
source_group("Header Files\\ext" FILES ${EXT_HEADERS})
source_group("Source Files\\coding" FILES ${CODING_SOURCES})
source_group("Source Files\\layout" FILES ${LAYOUT_SOURCES})
source_group("Source Files\\meta" FILES ${META_SOURCES})
source_group("Source Files\\ext" FILES ${EXT_SOURCES})
add_library(libvgmstream STATIC
${CODING_HEADERS}
${CODING_SOURCES}
${LAYOUT_HEADERS}
${LAYOUT_SOURCES}
${META_HEADERS}
${META_SOURCES}
${EXT_HEADERS}
${EXT_SOURCES}
${MAIN_HEADERS}
${MAIN_SOURCES})
setup_target(libvgmstream)
# Set up the proper include directories
target_include_directories(libvgmstream PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}
coding
layout
meta)

54
winamp/CMakeLists.txt Normal file
View File

@ -0,0 +1,54 @@
file(GLOB WINAMP_SDK_HEADERS "${CMAKE_CURRENT_SOURCE_DIR}/sdk/*.h")
set(RESOURCES ${CMAKE_CURRENT_SOURCE_DIR}/resource.rc)
# Setup source groups, mainly for Visual Studio
source_group("Header Files\\sdk" FILES ${WINAMP_SDK_HEADERS})
source_group("Resource Files" FILES ${RESOURCES})
add_library(in_vgmstream SHARED
${WINAMP_SDK_HEADERS}
resource.h
in_vgmstream.c
${RESOURCES})
# Link to the vgmstream library
target_link_libraries(in_vgmstream libvgmstream)
setup_target(in_vgmstream TRUE)
# Remove the prefix and set the suffix to .dll
set_target_properties(in_vgmstream PROPERTIES
PREFIX ""
SUFFIX ".dll")
# Add the preprocessor definitions
target_compile_definitions(in_vgmstream PRIVATE
VGM_WINAMP_UNICODE
__STDC_CONSTANT_MACROS
UNICODE
_UNICODE)
# Make sure that the binary directory is included (for version.h)
target_include_directories(in_vgmstream PRIVATE ${CMAKE_BINARY_DIR})
# Include the version string
if(MSVC)
add_dependencies(in_vgmstream version_h)
elseif(MINGW)
if(VGMSTREAM_VERSION)
target_compile_definitions(in_vgmstream PRIVATE VERSION="${VGMSTREAM_VERSION}")
endif()
# Also, on MinGW when using GCC, these flags need to be included to prevent requiring MinGW's runtime DLLs from being included, which does unfortunately increase the size of the DLL
if(NOT CMAKE_CXX_COMPILER_ID MATCHES Clang)
set_target_properties(in_vgmstream PROPERTIES
LINK_FLAGS "-static-libgcc -static-libstdc++")
endif()
endif()
# Install the DLLs
install_dlls(${XMPLAY_INSTALL_PREFIX})
# Install the plugin
install(TARGETS in_vgmstream
DESTINATION ${WINAMP_INSTALL_PREFIX}/Plugins)

View File

@ -30,7 +30,7 @@
#ifndef VERSION
#include "../version.h"
#include "version.h"
#endif
#ifndef VERSION
#define VERSION "(unknown version)"

View File

@ -70,7 +70,7 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>../ext_includes;$(DependenciesDir)/qaac/mp4v2/include;$(DependenciesDir)/fdk-aac/libSYS/include;$(DependenciesDir)/fdk-aac/libAACdec/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>..;../ext_includes;$(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_MP4V2;VGM_USE_FDKAAC;VGM_USE_ATRAC9;VGM_USE_CELT;_DEBUG;_WINDOWS;_USRDLL;IN_VGMSTREAM_EXPORTS;VGM_WINAMP_UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
@ -98,7 +98,7 @@
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<AdditionalIncludeDirectories>../ext_includes;$(DependenciesDir)/qaac/mp4v2/include;$(DependenciesDir)/fdk-aac/libSYS/include;$(DependenciesDir)/fdk-aac/libAACdec/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>..;../ext_includes;$(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_MP4V2;VGM_USE_FDKAAC;VGM_USE_ATRAC9;VGM_USE_CELT;NDEBUG;_WINDOWS;_USRDLL;IN_VGMSTREAM_EXPORTS;VGM_WINAMP_UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<PrecompiledHeader>
@ -152,4 +152,4 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
</Project>

40
xmplay/CMakeLists.txt Normal file
View File

@ -0,0 +1,40 @@
add_library(xmp-vgmstream SHARED
xmpfunc.h
xmpin.h
xmp_vgmstream.c
xmpin.def)
# Link to the vgmstream library
target_link_libraries(xmp-vgmstream libvgmstream)
setup_target(xmp-vgmstream TRUE)
# Remove the prefix and set the suffix to .dll
set_target_properties(xmp-vgmstream PROPERTIES
PREFIX ""
SUFFIX ".dll")
# Make sure that the binary directory is included (for version.h)
target_include_directories(xmp-vgmstream PRIVATE ${CMAKE_BINARY_DIR})
# Include the version string
if(MSVC)
add_dependencies(xmp-vgmstream version_h)
elseif(MINGW)
if(VGMSTREAM_VERSION)
target_compile_definitions(xmp-vgmstream PRIVATE VERSION="${VGMSTREAM_VERSION}")
endif()
# Also, on MinGW when using GCC, these flags need to be included to prevent requiring MinGW's runtime DLLs from being included, which does unfortunately increase the size of the DLL
if(NOT CMAKE_CXX_COMPILER_ID MATCHES Clang)
set_target_properties(xmp-vgmstream PROPERTIES
LINK_FLAGS "-static-libgcc -static-libstdc++")
endif()
endif()
# Install the DLLs
install_dlls(${XMPLAY_INSTALL_PREFIX})
# Install the plugin
install(TARGETS xmp-vgmstream
DESTINATION ${XMPLAY_INSTALL_PREFIX})

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
@ -61,7 +61,7 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>../ext_includes;$(DependenciesDir)/qaac/mp4v2/include;$(DependenciesDir)/fdk-aac/libSYS/include;$(DependenciesDir)/fdk-aac/libAACdec/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>..;../ext_includes;$(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_MP4V2;VGM_USE_FDKAAC;VGM_USE_ATRAC9;VGM_USE_CELT;_DEBUG;_WINDOWS;_USRDLL;IN_VGMSTREAM_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
@ -86,7 +86,7 @@
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<AdditionalIncludeDirectories>../ext_includes;$(DependenciesDir)/qaac/mp4v2/include;$(DependenciesDir)/fdk-aac/libSYS/include;$(DependenciesDir)/fdk-aac/libAACdec/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>..;../ext_includes;$(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_MP4V2;VGM_USE_FDKAAC;NDEBUG;_WINDOWS;_USRDLL;IN_VGMSTREAM_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel>

View File

@ -16,7 +16,7 @@
#ifndef VERSION
#include "../version.h"
#include "version.h"
#endif
#ifndef VERSION
#define VERSION "(unknown version)"