cmake: Replace FFMpeg modules with single module
Now using components instead of one find_package call per module
This commit is contained in:
parent
c9d3c6c8c1
commit
599febcb54
@ -25,22 +25,29 @@ find_package(Libfdk QUIET)
|
||||
find_package(Qt5Core QUIET)
|
||||
|
||||
file(GLOB FFMPEG_BIN_FILES
|
||||
"${FFMPEG_INCLUDE_DIR}/../bin${_bin_suffix}/av*-*.dll"
|
||||
"${FFMPEG_INCLUDE_DIR}/../bin${_bin_suffix}/sw*-*.dll"
|
||||
"${FFMPEG_INCLUDE_DIR}/../bin${_bin_suffix}/libbz2*.dll"
|
||||
"${FFMPEG_INCLUDE_DIR}/../bin${_bin_suffix}/zlib*.dll"
|
||||
"${FFMPEG_INCLUDE_DIR}/../bin/av*-*.dll"
|
||||
"${FFMPEG_INCLUDE_DIR}/../bin/sw*-*.dll"
|
||||
"${FFMPEG_INCLUDE_DIR}/../bin/libbz2*.dll"
|
||||
"${FFMPEG_INCLUDE_DIR}/../bin/zlib*.dll"
|
||||
"${FFMPEG_INCLUDE_DIR}/bin/av*-*.dll"
|
||||
"${FFMPEG_INCLUDE_DIR}/bin/sw*-*.dll"
|
||||
"${FFMPEG_INCLUDE_DIR}/bin/libbz2*.dll"
|
||||
"${FFMPEG_INCLUDE_DIR}/bin/zlib*.dll"
|
||||
"${FFMPEG_INCLUDE_DIR}/bin${_bin_suffix}/av*-*.dll"
|
||||
"${FFMPEG_INCLUDE_DIR}/bin${_bin_suffix}/sw*-*.dll"
|
||||
"${FFMPEG_INCLUDE_DIR}/bin${_bin_suffix}/libbz2*.dll"
|
||||
"${FFMPEG_INCLUDE_DIR}/bin${_bin_suffix}/zlib*.dll")
|
||||
"${FFMPEG_avutil_INCLUDE_DIR}/../bin${_bin_suffix}/avutil-*.dll"
|
||||
"${FFMPEG_avcodec_INCLUDE_DIR}/../bin${_bin_suffix}/avcodec-*.dll"
|
||||
"${FFMPEG_avformat_INCLUDE_DIR}/../bin${_bin_suffix}/avformat-*.dll"
|
||||
"${FFMPEG_swscale_INCLUDE_DIR}/../bin${_bin_suffix}/swscale-*.dll"
|
||||
"${FFMPEG_swresample_INCLUDE_DIR}/../bin${_bin_suffix}/swresample-*.dll"
|
||||
"${FFMPEG_avcodec_INCLUDE_DIR}/../bin${_bin_suffix}/libbz2*.dll"
|
||||
"${FFMPEG_avcodec_INCLUDE_DIR}/../bin${_bin_suffix}/zlib*.dll"
|
||||
"${FFMPEG_avutil_INCLUDE_DIR}/../bin/avutil-*.dll"
|
||||
"${FFMPEG_avcodec_INCLUDE_DIR}/../bin/avcodec-*.dll"
|
||||
"${FFMPEG_avformat_INCLUDE_DIR}/../bin/avformat-*.dll"
|
||||
"${FFMPEG_swscale_INCLUDE_DIR}/../bin/swscale-*.dll"
|
||||
"${FFMPEG_swresample_INCLUDE_DIR}/../bin/swresample-*.dll"
|
||||
"${FFMPEG_avcodec_INCLUDE_DIR}/../bin/libbz2*.dll"
|
||||
"${FFMPEG_avcodec_INCLUDE_DIR}/../bin/zlib*.dll"
|
||||
"${FFMPEG_avcodec_INCLUDE_DIR}/bin/libbz2*.dll"
|
||||
"${FFMPEG_avcodec_INCLUDE_DIR}/bin/zlib*.dll"
|
||||
"${FFMPEG_avutil_INCLUDE_DIR}/bin${_bin_suffix}/avutil-*.dll"
|
||||
"${FFMPEG_avcodec_INCLUDE_DIR}/bin${_bin_suffix}/avcodec-*.dll"
|
||||
"${FFMPEG_avformat_INCLUDE_DIR}/bin${_bin_suffix}/avformat-*.dll"
|
||||
"${FFMPEG_swscale_INCLUDE_DIR}/bin${_bin_suffix}/swscale-*.dll"
|
||||
"${FFMPEG_swresample_INCLUDE_DIR}/bin${_bin_suffix}/swresample-*.dll"
|
||||
"${FFMPEG_avcodec_INCLUDE_DIR}/bin${_bin_suffix}/libbz2*.dll"
|
||||
"${FFMPEG_avcodec_INCLUDE_DIR}/bin${_bin_suffix}/zlib*.dll")
|
||||
|
||||
file(GLOB X264_BIN_FILES
|
||||
"${X264_INCLUDE_DIR}/../bin${_bin_suffix}/libx264-*.dll"
|
||||
|
139
cmake/Modules/FindFFMpeg.cmake
Normal file
139
cmake/Modules/FindFFMpeg.cmake
Normal file
@ -0,0 +1,139 @@
|
||||
#
|
||||
# This module defines the following variables:
|
||||
#
|
||||
# FFMPEG_FOUND - All required components and the core library were found
|
||||
# FFMPEG_INCLUDE_DIRS - Combined list of all components include dirs
|
||||
# FFMPEG_LIBRARIES - Combined list of all componenets libraries
|
||||
# FFMPEG_VERSION_STRING - Version of the first component requested
|
||||
#
|
||||
# For each requested component the following variables are defined:
|
||||
#
|
||||
# FFMPEG_<component>_FOUND - The component was found
|
||||
# FFMPEG_<component>_INCLUDE_DIRS - The components include dirs
|
||||
# FFMPEG_<component>_LIBRARIES - The components libraries
|
||||
# FFMPEG_<component>_VERSION_STRING - The components version string
|
||||
# FFMPEG_<component>_VERSION_MAJOR - The components major version
|
||||
# FFMPEG_<component>_VERSION_MINOR - The components minor version
|
||||
# FFMPEG_<component>_VERSION_MICRO - The components micro version
|
||||
#
|
||||
# <component> is the uppercase name of the component
|
||||
|
||||
|
||||
find_package(PkgConfig QUIET)
|
||||
|
||||
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
set(_lib_suffix 64)
|
||||
else()
|
||||
set(_lib_suffix 32)
|
||||
endif()
|
||||
|
||||
function(find_ffmpeg_library component header)
|
||||
string(TOUPPER "${component}" component_u)
|
||||
set(FFMPEG_${component_u}_FOUND FALSE PARENT_SCOPE)
|
||||
set(FFMpeg_${component}_FOUND FALSE PARENT_SCOPE)
|
||||
|
||||
if(PKG_CONFIG_FOUND)
|
||||
pkg_check_modules(PC_FFMPEG_${component} QUIET lib${component})
|
||||
endif()
|
||||
|
||||
find_path(FFMPEG_${component}_INCLUDE_DIR
|
||||
NAMES
|
||||
"lib${component}/${header}" "lib${component}/version.h"
|
||||
HINTS
|
||||
ENV FFmpegPath${_lib_suffix}
|
||||
ENV FFmpegPath
|
||||
${PC_FFMPEG_${component}_INCLUDE_DIRS}
|
||||
PATH_SUFFIXES ffmpeg libav)
|
||||
|
||||
find_library(FFMPEG_${component}_LIBRARY
|
||||
NAMES
|
||||
"${component}" "lib${component}"
|
||||
HINTS
|
||||
ENV FFmpegPath${_lib_suffix}
|
||||
ENV FFmpegPath
|
||||
${PC_FFMPEG_${component}_LIBRARY_DIRS}
|
||||
PATH_SUFFIXES
|
||||
lib${_lib_suffix} lib
|
||||
libs${_lib_suffix} libs
|
||||
bin${_lib_suffix} bin
|
||||
../lib${_lib_suffix} ../lib
|
||||
../libs${_lib_suffix} ../libs
|
||||
../bin${_lib_suffix} ../bin)
|
||||
|
||||
set(FFMPEG_${component_u}_INCLUDE_DIRS ${FFMPEG_${component}_INCLUDE_DIR} PARENT_SCOPE)
|
||||
set(FFMPEG_${component_u}_LIBRARIES ${FFMPEG_${component}_LIBRARY} PARENT_SCOPE)
|
||||
|
||||
mark_as_advanced(FFMPEG_${component}_INCLUDE_DIR FFMPEG_${component}_LIBRARY)
|
||||
|
||||
if(FFMPEG_${component}_INCLUDE_DIR AND FFMPEG_${component}_LIBRARY)
|
||||
set(FFMPEG_${component_u}_FOUND TRUE PARENT_SCOPE)
|
||||
set(FFMpeg_${component}_FOUND TRUE PARENT_SCOPE)
|
||||
|
||||
list(APPEND FFMPEG_INCLUDE_DIRS ${FFMPEG_${component}_INCLUDE_DIR})
|
||||
list(REMOVE_DUPLICATES FFMPEG_INCLUDE_DIRS)
|
||||
set(FFMPEG_INCLUDE_DIRS "${FFMPEG_INCLUDE_DIRS}" PARENT_SCOPE)
|
||||
|
||||
list(APPEND FFMPEG_LIBRARIES ${FFMPEG_${component}_LIBRARY})
|
||||
list(REMOVE_DUPLICATES FFMPEG_LIBRARIES)
|
||||
set(FFMPEG_LIBRARIES "${FFMPEG_LIBRARIES}" PARENT_SCOPE)
|
||||
|
||||
set(FFMPEG_${component_u}_VERSION_STRING "unknown" PARENT_SCOPE)
|
||||
set(_vfile "${FFMPEG_${component}_INCLUDE_DIR}/lib${component}/version.h")
|
||||
|
||||
if(EXISTS "${_vfile}")
|
||||
file(STRINGS "${_vfile}" _version_parse REGEX "^.*VERSION_(MAJOR|MINOR|MICRO)[ \t]+[0-9]+[ \t]*$")
|
||||
string(REGEX REPLACE ".*VERSION_MAJOR[ \t]+([0-9]+).*" "\\1" _major "${_version_parse}")
|
||||
string(REGEX REPLACE ".*VERSION_MINOR[ \t]+([0-9]+).*" "\\1" _minor "${_version_parse}")
|
||||
string(REGEX REPLACE ".*VERSION_MICRO[ \t]+([0-9]+).*" "\\1" _micro "${_version_parse}")
|
||||
|
||||
set(FFMPEG_${component_u}_VERSION_MAJOR "${_major}" PARENT_SCOPE)
|
||||
set(FFMPEG_${component_u}_VERSION_MINOR "${_minor}" PARENT_SCOPE)
|
||||
set(FFMPEG_${component_u}_VERSION_MICRO "${_micro}" PARENT_SCOPE)
|
||||
|
||||
set(FFMPEG_${component_u}_VERSION_STRING "${_major}.${_minor}.${_micro}" PARENT_SCOPE)
|
||||
else()
|
||||
message(STATUS "Failed parsing FFMpeg ${component} version")
|
||||
endif()
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
set(FFMPEG_INCLUDE_DIRS)
|
||||
set(FFMPEG_LIBRARIES)
|
||||
|
||||
if(NOT FFMpeg_FIND_COMPONENTS)
|
||||
message(FATAL_ERROR "No FFMpeg components requested")
|
||||
endif()
|
||||
|
||||
list(GET FFMpeg_FIND_COMPONENTS 0 _first_comp)
|
||||
string(TOUPPER "${_first_comp}" _first_comp)
|
||||
|
||||
foreach(component ${FFMpeg_FIND_COMPONENTS})
|
||||
if(component STREQUAL "avcodec")
|
||||
find_ffmpeg_library("${component}" "avcodec.h")
|
||||
elseif(component STREQUAL "avdevice")
|
||||
find_ffmpeg_library("${component}" "avdevice.h")
|
||||
elseif(component STREQUAL "avfilter")
|
||||
find_ffmpeg_library("${component}" "avfilter.h")
|
||||
elseif(component STREQUAL "avformat")
|
||||
find_ffmpeg_library("${component}" "avformat.h")
|
||||
elseif(component STREQUAL "avresample")
|
||||
find_ffmpeg_library("${component}" "avresample.h")
|
||||
elseif(component STREQUAL "avutil")
|
||||
find_ffmpeg_library("${component}" "avutil.h")
|
||||
elseif(component STREQUAL "postproc")
|
||||
find_ffmpeg_library("${component}" "postprocess.h")
|
||||
elseif(component STREQUAL "swresample")
|
||||
find_ffmpeg_library("${component}" "swresample.h")
|
||||
elseif(component STREQUAL "swscale")
|
||||
find_ffmpeg_library("${component}" "swscale.h")
|
||||
else()
|
||||
message(FATAL_ERROR "Unknown FFMpeg component requested: ${component}")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(FFMpeg
|
||||
FOUND_VAR FFMPEG_FOUND
|
||||
REQUIRED_VARS FFMPEG_${_first_comp}_LIBRARIES FFMPEG_${_first_comp}_INCLUDE_DIRS
|
||||
VERSION_VAR FFMPEG_${_first_comp}_VERSION_STRING
|
||||
HANDLE_COMPONENTS)
|
@ -1,52 +0,0 @@
|
||||
# Once done these will be defined:
|
||||
#
|
||||
# LIBAVCODEC_FOUND
|
||||
# LIBAVCODEC_INCLUDE_DIRS
|
||||
# LIBAVCODEC_LIBRARIES
|
||||
#
|
||||
# For use in OBS:
|
||||
#
|
||||
# FFMPEG_INCLUDE_DIR
|
||||
|
||||
find_package(PkgConfig QUIET)
|
||||
if (PKG_CONFIG_FOUND)
|
||||
pkg_check_modules(_AVCODEC QUIET libavcodec)
|
||||
endif()
|
||||
|
||||
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
set(_lib_suffix 64)
|
||||
else()
|
||||
set(_lib_suffix 32)
|
||||
endif()
|
||||
|
||||
find_path(FFMPEG_INCLUDE_DIR
|
||||
NAMES libavcodec/avcodec.h
|
||||
HINTS
|
||||
ENV FFmpegPath${_lib_suffix}
|
||||
ENV FFmpegPath
|
||||
${_AVCODEC_INCLUDE_DIRS}
|
||||
PATHS
|
||||
/usr/include /usr/local/include /opt/local/include /sw/include
|
||||
PATH_SUFFIXES ffmpeg libav)
|
||||
|
||||
find_library(AVCODEC_LIB
|
||||
NAMES ${_AVCODEC_LIBRARIES} avcodec-ffmpeg avcodec
|
||||
HINTS
|
||||
ENV FFmpegPath${_lib_suffix}
|
||||
ENV FFmpegPath
|
||||
${_AVCODEC_LIBRARY_DIRS}
|
||||
PATHS
|
||||
/usr/lib /usr/local/lib /opt/local/lib /sw/lib
|
||||
PATH_SUFFIXES
|
||||
lib${_lib_suffix} lib
|
||||
libs${_lib_suffix} libs
|
||||
bin${_lib_suffix} bin)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(Libavcodec DEFAULT_MSG AVCODEC_LIB FFMPEG_INCLUDE_DIR)
|
||||
mark_as_advanced(FFMPEG_INCLUDE_DIR AVCODEC_LIB)
|
||||
|
||||
if(LIBAVCODEC_FOUND)
|
||||
set(LIBAVCODEC_INCLUDE_DIRS ${FFMPEG_INCLUDE_DIR})
|
||||
set(LIBAVCODEC_LIBRARIES ${AVCODEC_LIB})
|
||||
endif()
|
@ -1,48 +0,0 @@
|
||||
# Once done these will be defined:
|
||||
#
|
||||
# LIBAVFORMAT_FOUND
|
||||
# LIBAVFORMAT_INCLUDE_DIRS
|
||||
# LIBAVFORMAT_LIBRARIES
|
||||
|
||||
find_package(PkgConfig QUIET)
|
||||
if (PKG_CONFIG_FOUND)
|
||||
pkg_check_modules(_AVFORMAT QUIET libavformat)
|
||||
endif()
|
||||
|
||||
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
set(_lib_suffix 64)
|
||||
else()
|
||||
set(_lib_suffix 32)
|
||||
endif()
|
||||
|
||||
find_path(FFMPEG_INCLUDE_DIR
|
||||
NAMES libavformat/avformat.h
|
||||
HINTS
|
||||
ENV FFmpegPath${_lib_suffix}
|
||||
ENV FFmpegPath
|
||||
${_AVFORMAT_INCLUDE_DIRS}
|
||||
PATHS
|
||||
/usr/include /usr/local/include /opt/local/include /sw/include
|
||||
PATH_SUFFIXES ffmpeg libav)
|
||||
|
||||
find_library(AVFORMAT_LIB
|
||||
NAMES ${_AVFORMAT_LIBRARIES} avformat-ffmpeg avformat
|
||||
HINTS
|
||||
ENV FFmpegPath${_lib_suffix}
|
||||
ENV FFmpegPath
|
||||
${_AVFORMAT_LIBRARY_DIRS}
|
||||
PATHS
|
||||
/usr/lib /usr/local/lib /opt/local/lib /sw/lib
|
||||
PATH_SUFFIXES
|
||||
lib${_lib_suffix} lib
|
||||
libs${_lib_suffix} libs
|
||||
bin${_lib_suffix} bin)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(Libavformat DEFAULT_MSG AVFORMAT_LIB FFMPEG_INCLUDE_DIR)
|
||||
mark_as_advanced(FFMPEG_INCLUDE_DIR AVFORMAT_LIB)
|
||||
|
||||
if(LIBAVFORMAT_FOUND)
|
||||
set(LIBAVFORMAT_INCLUDE_DIRS ${FFMPEG_INCLUDE_DIR})
|
||||
set(LIBAVFORMAT_LIBRARIES ${AVFORMAT_LIB})
|
||||
endif()
|
@ -1,48 +0,0 @@
|
||||
# Once done these will be defined:
|
||||
#
|
||||
# LIBAVUTIL_FOUND
|
||||
# LIBAVUTIL_INCLUDE_DIRS
|
||||
# LIBAVUTIL_LIBRARIES
|
||||
|
||||
find_package(PkgConfig QUIET)
|
||||
if (PKG_CONFIG_FOUND)
|
||||
pkg_check_modules(_AVUTIL QUIET libavutil)
|
||||
endif()
|
||||
|
||||
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
set(_lib_suffix 64)
|
||||
else()
|
||||
set(_lib_suffix 32)
|
||||
endif()
|
||||
|
||||
find_path(FFMPEG_INCLUDE_DIR
|
||||
NAMES libavutil/avutil.h
|
||||
HINTS
|
||||
ENV FFmpegPath${_lib_suffix}
|
||||
ENV FFmpegPath
|
||||
${_AVUTIL_INCLUDE_DIRS}
|
||||
PATHS
|
||||
/usr/include /usr/local/include /opt/local/include /sw/include
|
||||
PATH_SUFFIXES ffmpeg libav)
|
||||
|
||||
find_library(AVUTIL_LIB
|
||||
NAMES ${_AVUTIL_LIBRARIES} avutil-ffmpeg avutil
|
||||
HINTS
|
||||
ENV FFmpegPath${_lib_suffix}
|
||||
ENV FFmpegPath
|
||||
${_AVUTIL_LIBRARY_DIRS}
|
||||
PATHS
|
||||
/usr/lib /usr/local/lib /opt/local/lib /sw/lib
|
||||
PATH_SUFFIXES
|
||||
lib${_lib_suffix} lib
|
||||
libs${_lib_suffix} libs
|
||||
bin${_lib_suffix} bin)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(Libavutil DEFAULT_MSG AVUTIL_LIB FFMPEG_INCLUDE_DIR)
|
||||
mark_as_advanced(FFMPEG_INCLUDE_DIR AVUTIL_LIB)
|
||||
|
||||
if(LIBAVUTIL_FOUND)
|
||||
set(LIBAVUTIL_INCLUDE_DIRS ${FFMPEG_INCLUDE_DIR})
|
||||
set(LIBAVUTIL_LIBRARIES ${AVUTIL_LIB})
|
||||
endif()
|
@ -1,48 +0,0 @@
|
||||
# Once done these will be defined:
|
||||
#
|
||||
# LIBSWRESAMPLE_FOUND
|
||||
# LIBSWRESAMPLE_INCLUDE_DIRS
|
||||
# LIBSWRESAMPLE_LIBRARIES
|
||||
|
||||
find_package(PkgConfig QUIET)
|
||||
if (PKG_CONFIG_FOUND)
|
||||
pkg_check_modules(_SWRESAMPLE QUIET libswresample)
|
||||
endif()
|
||||
|
||||
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
set(_lib_suffix 64)
|
||||
else()
|
||||
set(_lib_suffix 32)
|
||||
endif()
|
||||
|
||||
find_path(FFMPEG_INCLUDE_DIR
|
||||
NAMES libswresample/swresample.h
|
||||
HINTS
|
||||
ENV FFmpegPath${_lib_suffix}
|
||||
ENV FFmpegPath
|
||||
${_SWRESAMPLE_INCLUDE_DIRS}
|
||||
PATHS
|
||||
/usr/include /usr/local/include /opt/local/include /sw/include
|
||||
PATH_SUFFIXES ffmpeg libav)
|
||||
|
||||
find_library(SWRESAMPLE_LIB
|
||||
NAMES ${_SWRESAMPLE_LIBRARIES} swresample-ffmpeg swresample
|
||||
HINTS
|
||||
ENV FFmpegPath${_lib_suffix}
|
||||
ENV FFmpegPath
|
||||
${_SWRESAMPLE_LIBRARY_DIRS}
|
||||
PATHS
|
||||
/usr/lib /usr/local/lib /opt/local/lib /sw/lib
|
||||
PATH_SUFFIXES
|
||||
lib${_lib_suffix} lib
|
||||
libs${_lib_suffix} libs
|
||||
bin${_lib_suffix} bin)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(Libswresample DEFAULT_MSG SWRESAMPLE_LIB FFMPEG_INCLUDE_DIR)
|
||||
mark_as_advanced(FFMPEG_INCLUDE_DIR SWRESAMPLE_LIB)
|
||||
|
||||
if(LIBSWRESAMPLE_FOUND)
|
||||
set(LIBSWRESAMPLE_INCLUDE_DIRS ${FFMPEG_INCLUDE_DIR})
|
||||
set(LIBSWRESAMPLE_LIBRARIES ${SWRESAMPLE_LIB})
|
||||
endif()
|
@ -1,48 +0,0 @@
|
||||
# Once done these will be defined:
|
||||
#
|
||||
# LIBSWSCALE_FOUND
|
||||
# LIBSWSCALE_INCLUDE_DIRS
|
||||
# LIBSWSCALE_LIBRARIES
|
||||
|
||||
find_package(PkgConfig QUIET)
|
||||
if (PKG_CONFIG_FOUND)
|
||||
pkg_check_modules(_SWSCALE QUIET libswscale)
|
||||
endif()
|
||||
|
||||
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
set(_lib_suffix 64)
|
||||
else()
|
||||
set(_lib_suffix 32)
|
||||
endif()
|
||||
|
||||
find_path(FFMPEG_INCLUDE_DIR
|
||||
NAMES libswscale/swscale.h
|
||||
HINTS
|
||||
ENV FFmpegPath${_lib_suffix}
|
||||
ENV FFmpegPath
|
||||
${_SWSCALE_INCLUDE_DIRS}
|
||||
PATHS
|
||||
/usr/include /usr/local/include /opt/local/include /sw/include
|
||||
PATH_SUFFIXES ffmpeg libav)
|
||||
|
||||
find_library(SWSCALE_LIB
|
||||
NAMES ${_SWSCALE_LIBRARIES} swscale-ffmpeg swscale
|
||||
HINTS
|
||||
ENV FFmpegPath${_lib_suffix}
|
||||
ENV FFmpegPath
|
||||
${_SWSCALE_LIBRARY_DIRS}
|
||||
PATHS
|
||||
/usr/lib /usr/local/lib /opt/local/lib /sw/lib
|
||||
PATH_SUFFIXES
|
||||
lib${_lib_suffix} lib
|
||||
libs${_lib_suffix} libs
|
||||
bin${_lib_suffix} bin)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(Libswscale DEFAULT_MSG SWSCALE_LIB FFMPEG_INCLUDE_DIR)
|
||||
mark_as_advanced(FFMPEG_INCLUDE_DIR SWSCALE_LIB)
|
||||
|
||||
if(LIBSWSCALE_FOUND)
|
||||
set(LIBSWSCALE_INCLUDE_DIRS ${FFMPEG_INCLUDE_DIR})
|
||||
set(LIBSWSCALE_LIBRARIES ${SWSCALE_LIB})
|
||||
endif()
|
@ -2,32 +2,22 @@ project(libobs)
|
||||
|
||||
find_package(Threads REQUIRED)
|
||||
|
||||
find_package(Libswscale REQUIRED)
|
||||
include_directories(${LIBSWSCALE_INCLUDE_DIRS})
|
||||
add_definitions(${LIBSWSCALE_DEFINITIONS})
|
||||
find_package(FFMpeg REQUIRED
|
||||
COMPONENTS avformat avutil swscale swresample
|
||||
OPTIONAL_COMPONENTS avcodec)
|
||||
include_directories(${FFMPEG_INCLUDE_DIRS})
|
||||
|
||||
find_package(Libswresample REQUIRED)
|
||||
include_directories(${LIBSWRESAMPLE_INCLUDE_DIRS})
|
||||
add_definitions(${LIBSWRESAMPLE_DEFINITIONS})
|
||||
list(REMOVE_ITEM FFMPEG_LIBRARIES ${FFMPEG_AVCODEC_LIBRARIES})
|
||||
|
||||
find_package(Libavutil REQUIRED)
|
||||
include_directories(${LIBAVUTIL_INCLUDE_DIRS})
|
||||
add_definitions(${LIBAVUTIL_DEFINITIONS})
|
||||
|
||||
find_package(Libavformat REQUIRED)
|
||||
include_directories(${LIBAVFORMAT_INCLUDE_DIRS})
|
||||
add_definitions(${LIBAVFORMAT_DEFINITIONS})
|
||||
|
||||
find_package(Libavcodec QUIET)
|
||||
find_package(ImageMagick QUIET COMPONENTS MagickCore)
|
||||
|
||||
if(NOT ImageMagick_MagickCore_FOUND AND NOT LIBAVCODEC_FOUND)
|
||||
if(NOT ImageMagick_MagickCore_FOUND AND NOT FFMPEG_AVCODEC_FOUND)
|
||||
message(FATAL_ERROR "Either MagickCore or Libavcodec is required, but both were not found")
|
||||
endif()
|
||||
|
||||
option(LIBOBS_PREFER_IMAGEMAGICK "Prefer ImageMagick over ffmpeg for image loading" ON)
|
||||
|
||||
if(NOT LIBAVCODEC_FOUND OR (ImageMagick_MagickCore_FOUND AND LIBOBS_PREFER_IMAGEMAGICK))
|
||||
if(NOT FFMPEG_AVCODEC_FOUND OR (ImageMagick_MagickCore_FOUND AND LIBOBS_PREFER_IMAGEMAGICK))
|
||||
message(STATUS "Using ImageMagick for image loading in libobs")
|
||||
|
||||
set(libobs_image_loading_SOURCES
|
||||
@ -35,17 +25,14 @@ if(NOT LIBAVCODEC_FOUND OR (ImageMagick_MagickCore_FOUND AND LIBOBS_PREFER_IMAGE
|
||||
set(libobs_image_loading_LIBRARIES
|
||||
${ImageMagick_LIBRARIES})
|
||||
|
||||
include_directories(
|
||||
${ImageMagick_INCLUDE_DIRS})
|
||||
include_directories(${ImageMagick_INCLUDE_DIRS})
|
||||
else()
|
||||
message(STATUS "Using libavcodec for image loading in libobs")
|
||||
|
||||
set(libobs_image_loading_SOURCES
|
||||
graphics/graphics-ffmpeg.c)
|
||||
set(libobs_image_loading_LIBRARIES
|
||||
${LIBAVCODEC_LIBRARIES})
|
||||
|
||||
include_directories(${LIBAVCODEC_INCLUDE_DIRS})
|
||||
${FFMPEG_AVCODEC_LIBRARIES})
|
||||
endif()
|
||||
|
||||
add_definitions(-DLIBOBS_EXPORTS)
|
||||
@ -281,19 +268,17 @@ endif()
|
||||
target_compile_options(libobs
|
||||
PUBLIC
|
||||
"${THREADS_DEFINITIONS}")
|
||||
target_include_directories(libobs PUBLIC
|
||||
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>"
|
||||
"$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/config>"
|
||||
"$<INSTALL_INTERFACE:${OBS_INCLUDE_DESTINATION}>")
|
||||
target_include_directories(libobs
|
||||
PUBLIC
|
||||
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>"
|
||||
"$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/config>"
|
||||
"$<INSTALL_INTERFACE:${OBS_INCLUDE_DESTINATION}>")
|
||||
target_link_libraries(libobs
|
||||
PRIVATE
|
||||
${libobs_PLATFORM_DEPS}
|
||||
${libobs_image_loading_LIBRARIES}
|
||||
${OBS_JANSSON_IMPORT}
|
||||
${LIBSWSCALE_LIBRARIES}
|
||||
${LIBSWRESAMPLE_LIBRARIES}
|
||||
${LIBAVFORMAT_LIBRARIES}
|
||||
${LIBAVUTIL_LIBRARIES}
|
||||
${FFMPEG_LIBRARIES}
|
||||
PUBLIC
|
||||
${THREADS_LIBRARIES})
|
||||
|
||||
|
@ -5,25 +5,9 @@ if(WIN32)
|
||||
w32-pthreads)
|
||||
endif()
|
||||
|
||||
find_package(Libavcodec REQUIRED)
|
||||
include_directories(${LIBAVCODEC_INCLUDE_DIRS})
|
||||
add_definitions(${LIBAVCODEC_DEFINITIONS})
|
||||
|
||||
find_package(Libavutil REQUIRED)
|
||||
include_directories(${LIBAVUTIL_INCLUDE_DIRS})
|
||||
add_definitions(${LIBAVUTIL_DEFINITIONS})
|
||||
|
||||
find_package(Libswscale REQUIRED)
|
||||
include_directories(${LIBSWSCALE_INCLUDE_DIRS})
|
||||
add_definitions(${LIBSWSCALE_DEFINITIONS})
|
||||
|
||||
find_package(Libavformat REQUIRED)
|
||||
include_directories(${LIBAVFORMAT_INCLUDE_DIRS})
|
||||
add_definitions(${LIBAVFORMAT_DEFINITIONS})
|
||||
|
||||
find_package(Libswresample REQUIRED)
|
||||
include_directories(${LIBSWRESAMPLE_INCLUDE_DIRS})
|
||||
add_definitions(${LIBSWRESAMPLE_DEFINITIONS})
|
||||
find_package(FFMpeg REQUIRED
|
||||
COMPONENTS avcodec avutil swscale avformat swresample)
|
||||
include_directories(${FFMPEG_INCLUDE_DIRS})
|
||||
|
||||
set(obs-ffmpeg_HEADERS
|
||||
obs-ffmpeg-formats.h
|
||||
@ -39,10 +23,6 @@ add_library(obs-ffmpeg MODULE
|
||||
target_link_libraries(obs-ffmpeg
|
||||
libobs
|
||||
${obs-ffmpeg_PLATFORM_DEPS}
|
||||
${LIBAVCODEC_LIBRARIES}
|
||||
${LIBAVUTIL_LIBRARIES}
|
||||
${LIBSWSCALE_LIBRARIES}
|
||||
${LIBAVFORMAT_LIBRARIES}
|
||||
${LIBSWRESAMPLE_LIBRARIES})
|
||||
${FFMPEG_LIBRARIES})
|
||||
|
||||
install_obs_plugin_with_data(obs-ffmpeg data)
|
||||
|
@ -1,12 +1,7 @@
|
||||
project(win-dshow)
|
||||
|
||||
find_package(Libavutil REQUIRED)
|
||||
include_directories(${LIBAVUTIL_INCLUDE_DIRS})
|
||||
add_definitions(${LIBAVUTIL_DEFINITIONS})
|
||||
|
||||
find_package(Libavcodec REQUIRED)
|
||||
include_directories(${LIBAVCODEC_INCLUDE_DIRS})
|
||||
add_definitions(${LIBAVCODEC_DEFINITIONS})
|
||||
find_package(FFMpeg REQUIRED COMPONENTS avcodec avutil)
|
||||
include_directories(${FFMPEG_INCLUDE_DIRS})
|
||||
|
||||
set(win-dshow_HEADERS
|
||||
ffmpeg-decode.h)
|
||||
@ -48,7 +43,6 @@ add_library(win-dshow MODULE
|
||||
target_link_libraries(win-dshow
|
||||
libobs
|
||||
strmiids.lib
|
||||
${LIBAVUTIL_LIBRARIES}
|
||||
${LIBAVCODEC_LIBRARIES})
|
||||
${FFMPEG_LIBRARIES})
|
||||
|
||||
install_obs_plugin_with_data(win-dshow data)
|
||||
|
Loading…
x
Reference in New Issue
Block a user