424 lines
14 KiB
Diff
424 lines
14 KiB
Diff
|
From 983ae517e17a635e21a84a8abdff338e1805f33b Mon Sep 17 00:00:00 2001
|
||
|
From: Maxime Gauduin <alucryd@gmail.com>
|
||
|
Date: Mon, 1 Jun 2015 15:29:54 +0200
|
||
|
Subject: [PATCH] Try to dynamically link against system ffmpeg when possible
|
||
|
|
||
|
---
|
||
|
CMakeLists.txt | 192 ++++++++++++++++++++++++--------------------
|
||
|
CMakeTests/FindFFMPEG.cmake | 167 ++++++++++++++++++++++++++++++++++++++
|
||
|
2 files changed, 271 insertions(+), 88 deletions(-)
|
||
|
create mode 100644 CMakeTests/FindFFMPEG.cmake
|
||
|
|
||
|
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||
|
index eb66586..00cf33a 100644
|
||
|
--- a/CMakeLists.txt
|
||
|
+++ b/CMakeLists.txt
|
||
|
@@ -98,6 +98,7 @@ option(UNITTEST "Set to ON to generate the unittest target" ${UNITTEST})
|
||
|
option(SIMULATOR "Set to ON when targeting an x86 simulator of an ARM platform" ${SIMULATOR})
|
||
|
# :: Options
|
||
|
option(USE_FFMPEG "Build with FFMPEG support" ${USE_FFMPEG})
|
||
|
+option(USE_SYSTEM_FFMPEG "Dynamically link against system FFMPEG" ${USE_SYSTEM_FFMPEG})
|
||
|
|
||
|
if(ANDROID OR BLACKBERRY OR IOS)
|
||
|
if (NOT CMAKE_TOOLCHAIN_FILE)
|
||
|
@@ -411,96 +412,101 @@ add_library(stb_vorbis STATIC
|
||
|
native/ext/stb_vorbis/stb_vorbis.h)
|
||
|
include_directories(native/ext/stb_vorbis)
|
||
|
|
||
|
-if(USE_FFMPEG AND NOT DEFINED FFMPEG_BUILDDIR)
|
||
|
- if(ANDROID)
|
||
|
- if(ARMV7)
|
||
|
- set(PLATFORM_ARCH "android/armv7")
|
||
|
- elseif(ARM)
|
||
|
- set(PLATFORM_ARCH "android/arm")
|
||
|
- elseif(X86)
|
||
|
- set(PLATFORM_ARCH "android/x86")
|
||
|
- endif()
|
||
|
- elseif(BLACKBERRY)
|
||
|
- set(PLATFORM_ARCH "blackberry/armv7")
|
||
|
- elseif(IOS)
|
||
|
- set(PLATFORM_ARCH "ios/universal")
|
||
|
- elseif(MACOSX)
|
||
|
- set(PLATFORM_ARCH "macosx/x86_64")
|
||
|
- elseif(LINUX)
|
||
|
- if(ARMV7)
|
||
|
- set(PLATFORM_ARCH "linux/armv7")
|
||
|
- elseif(ARM)
|
||
|
- set(PLATFORM_ARCH "linux/arm")
|
||
|
- elseif(MIPS)
|
||
|
- set(PLATFORM_ARCH "linux/mips32")
|
||
|
- elseif(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||
|
- set(PLATFORM_ARCH "linux/x86_64")
|
||
|
- else()
|
||
|
- set(PLATFORM_ARCH "linux/x86")
|
||
|
- endif()
|
||
|
- endif()
|
||
|
- # Using static libraries
|
||
|
- if (DEFINED PLATFORM_ARCH)
|
||
|
- include_directories(ffmpeg/${PLATFORM_ARCH}/include)
|
||
|
- link_directories(ffmpeg/${PLATFORM_ARCH}/lib)
|
||
|
- set(FFMPEG_LIBRARIES libavformat.a libavcodec.a libavutil.a libswresample.a libswscale.a)
|
||
|
+if(USE_FFMPEG)
|
||
|
+ if(USE_SYSTEM_FFMPEG)
|
||
|
+ include(FindFFMPEG)
|
||
|
else()
|
||
|
- # Manual definition of system library locations by the user.
|
||
|
- if (DEFINED FFMPEG_INCLUDE_PATH)
|
||
|
- include_directories(ffmpeg ${FFMPEG_INCLUDE_PATH})
|
||
|
- endif()
|
||
|
- if (DEFINED AVFORMAT_PATH)
|
||
|
+ set(FFMPEG_FOUND OFF)
|
||
|
+ endif()
|
||
|
+ if(NOT FFMPEG_FOUND)
|
||
|
+ if(NOT DEFINED FFMPEG_BUILDDIR)
|
||
|
+ if(ANDROID)
|
||
|
+ if(ARMV7)
|
||
|
+ set(PLATFORM_ARCH "android/armv7")
|
||
|
+ elseif(ARM)
|
||
|
+ set(PLATFORM_ARCH "android/arm")
|
||
|
+ elseif(X86)
|
||
|
+ set(PLATFORM_ARCH "android/x86")
|
||
|
+ endif()
|
||
|
+ elseif(BLACKBERRY)
|
||
|
+ set(PLATFORM_ARCH "blackberry/armv7")
|
||
|
+ elseif(IOS)
|
||
|
+ set(PLATFORM_ARCH "ios/universal")
|
||
|
+ elseif(MACOSX)
|
||
|
+ set(PLATFORM_ARCH "macosx/x86_64")
|
||
|
+ elseif(LINUX)
|
||
|
+ if(ARMV7)
|
||
|
+ set(PLATFORM_ARCH "linux/armv7")
|
||
|
+ elseif(ARM)
|
||
|
+ set(PLATFORM_ARCH "linux/arm")
|
||
|
+ elseif(MIPS)
|
||
|
+ set(PLATFORM_ARCH "linux/mips32")
|
||
|
+ elseif(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||
|
+ set(PLATFORM_ARCH "linux/x86_64")
|
||
|
+ else()
|
||
|
+ set(PLATFORM_ARCH "linux/x86")
|
||
|
+ endif()
|
||
|
+ endif()
|
||
|
+ # Using static libraries
|
||
|
+ if (DEFINED PLATFORM_ARCH)
|
||
|
+ include_directories(ffmpeg/${PLATFORM_ARCH}/include)
|
||
|
+ link_directories(ffmpeg/${PLATFORM_ARCH}/lib)
|
||
|
+ set(FFMPEG_LIBRARIES libavformat.a libavcodec.a libavutil.a libswresample.a libswscale.a)
|
||
|
+ else()
|
||
|
+ # Manual definition of system library locations by the user.
|
||
|
+ if (DEFINED FFMPEG_INCLUDE_PATH)
|
||
|
+ include_directories(ffmpeg ${FFMPEG_INCLUDE_PATH})
|
||
|
+ endif()
|
||
|
+ if (DEFINED AVFORMAT_PATH)
|
||
|
+ add_library(libavformat STATIC IMPORTED)
|
||
|
+ set_target_properties(libavformat PROPERTIES IMPORTED_LOCATION ${AVFORMAT_PATH})
|
||
|
+ SET (FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} libavformat)
|
||
|
+ endif()
|
||
|
+ if (DEFINED AVCODEC_PATH)
|
||
|
+ add_library(libavcodec STATIC IMPORTED)
|
||
|
+ set_target_properties(libavcodec PROPERTIES IMPORTED_LOCATION ${AVCODEC_PATH})
|
||
|
+ SET (FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} libavcodec)
|
||
|
+ endif()
|
||
|
+ if (DEFINED AVUTIL_PATH)
|
||
|
+ add_library(libavutil STATIC IMPORTED)
|
||
|
+ set_target_properties(libavutil PROPERTIES IMPORTED_LOCATION ${AVUTIL_PATH})
|
||
|
+ SET (FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} libavutil)
|
||
|
+ endif()
|
||
|
+ if (DEFINED SWRESAMPLE_PATH)
|
||
|
+ add_library(libswresample STATIC IMPORTED)
|
||
|
+ set_target_properties(libswresample PROPERTIES IMPORTED_LOCATION ${SWRESAMPLE_PATH})
|
||
|
+ SET (FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} libswresample)
|
||
|
+ endif()
|
||
|
+ if (DEFINED SWSCALE_PATH)
|
||
|
+ add_library(libswscale STATIC IMPORTED)
|
||
|
+ set_target_properties(libswscale PROPERTIES IMPORTED_LOCATION ${SWSCALE_PATH})
|
||
|
+ SET (FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} libswscale)
|
||
|
+ endif()
|
||
|
+ endif(DEFINED PLATFORM_ARCH)
|
||
|
+ else(NOT DEFINED FFMPEG_BUILDDIR)
|
||
|
+ # Using shared libraries
|
||
|
+ include_directories(ffmpeg ${FFMPEG_BUILDDIR})
|
||
|
+
|
||
|
add_library(libavformat STATIC IMPORTED)
|
||
|
- set_target_properties(libavformat PROPERTIES IMPORTED_LOCATION ${AVFORMAT_PATH})
|
||
|
- SET (FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} libavformat)
|
||
|
- endif()
|
||
|
- if (DEFINED AVCODEC_PATH)
|
||
|
+ set_target_properties(libavformat PROPERTIES IMPORTED_LOCATION ${FFMPEG_BUILDDIR}/libavformat/libavformat.a)
|
||
|
add_library(libavcodec STATIC IMPORTED)
|
||
|
- set_target_properties(libavcodec PROPERTIES IMPORTED_LOCATION ${AVCODEC_PATH})
|
||
|
- SET (FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} libavcodec)
|
||
|
- endif()
|
||
|
- if (DEFINED AVUTIL_PATH)
|
||
|
+ set_target_properties(libavcodec PROPERTIES IMPORTED_LOCATION ${FFMPEG_BUILDDIR}/libavcodec/libavcodec.a)
|
||
|
add_library(libavutil STATIC IMPORTED)
|
||
|
- set_target_properties(libavutil PROPERTIES IMPORTED_LOCATION ${AVUTIL_PATH})
|
||
|
- SET (FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} libavutil)
|
||
|
- endif()
|
||
|
- if (DEFINED SWRESAMPLE_PATH)
|
||
|
+ set_target_properties(libavutil PROPERTIES IMPORTED_LOCATION ${FFMPEG_BUILDDIR}/libavutil/libavutil.a)
|
||
|
add_library(libswresample STATIC IMPORTED)
|
||
|
- set_target_properties(libswresample PROPERTIES IMPORTED_LOCATION ${SWRESAMPLE_PATH})
|
||
|
- SET (FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} libswresample)
|
||
|
- endif()
|
||
|
- if (DEFINED SWSCALE_PATH)
|
||
|
+ set_target_properties(libswresample PROPERTIES IMPORTED_LOCATION ${FFMPEG_BUILDDIR}/libswresample/libswresample.a)
|
||
|
add_library(libswscale STATIC IMPORTED)
|
||
|
- set_target_properties(libswscale PROPERTIES IMPORTED_LOCATION ${SWSCALE_PATH})
|
||
|
- SET (FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} libswscale)
|
||
|
- endif()
|
||
|
- endif(DEFINED PLATFORM_ARCH)
|
||
|
-endif(USE_FFMPEG AND NOT DEFINED FFMPEG_BUILDDIR)
|
||
|
-
|
||
|
-if(USE_FFMPEG)
|
||
|
- # Using shared libraries
|
||
|
- if(DEFINED FFMPEG_BUILDDIR)
|
||
|
- include_directories(ffmpeg ${FFMPEG_BUILDDIR})
|
||
|
-
|
||
|
- add_library(libavformat STATIC IMPORTED)
|
||
|
- set_target_properties(libavformat PROPERTIES IMPORTED_LOCATION ${FFMPEG_BUILDDIR}/libavformat/libavformat.a)
|
||
|
- add_library(libavcodec STATIC IMPORTED)
|
||
|
- set_target_properties(libavcodec PROPERTIES IMPORTED_LOCATION ${FFMPEG_BUILDDIR}/libavcodec/libavcodec.a)
|
||
|
- add_library(libavutil STATIC IMPORTED)
|
||
|
- set_target_properties(libavutil PROPERTIES IMPORTED_LOCATION ${FFMPEG_BUILDDIR}/libavutil/libavutil.a)
|
||
|
- add_library(libswresample STATIC IMPORTED)
|
||
|
- set_target_properties(libswresample PROPERTIES IMPORTED_LOCATION ${FFMPEG_BUILDDIR}/libswresample/libswresample.a)
|
||
|
- add_library(libswscale STATIC IMPORTED)
|
||
|
- set_target_properties(libswscale PROPERTIES IMPORTED_LOCATION ${FFMPEG_BUILDDIR}/libswscale/libswscale.a)
|
||
|
-
|
||
|
- SET (FFMPEG_LIBRARIES
|
||
|
- libavformat
|
||
|
- libavcodec
|
||
|
- libavutil
|
||
|
- libswresample
|
||
|
- libswscale
|
||
|
- )
|
||
|
- endif()
|
||
|
+ set_target_properties(libswscale PROPERTIES IMPORTED_LOCATION ${FFMPEG_BUILDDIR}/libswscale/libswscale.a)
|
||
|
+
|
||
|
+ SET (FFMPEG_LIBRARIES
|
||
|
+ libavformat
|
||
|
+ libavcodec
|
||
|
+ libavutil
|
||
|
+ libswresample
|
||
|
+ libswscale
|
||
|
+ )
|
||
|
+ endif(NOT DEFINED FFMPEG_BUILDDIR)
|
||
|
+ endif(NOT FFMPEG_FOUND)
|
||
|
|
||
|
find_library(ICONV_LIBRARY NAMES iconv)
|
||
|
if (ICONV_LIBRARY)
|
||
|
@@ -514,15 +520,25 @@ if(USE_FFMPEG)
|
||
|
endif()
|
||
|
endif(APPLE)
|
||
|
|
||
|
- set(LinkCommon ${LinkCommon} ${FFMPEG_LIBRARIES})
|
||
|
+ if(FFMPEG_FOUND)
|
||
|
+ set(nativeExtraLibs ${nativeExtraLibs} ${FFMPEG_LIBRARIES})
|
||
|
+ else()
|
||
|
+ set(LinkCommon ${LinkCommon} ${FFMPEG_LIBRARIES})
|
||
|
+ endif()
|
||
|
+ target_link_libraries(Common ${FFMPEG_LIBRARIES})
|
||
|
add_definitions(-DUSE_FFMPEG)
|
||
|
endif(USE_FFMPEG)
|
||
|
|
||
|
# Modification to show where we are pulling the ffmpeg libraries from.
|
||
|
if(USE_FFMPEG AND DEFINED FFMPEG_LIBRARIES)
|
||
|
- target_link_libraries(Common ${FFMPEG_LIBRARIES})
|
||
|
message(STATUS "FFMPEG library locations:")
|
||
|
- if(DEFINED PLATFORM_ARCH)
|
||
|
+ if(FFMPEG_FOUND)
|
||
|
+ message(STATUS "libavcodec location: ${FFMPEG_avcodec_LIBRARY}")
|
||
|
+ message(STATUS "libavformat location: ${FFMPEG_avformat_LIBRARY}")
|
||
|
+ message(STATUS "libavutil location: ${FFMPEG_avutil_LIBRARY}")
|
||
|
+ message(STATUS "libswresample location: ${FFMPEG_swresample_LIBRARY}")
|
||
|
+ message(STATUS "libswscale location: ${FFMPEG_swscale_LIBRARY}")
|
||
|
+ elseif(DEFINED PLATFORM_ARCH)
|
||
|
set(TEMP ${CMAKE_SOURCE_DIR}/ffmpeg/${PLATFORM_ARCH}/lib)
|
||
|
message(STATUS "libavcodec location: ${TEMP}/libavcodec.a")
|
||
|
message(STATUS "libavformat location: ${TEMP}/libavformat.a")
|
||
|
@@ -540,7 +556,7 @@ if(USE_FFMPEG AND DEFINED FFMPEG_LIBRARIES)
|
||
|
message(STATUS "libswresample location: ${TEMP}")
|
||
|
get_target_property(TEMP libswscale IMPORTED_LOCATION)
|
||
|
message(STATUS "libswscale location: ${TEMP}")
|
||
|
- endif(DEFINED PLATFORM_ARCH)
|
||
|
+ endif()
|
||
|
else()
|
||
|
message(STATUS "ERROR: No FFMPEG library locations")
|
||
|
endif()
|
||
|
diff --git a/CMakeTests/FindFFMPEG.cmake b/CMakeTests/FindFFMPEG.cmake
|
||
|
new file mode 100644
|
||
|
index 0000000..8fac08f
|
||
|
--- /dev/null
|
||
|
+++ b/CMakeTests/FindFFMPEG.cmake
|
||
|
@@ -0,0 +1,167 @@
|
||
|
+# FindFFMPEG
|
||
|
+# ----------
|
||
|
+#
|
||
|
+# Find the native FFMPEG includes and libraries
|
||
|
+#
|
||
|
+# This module defines:
|
||
|
+#
|
||
|
+# FFMPEG_INCLUDE_DIR, where to find avformat.h, avcodec.h...
|
||
|
+# FFMPEG_LIBRARIES, the libraries to link against to use FFMPEG.
|
||
|
+# FFMPEG_FOUND, If false, do not try to use FFMPEG.
|
||
|
+#
|
||
|
+# also defined, but not for general use are:
|
||
|
+#
|
||
|
+# FFMPEG_avformat_LIBRARY, where to find the FFMPEG avformat library.
|
||
|
+# FFMPEG_avcodec_LIBRARY, where to find the FFMPEG avcodec library.
|
||
|
+#
|
||
|
+# This is useful to do it this way so that we can always add more libraries
|
||
|
+# if needed to ``FFMPEG_LIBRARIES`` if ffmpeg ever changes...
|
||
|
+
|
||
|
+#=============================================================================
|
||
|
+# Copyright: 1993-2008 Ken Martin, Will Schroeder, Bill Lorensen
|
||
|
+#
|
||
|
+# Distributed under the OSI-approved BSD License (the "License");
|
||
|
+# see accompanying file Copyright.txt for details.
|
||
|
+#
|
||
|
+# This software is distributed WITHOUT ANY WARRANTY; without even the
|
||
|
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||
|
+# See the License for more information.
|
||
|
+#=============================================================================
|
||
|
+# (To distribute this file outside of ppsspp, substitute the full
|
||
|
+# License text for the above reference.)
|
||
|
+
|
||
|
+find_path(FFMPEG_INCLUDE_DIR1 avformat.h
|
||
|
+ $ENV{FFMPEG_DIR}
|
||
|
+ $ENV{FFMPEG_DIR}/ffmpeg
|
||
|
+ $ENV{FFMPEG_DIR}/libavformat
|
||
|
+ $ENV{FFMPEG_DIR}/include/libavformat
|
||
|
+ $ENV{FFMPEG_DIR}/include/ffmpeg
|
||
|
+ /usr/local/include/ffmpeg
|
||
|
+ /usr/include/ffmpeg
|
||
|
+ /usr/include/libavformat
|
||
|
+ /usr/include/ffmpeg/libavformat
|
||
|
+ /usr/local/include/libavformat
|
||
|
+)
|
||
|
+
|
||
|
+find_path(FFMPEG_INCLUDE_DIR2 avcodec.h
|
||
|
+ $ENV{FFMPEG_DIR}
|
||
|
+ $ENV{FFMPEG_DIR}/ffmpeg
|
||
|
+ $ENV{FFMPEG_DIR}/libavcodec
|
||
|
+ $ENV{FFMPEG_DIR}/include/libavcodec
|
||
|
+ $ENV{FFMPEG_DIR}/include/ffmpeg
|
||
|
+ /usr/local/include/ffmpeg
|
||
|
+ /usr/include/ffmpeg
|
||
|
+ /usr/include/libavcodec
|
||
|
+ /usr/include/ffmpeg/libavcodec
|
||
|
+ /usr/local/include/libavcodec
|
||
|
+)
|
||
|
+
|
||
|
+find_path(FFMPEG_INCLUDE_DIR3 avutil.h
|
||
|
+ $ENV{FFMPEG_DIR}
|
||
|
+ $ENV{FFMPEG_DIR}/ffmpeg
|
||
|
+ $ENV{FFMPEG_DIR}/libavutil
|
||
|
+ $ENV{FFMPEG_DIR}/include/libavutil
|
||
|
+ $ENV{FFMPEG_DIR}/include/ffmpeg
|
||
|
+ /usr/local/include/ffmpeg
|
||
|
+ /usr/include/ffmpeg
|
||
|
+ /usr/include/libavutil
|
||
|
+ /usr/include/ffmpeg/libavutil
|
||
|
+ /usr/local/include/libavutil
|
||
|
+)
|
||
|
+
|
||
|
+find_path(FFMPEG_INCLUDE_DIR4 swresample.h
|
||
|
+ $ENV{FFMPEG_DIR}
|
||
|
+ $ENV{FFMPEG_DIR}/ffmpeg
|
||
|
+ $ENV{FFMPEG_DIR}/libswresample
|
||
|
+ $ENV{FFMPEG_DIR}/include/libswresample
|
||
|
+ $ENV{FFMPEG_DIR}/include/ffmpeg
|
||
|
+ /usr/local/include/ffmpeg
|
||
|
+ /usr/include/ffmpeg
|
||
|
+ /usr/include/libswresample
|
||
|
+ /usr/include/ffmpeg/libswresample
|
||
|
+ /usr/local/include/libswresample
|
||
|
+)
|
||
|
+
|
||
|
+find_path(FFMPEG_INCLUDE_DIR5 swscale.h
|
||
|
+ $ENV{FFMPEG_DIR}
|
||
|
+ $ENV{FFMPEG_DIR}/ffmpeg
|
||
|
+ $ENV{FFMPEG_DIR}/libswscale
|
||
|
+ $ENV{FFMPEG_DIR}/include/libswscale
|
||
|
+ $ENV{FFMPEG_DIR}/include/ffmpeg
|
||
|
+ /usr/local/include/ffmpeg
|
||
|
+ /usr/include/ffmpeg
|
||
|
+ /usr/include/libswscale
|
||
|
+ /usr/include/ffmpeg/libswscale
|
||
|
+ /usr/local/include/libswscale
|
||
|
+)
|
||
|
+
|
||
|
+if(FFMPEG_INCLUDE_DIR1 AND
|
||
|
+ FFMPEG_INCLUDE_DIR2 AND
|
||
|
+ FFMPEG_INCLUDE_DIR3 AND
|
||
|
+ FFMPEG_INCLUDE_DIR4 AND
|
||
|
+ FFMPEG_INCLUDE_DIR5
|
||
|
+)
|
||
|
+ set(FFMPEG_INCLUDE_DIR ${FFMPEG_INCLUDE_DIR1}
|
||
|
+ ${FFMPEG_INCLUDE_DIR2}
|
||
|
+ ${FFMPEG_INCLUDE_DIR3}
|
||
|
+ ${FFMPEG_INCLUDE_DIR4}
|
||
|
+ ${FFMPEG_INCLUDE_DIR5}
|
||
|
+ )
|
||
|
+endif()
|
||
|
+
|
||
|
+find_library(FFMPEG_avformat_LIBRARY avformat
|
||
|
+ $ENV{FFMPEG_DIR}
|
||
|
+ $ENV{FFMPEG_DIR}/lib
|
||
|
+ $ENV{FFMPEG_DIR}/libavformat
|
||
|
+ /usr/local/lib
|
||
|
+ /usr/lib
|
||
|
+)
|
||
|
+
|
||
|
+find_library(FFMPEG_avcodec_LIBRARY avcodec
|
||
|
+ $ENV{FFMPEG_DIR}
|
||
|
+ $ENV{FFMPEG_DIR}/lib
|
||
|
+ $ENV{FFMPEG_DIR}/libavcodec
|
||
|
+ /usr/local/lib
|
||
|
+ /usr/lib
|
||
|
+)
|
||
|
+
|
||
|
+find_library(FFMPEG_avutil_LIBRARY avutil
|
||
|
+ $ENV{FFMPEG_DIR}
|
||
|
+ $ENV{FFMPEG_DIR}/lib
|
||
|
+ $ENV{FFMPEG_DIR}/libavutil
|
||
|
+ /usr/local/lib
|
||
|
+ /usr/lib
|
||
|
+)
|
||
|
+
|
||
|
+find_library(FFMPEG_swresample_LIBRARY swresample
|
||
|
+ $ENV{FFMPEG_DIR}
|
||
|
+ $ENV{FFMPEG_DIR}/lib
|
||
|
+ $ENV{FFMPEG_DIR}/libswresample
|
||
|
+ /usr/local/lib
|
||
|
+ /usr/lib
|
||
|
+)
|
||
|
+
|
||
|
+find_library(FFMPEG_swscale_LIBRARY swscale
|
||
|
+ $ENV{FFMPEG_DIR}
|
||
|
+ $ENV{FFMPEG_DIR}/lib
|
||
|
+ $ENV{FFMPEG_DIR}/libswscale
|
||
|
+ /usr/local/lib
|
||
|
+ /usr/lib
|
||
|
+)
|
||
|
+
|
||
|
+if(FFMPEG_INCLUDE_DIR)
|
||
|
+ if(FFMPEG_avformat_LIBRARY AND
|
||
|
+ FFMPEG_avcodec_LIBRARY AND
|
||
|
+ FFMPEG_avutil_LIBRARY AND
|
||
|
+ FFMPEG_swresample_LIBRARY AND
|
||
|
+ FFMPEG_swscale_LIBRARY
|
||
|
+ )
|
||
|
+ set(FFMPEG_FOUND "YES")
|
||
|
+ set(FFMPEG_LIBRARIES ${FFMPEG_avformat_LIBRARY}
|
||
|
+ ${FFMPEG_avcodec_LIBRARY}
|
||
|
+ ${FFMPEG_avutil_LIBRARY}
|
||
|
+ ${FFMPEG_swresample_LIBRARY}
|
||
|
+ ${FFMPEG_swscale_LIBRARY}
|
||
|
+ )
|
||
|
+ endif()
|
||
|
+endif()
|
||
|
--
|
||
|
2.4.2
|
||
|
|