mirror of
https://github.com/vgmstream/vgmstream.git
synced 2025-01-17 23:36:41 +01:00
Add CMake scripts
Needed to change how version.h was included to let it pick up the one from CMake's build location. NOTE: Does not build with MinGW-w64 currently, does not have a way to build the audacious or XMPlay plugins.
This commit is contained in:
parent
d0de011953
commit
78748393db
209
CMakeLists.txt
Normal file
209
CMakeLists.txt
Normal file
@ -0,0 +1,209 @@
|
||||
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")
|
||||
option(BUILD_WINAMP "Build Winamp 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 FALSE)
|
||||
endif()
|
||||
endif()
|
||||
if(USE_VORBIS)
|
||||
find_package(Vorbis)
|
||||
if(NOT VORBIS_FOUND)
|
||||
set(USE_VORBIS FALSE)
|
||||
endif()
|
||||
endif()
|
||||
if(USE_FFMPEG)
|
||||
find_package(FFmpeg)
|
||||
if(NOT FFMPEG_LIBRARIES)
|
||||
set(USE_FFMPEG FALSE)
|
||||
endif()
|
||||
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)
|
||||
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()
|
||||
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()
|
||||
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 "=========================")
|
||||
message(STATUS " CLI: ${BUILD_CLI}")
|
||||
if(WIN32)
|
||||
message(STATUS "foobar2000 component: ${BUILD_FB2K}")
|
||||
message(STATUS " Winamp plugin: ${BUILD_WINAMP}")
|
||||
endif()
|
||||
message(STATUS "")
|
38
cli/CMakeLists.txt
Normal file
38
cli/CMakeLists.txt
Normal file
@ -0,0 +1,38 @@
|
||||
add_executable(vgmstream_cli
|
||||
vgmstream_cli.c)
|
||||
|
||||
setup_target(vgmstream_cli TRUE)
|
||||
|
||||
# Link to the vgmstream library
|
||||
target_link_libraries(vgmstream_cli libvgmstream)
|
||||
|
||||
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()
|
||||
elseif(VGMSTREAM_VERSION)
|
||||
# Include the version string
|
||||
target_compile_definitions(vgmstream_cli PRIVATE VERSION="${VGMSTREAM_VERSION}")
|
||||
endif()
|
@ -15,7 +15,7 @@
|
||||
#endif
|
||||
|
||||
#ifndef VERSION
|
||||
#include "../version.h"
|
||||
#include "version.h"
|
||||
#endif
|
||||
#ifndef VERSION
|
||||
#define VERSION "(unknown version)"
|
||||
|
@ -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>
|
||||
|
144
cmake/FindFFmpeg.cmake
Normal file
144
cmake/FindFFmpeg.cmake
Normal file
@ -0,0 +1,144 @@
|
||||
# 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.
|
||||
|
||||
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})
|
22
cmake/FindMPG123.cmake
Normal file
22
cmake/FindMPG123.cmake
Normal file
@ -0,0 +1,22 @@
|
||||
# - 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.
|
||||
|
||||
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)
|
25
cmake/FindOgg.cmake
Normal file
25
cmake/FindOgg.cmake
Normal file
@ -0,0 +1,25 @@
|
||||
# - Find ogg
|
||||
# Find the native ogg includes and libraries
|
||||
#
|
||||
# OGG_INCLUDE_DIR - where to find ogg.h, etc.
|
||||
# OGG_LIBRARIES - List of libraries when using ogg.
|
||||
# OGG_FOUND - True if ogg found.
|
||||
|
||||
if(OGG_INCLUDE_DIR)
|
||||
# Already in cache, be silent
|
||||
set(OGG_FIND_QUIETLY TRUE)
|
||||
endif()
|
||||
|
||||
find_path(OGG_INCLUDE_DIR ogg/ogg.h)
|
||||
# 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)
|
||||
# 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 DEFAULT_MSG OGG_INCLUDE_DIR OGG_LIBRARY)
|
||||
|
||||
set(OGG_LIBRARIES ${OGG_LIBRARY})
|
||||
|
||||
mark_as_advanced(OGG_INCLUDE_DIR)
|
||||
mark_as_advanced(OGG_LIBRARY)
|
33
cmake/FindVorbis.cmake
Normal file
33
cmake/FindVorbis.cmake
Normal file
@ -0,0 +1,33 @@
|
||||
# - Find vorbis
|
||||
# Find the native vorbis includes and libraries
|
||||
#
|
||||
# VORBIS_INCLUDE_DIR - where to find vorbis.h, etc.
|
||||
# VORBIS_LIBRARIES - List of libraries when using vorbis(file).
|
||||
# VORBIS_FOUND - True if vorbis found.
|
||||
|
||||
if(VORBIS_INCLUDE_DIR)
|
||||
# Already in cache, be silent
|
||||
set(VORBIS_FIND_QUIETLY TRUE)
|
||||
endif()
|
||||
|
||||
find_package(Ogg)
|
||||
if(OGG_FOUND)
|
||||
find_path(VORBIS_INCLUDE_DIR vorbis/vorbisfile.h)
|
||||
# MSVC built vorbis may be named vorbis_static
|
||||
# The provided project files name the library with the lib prefix.
|
||||
find_library(VORBIS_LIBRARY NAMES vorbis vorbis_static libvorbis libvorbis_static)
|
||||
find_library(VORBISFILE_LIBRARY NAMES vorbisfile vorbisfile_static libvorbisfile libvorbisfile_static)
|
||||
# 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 DEFAULT_MSG VORBIS_INCLUDE_DIR VORBIS_LIBRARY VORBISFILE_LIBRARY)
|
||||
endif()
|
||||
|
||||
if(VORBIS_FOUND)
|
||||
set(VORBIS_LIBRARIES ${VORBISFILE_LIBRARY} ${VORBIS_LIBRARY} ${OGG_LIBRARY})
|
||||
else()
|
||||
set(VORBIS_LIBRARIES)
|
||||
endif()
|
||||
|
||||
mark_as_advanced(VORBIS_INCLUDE_DIR)
|
||||
mark_as_advanced(VORBIS_LIBRARY VORBISFILE_LIBRARY)
|
79
cmake/fdk-aac.cmake
Normal file
79
cmake/fdk-aac.cmake
Normal file
@ -0,0 +1,79 @@
|
||||
# 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)
|
111
cmake/mp4v2.cmake
Normal file
111
cmake/mp4v2.cmake
Normal file
@ -0,0 +1,111 @@
|
||||
# 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)
|
127
cmake/vgmstream.cmake
Normal file
127
cmake/vgmstream.cmake
Normal file
@ -0,0 +1,127 @@
|
||||
# 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)
|
||||
target_include_directories(${TARGET} PRIVATE ${CMAKE_SOURCE_DIR}/ext_includes)
|
||||
else()
|
||||
target_include_directories(${TARGET} PRIVATE AFTER ${CMAKE_SOURCE_DIR}/ext_includes)
|
||||
endif()
|
||||
|
||||
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 ${VORBIS_INCLUDE_DIR})
|
||||
if(LINK)
|
||||
target_link_libraries(${TARGET} ${VORBIS_LIBRARIES})
|
||||
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()
|
||||
endif()
|
||||
endmacro()
|
203
ext_libs/CMakeLists.txt
Normal file
203
ext_libs/CMakeLists.txt
Normal 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()
|
4
ext_libs/Getopt/CMakeLists.txt
Normal file
4
ext_libs/Getopt/CMakeLists.txt
Normal file
@ -0,0 +1,4 @@
|
||||
set(SOURCES
|
||||
getopt.c)
|
||||
|
||||
add_library(getopt STATIC ${SOURCES})
|
63
fb2k/CMakeLists.txt
Normal file
63
fb2k/CMakeLists.txt
Normal file
@ -0,0 +1,63 @@
|
||||
# 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
|
||||
|
||||
add_library(foo_input_vgmstream SHARED
|
||||
foo_prefs.cpp
|
||||
foo_streamfile.cpp
|
||||
foo_vgmstream.cpp
|
||||
foo_input_vgmstream.rc)
|
||||
|
||||
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})
|
||||
|
||||
# Link to the vgmstream library and foobar2000's shared library
|
||||
target_link_libraries(foo_input_vgmstream
|
||||
libvgmstream
|
||||
${FB2K_SDK_PATH}/foobar2000/shared/shared.lib)
|
||||
|
||||
# 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_static_assert)
|
||||
|
||||
# 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()
|
@ -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>
|
||||
|
@ -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
47
src/CMakeLists.txt
Normal 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)
|
38
winamp/CMakeLists.txt
Normal file
38
winamp/CMakeLists.txt
Normal file
@ -0,0 +1,38 @@
|
||||
add_library(in_vgmstream SHARED
|
||||
in_vgmstream.c
|
||||
resource.rc)
|
||||
|
||||
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})
|
||||
|
||||
# Link to the vgmstream library
|
||||
target_link_libraries(in_vgmstream libvgmstream)
|
||||
|
||||
# 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()
|
@ -30,7 +30,7 @@
|
||||
|
||||
|
||||
#ifndef VERSION
|
||||
#include "../version.h"
|
||||
#include "version.h"
|
||||
#endif
|
||||
#ifndef VERSION
|
||||
#define VERSION "(unknown version)"
|
||||
|
@ -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>
|
||||
|
Loading…
x
Reference in New Issue
Block a user