Merge pull request #896 from PredatorCZ/ffmpeg-abi-unix-fix

CMake ffmpeg project tweaks
This commit is contained in:
bnnm 2021-07-18 22:57:52 +02:00 committed by GitHub
commit 42d30e2bda
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
116 changed files with 62 additions and 51 deletions

View File

@ -42,6 +42,24 @@ else()
option(BUILD_AUDACIOUS "Build Audacious plugin" ON)
endif()
if(USE_FFMPEG)
find_package(FFmpeg)
if(NOT FFMPEG_LIBRARIES)
set(USE_FFMPEG OFF)
else()
if(${AVCODEC_VERSION} VERSION_LESS 57)
set(USE_FFMPEG OFF)
message("libavcodec version mismatch ${AVCODEC_VERSION} expected >=57")
elseif(${AVUTIL_VERSION} VERSION_LESS 55)
set(USE_FFMPEG OFF)
message("libavutil version mismatch ${AVUTIL_VERSION} expected >=55")
elseif(${SWRESAMPLE_VERSION} VERSION_LESS 2)
set(USE_FFMPEG OFF)
message("libswresample version mismatch ${SWRESAMPLE_VERSION} expected >=2")
endif()
endif()
endif()
if(WIN32)
# Enable support for the resource compiler when using MinGW
if(MINGW)
@ -91,23 +109,6 @@ else()
set(USE_VORBIS OFF)
endif()
endif()
if(USE_FFMPEG)
find_package(FFmpeg)
if(NOT FFMPEG_LIBRARIES)
set(USE_FFMPEG OFF)
else()
if(${AVCODEC_VERSION} VERSION_LESS 57)
set(USE_FFMPEG OFF)
message("libavcodec version mismatch ${AVCODEC_VERSION} expected >=57")
elseif(${AVUTIL_VERSION} VERSION_LESS 55)
set(USE_FFMPEG OFF)
message("libavutil version mismatch ${AVUTIL_VERSION} expected >=55")
elseif(${SWRESAMPLE_VERSION} VERSION_LESS 2)
set(USE_FFMPEG OFF)
message("libswresample version mismatch ${SWRESAMPLE_VERSION} expected >=2")
endif()
endif()
endif()
# If building the CLI, we need to include AO as well
if(BUILD_CLI)
@ -117,6 +118,8 @@ else()
endif()
endif()
find_package(PkgConfig REQUIRED)
# Only build JSON dumping capabilities on Linux
pkg_check_modules(JANSSON jansson>=2.3)
if (JANSSON_FOUND)
@ -130,7 +133,6 @@ else()
# 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)

View File

@ -15,7 +15,7 @@ endif
# -DUSE_ALLOCA
ifeq ($(TARGET_OS),Windows_NT)
CFLAGS += -DWIN32
CFLAGS += -DWIN32 -I../ext_includes/ffmpeg
endif
CFLAGS += $(DEF_CFLAGS) -DVAR_ARRAYS -I../ext_includes $(EXTRA_CFLAGS)

View File

@ -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;../ext_includes/ffmpeg;$(DependenciesDir)/qaac/mp4v2/include;$(DependenciesDir)/fdk-aac/libSYS/include;$(DependenciesDir)/fdk-aac/libAACdec/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;VGM_USE_VORBIS;VGM_USE_MPEG;VGM_USE_FFMPEG;VGM_USE_G7221;VGM_USE_ATRAC9;VGM_USE_CELT;VGM_USE_SPEEX;HAVE_JSON;_DEBUG;_WINDOWS;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
@ -96,7 +96,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;../ext_includes/ffmpeg;$(DependenciesDir)/qaac/mp4v2/include;$(DependenciesDir)/fdk-aac/libSYS/include;$(DependenciesDir)/fdk-aac/libAACdec/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;VGM_USE_VORBIS;VGM_USE_MPEG;VGM_USE_FFMPEG;VGM_USE_G7221;VGM_USE_ATRAC9;VGM_USE_CELT;VGM_USE_SPEEX;HAVE_JSON;NDEBUG;_WINDOWS;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<PrecompiledHeader>
@ -145,4 +145,4 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
</Project>

View File

@ -72,16 +72,24 @@ macro(find_component _component _pkgconfig _library _header)
HINTS
${PC_LIB${_component}_INCLUDEDIR}
${PC_LIB${_component}_INCLUDE_DIRS}
${FFMPEG_PATH}/include
PATH_SUFFIXES ffmpeg)
find_library(${_component}_LIBRARIES NAMES ${_library}
HINTS
${PC_LIB${_component}_LIBDIR}
${PC_LIB${_component}_LIBRARY_DIRS})
${PC_LIB${_component}_LIBRARY_DIRS}
${FFMPEG_PATH}/lib)
set(${_component}_DEFINITIONS ${PC_${_component}_CFLAGS_OTHER} CACHE STRING "The ${_component} CFLAGS.")
set(${_component}_VERSION ${PC_${_component}_VERSION} CACHE STRING "The ${_component} version number.")
if(WIN32 AND NOT ${_component}_VERSION)
file(GLOB FOUND_DLL_ ${FFMPEG_PATH}/bin/${_library}*.dll)
string(REGEX MATCH ".*${_library}-(.+).dll" FOUND_DLL_ ${FOUND_DLL_})
set(${_component}_VERSION ${CMAKE_MATCH_1} CACHE STRING "The ${_component} version number." FORCE)
endif()
set_component_found(${_component})
mark_as_advanced(

View File

@ -56,7 +56,8 @@ macro(setup_target TARGET)
if(USE_FFMPEG)
target_compile_definitions(${TARGET} PRIVATE VGM_USE_FFMPEG)
if(WIN32)
if(WIN32 AND NOT FFMPEG_LIBRARIES)
target_include_directories(${TARGET} PRIVATE ${VGM_SOURCE_DIR}/ext_includes/ffmpeg)
if(LINK)
add_dependencies(${TARGET} ffmpeg)
target_link_libraries(${TARGET}

View File

@ -95,7 +95,7 @@ All of these options are of type BOOL and can be set to either `ON` or `OFF`. Mo
- **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_FFMPEG**: Chooses if you wish to use FFmpeg for support of many codecs. The default is `ON`. `FFMPEG_PATH` can also be given, so it can use official/external SDK instead of the one used in vgmstream project.
- **USE_MAIATRAC3PLUS**: Chooses if you wish to use MAIATRAC3+ for support of ATRAC3+. The default is `OFF`. It is not recommended to enable.
- **USE_G7221**: Chooses if you wish to use G7221 for support of ITU-T G.722.1 annex C. The default is `ON`.

Some files were not shown because too many files have changed in this diff Show More