Allow for system ffmpeg usage.
Warning: this is NOT advised right now.
This commit is contained in:
@@ -0,0 +1,224 @@
|
|||||||
|
# This was copied from the robotology/ycm project.
|
||||||
|
|
||||||
|
#.rst:
|
||||||
|
# FindFFMPEG
|
||||||
|
# ----------
|
||||||
|
#
|
||||||
|
# Find the native FFMPEG includes and library
|
||||||
|
#
|
||||||
|
# This module defines::
|
||||||
|
#
|
||||||
|
# FFMPEG_INCLUDE_DIR, where to find avcodec.h, avformat.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 YCM, substitute the full
|
||||||
|
# License text for the above reference.)
|
||||||
|
|
||||||
|
# Originally from VTK project
|
||||||
|
|
||||||
|
|
||||||
|
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 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_DIR3 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_DIR4 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
|
||||||
|
)
|
||||||
|
|
||||||
|
find_path(FFMPEG_INCLUDE_DIR5 avdevice.h
|
||||||
|
$ENV{FFMPEG_DIR}
|
||||||
|
$ENV{FFMPEG_DIR}/ffmpeg
|
||||||
|
$ENV{FFMPEG_DIR}/libavdevice
|
||||||
|
$ENV{FFMPEG_DIR}/include/libavdevice
|
||||||
|
$ENV{FFMPEG_DIR}/include/ffmpeg
|
||||||
|
/usr/local/include/ffmpeg
|
||||||
|
/usr/include/ffmpeg
|
||||||
|
/usr/include/libavdevice
|
||||||
|
/usr/include/ffmpeg/libavdevice
|
||||||
|
/usr/local/include/libavdevice
|
||||||
|
)
|
||||||
|
|
||||||
|
if(FFMPEG_INCLUDE_DIR1)
|
||||||
|
if(FFMPEG_INCLUDE_DIR2)
|
||||||
|
if(FFMPEG_INCLUDE_DIR3)
|
||||||
|
set(FFMPEG_INCLUDE_DIR ${FFMPEG_INCLUDE_DIR1}
|
||||||
|
${FFMPEG_INCLUDE_DIR2}
|
||||||
|
${FFMPEG_INCLUDE_DIR3})
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(FFMPEG_INCLUDE_DIR4)
|
||||||
|
set(FFMPEG_INCLUDE_DIR ${FFMPEG_INCLUDE_DIR}
|
||||||
|
${FFMPEG_INCLUDE_DIR4})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(FFMPEG_INCLUDE_DIR5)
|
||||||
|
set(FFMPEG_INCLUDE_DIR ${FFMPEG_INCLUDE_DIR}
|
||||||
|
${FFMPEG_INCLUDE_DIR5}
|
||||||
|
${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
|
||||||
|
)
|
||||||
|
|
||||||
|
if(NOT DISABLE_SWSCALE)
|
||||||
|
find_library(FFMPEG_swscale_LIBRARY swscale
|
||||||
|
$ENV{FFMPEG_DIR}
|
||||||
|
$ENV{FFMPEG_DIR}/lib
|
||||||
|
$ENV{FFMPEG_DIR}/libswscale
|
||||||
|
/usr/local/lib
|
||||||
|
/usr/lib
|
||||||
|
)
|
||||||
|
endif(NOT DISABLE_SWSCALE)
|
||||||
|
|
||||||
|
find_library(FFMPEG_avdevice_LIBRARY avdevice
|
||||||
|
$ENV{FFMPEG_DIR}
|
||||||
|
$ENV{FFMPEG_DIR}/lib
|
||||||
|
$ENV{FFMPEG_DIR}/libavdevice
|
||||||
|
/usr/local/lib
|
||||||
|
/usr/lib
|
||||||
|
)
|
||||||
|
|
||||||
|
find_library(_FFMPEG_z_LIBRARY_ z
|
||||||
|
$ENV{FFMPEG_DIR}
|
||||||
|
$ENV{FFMPEG_DIR}/lib
|
||||||
|
/usr/local/lib
|
||||||
|
/usr/lib
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if(FFMPEG_INCLUDE_DIR)
|
||||||
|
if(FFMPEG_avformat_LIBRARY)
|
||||||
|
if(FFMPEG_avcodec_LIBRARY)
|
||||||
|
if(FFMPEG_avutil_LIBRARY)
|
||||||
|
set(FFMPEG_FOUND "YES")
|
||||||
|
set(FFMPEG_LIBRARIES ${FFMPEG_avformat_LIBRARY}
|
||||||
|
${FFMPEG_avcodec_LIBRARY}
|
||||||
|
${FFMPEG_avutil_LIBRARY}
|
||||||
|
)
|
||||||
|
if(FFMPEG_swscale_LIBRARY)
|
||||||
|
set(FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES}
|
||||||
|
${FFMPEG_swscale_LIBRARY}
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
if(FFMPEG_avdevice_LIBRARY)
|
||||||
|
set(FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES}
|
||||||
|
${FFMPEG_avdevice_LIBRARY}
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
if(_FFMPEG_z_LIBRARY_)
|
||||||
|
set( FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES}
|
||||||
|
${_FFMPEG_z_LIBRARY_}
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
mark_as_advanced(
|
||||||
|
FFMPEG_INCLUDE_DIR
|
||||||
|
FFMPEG_INCLUDE_DIR1
|
||||||
|
FFMPEG_INCLUDE_DIR2
|
||||||
|
FFMPEG_INCLUDE_DIR3
|
||||||
|
FFMPEG_INCLUDE_DIR4
|
||||||
|
FFMPEG_INCLUDE_DIR5
|
||||||
|
FFMPEG_avformat_LIBRARY
|
||||||
|
FFMPEG_avcodec_LIBRARY
|
||||||
|
FFMPEG_avutil_LIBRARY
|
||||||
|
FFMPEG_swscale_LIBRARY
|
||||||
|
FFMPEG_avdevice_LIBRARY
|
||||||
|
_FFMPEG_z_LIBRARY_
|
||||||
|
)
|
||||||
|
|
||||||
|
# Set package properties if FeatureSummary was included
|
||||||
|
if(COMMAND set_package_properties)
|
||||||
|
set_package_properties(FFMPEG PROPERTIES DESCRIPTION "A complete, cross-platform solution to record, convert and stream audio and video")
|
||||||
|
set_package_properties(FFMPEG PROPERTIES URL "http://ffmpeg.org/")
|
||||||
|
endif()
|
||||||
+40
-27
@@ -60,6 +60,8 @@ if(WIN32)
|
|||||||
else()
|
else()
|
||||||
if(LINUX)
|
if(LINUX)
|
||||||
option(WITH_FFMPEG "Build with FFMPEG." ON)
|
option(WITH_FFMPEG "Build with FFMPEG." ON)
|
||||||
|
# Builder beware: later versions of ffmpeg may break!
|
||||||
|
option(WITH_SYSTEM_FFMPEG "Build with the system's FFMPEG." OFF)
|
||||||
option(WITH_TTY "Build with Linux TTY Input Support." OFF)
|
option(WITH_TTY "Build with Linux TTY Input Support." OFF)
|
||||||
option(WITH_PROFILING "Build with Profiling Support." OFF)
|
option(WITH_PROFILING "Build with Profiling Support." OFF)
|
||||||
option(WITH_GLES2 "Build with OpenGL ES 2.0 Support." ON)
|
option(WITH_GLES2 "Build with OpenGL ES 2.0 Support." ON)
|
||||||
@@ -287,36 +289,47 @@ elseif(LINUX)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(WITH_FFMPEG)
|
if(WITH_FFMPEG)
|
||||||
list(APPEND FFMPEG_CONFIGURE
|
if (WITH_SYSTEM_FFMPEG)
|
||||||
"${SM_EXTERN_DIR}/ffmpeg-linux/src/ffmpeg/configure"
|
find_package("FFMPEG")
|
||||||
"--disable-programs"
|
if(NOT FFMPEG_FOUND)
|
||||||
"--disable-doc"
|
message(FATAL_ERROR "System ffmpeg not found! Either install the libraries or remove the argument, then try again.")
|
||||||
"--disable-avdevice"
|
else()
|
||||||
"--disable-swresample"
|
|
||||||
"--disable-postproc"
|
message(STATUS "-- Warning! Your version of ffmpeg may be too high! If you want to use the system ffmpeg, clear your cmake cache and do not include the system ffmpeg argument.")
|
||||||
"--disable-avfilter"
|
set(HAS_FFMPEG TRUE)
|
||||||
"--disable-shared"
|
endif()
|
||||||
"--enable-static"
|
else()
|
||||||
)
|
|
||||||
if(WITH_GPL_LIBS)
|
|
||||||
list(APPEND FFMPEG_CONFIGURE
|
list(APPEND FFMPEG_CONFIGURE
|
||||||
"--enable-gpl"
|
"${SM_EXTERN_DIR}/ffmpeg-linux/src/ffmpeg/configure"
|
||||||
|
"--disable-programs"
|
||||||
|
"--disable-doc"
|
||||||
|
"--disable-avdevice"
|
||||||
|
"--disable-swresample"
|
||||||
|
"--disable-postproc"
|
||||||
|
"--disable-avfilter"
|
||||||
|
"--disable-shared"
|
||||||
|
"--enable-static"
|
||||||
)
|
)
|
||||||
|
if(WITH_GPL_LIBS)
|
||||||
|
list(APPEND FFMPEG_CONFIGURE
|
||||||
|
"--enable-gpl"
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
# NEVER use the system ffmpeg. Not worth the hassle.
|
||||||
|
# --shlibdir=$our_installdir/stepmania-$VERSION
|
||||||
|
externalproject_add("ffmpeg"
|
||||||
|
DOWNLOAD_DIR "${SM_EXTERN_DIR}/ffmpeg-linux"
|
||||||
|
PREFIX "${SM_EXTERN_DIR}/ffmpeg-linux"
|
||||||
|
GIT_REPOSITORY "git://source.ffmpeg.org/ffmpeg.git"
|
||||||
|
GIT_TAG "n2.1.3"
|
||||||
|
CONFIGURE_COMMAND ${FFMPEG_CONFIGURE}
|
||||||
|
BUILD_COMMAND "make"
|
||||||
|
UPDATE_COMMAND ""
|
||||||
|
INSTALL_COMMAND ""
|
||||||
|
TEST_COMMAND ""
|
||||||
|
)
|
||||||
|
set(HAS_FFMPEG TRUE)
|
||||||
endif()
|
endif()
|
||||||
# NEVER use the system ffmpeg. Not worth the hassle.
|
|
||||||
# --shlibdir=$our_installdir/stepmania-$VERSION
|
|
||||||
externalproject_add("ffmpeg"
|
|
||||||
DOWNLOAD_DIR "${SM_EXTERN_DIR}/ffmpeg-linux"
|
|
||||||
PREFIX "${SM_EXTERN_DIR}/ffmpeg-linux"
|
|
||||||
GIT_REPOSITORY "git://source.ffmpeg.org/ffmpeg.git"
|
|
||||||
GIT_TAG "n2.1.3"
|
|
||||||
CONFIGURE_COMMAND ${FFMPEG_CONFIGURE}
|
|
||||||
BUILD_COMMAND "make"
|
|
||||||
UPDATE_COMMAND ""
|
|
||||||
INSTALL_COMMAND ""
|
|
||||||
TEST_COMMAND ""
|
|
||||||
)
|
|
||||||
set(HAS_FFMPEG TRUE)
|
|
||||||
else()
|
else()
|
||||||
set(HAS_FFMPEG FALSE)
|
set(HAS_FFMPEG FALSE)
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
+27
-9
@@ -383,11 +383,25 @@ elseif(APPLE)
|
|||||||
)
|
)
|
||||||
else() # Unix / Linux
|
else() # Unix / Linux
|
||||||
# TODO: Remember to find and locate the zip archive files.
|
# TODO: Remember to find and locate the zip archive files.
|
||||||
|
if (HAS_FFMPEG)
|
||||||
|
if(WITH_SYSTEM_FFMPEG)
|
||||||
|
list(APPEND SMDATA_LINK_LIB
|
||||||
|
"${FFMPEG_avformat_LIBRARY}"
|
||||||
|
"${FFMPEG_avcodec_LIBRARY}"
|
||||||
|
"${FFMPEG_swscale_LIBRARY}"
|
||||||
|
"${FFMPEG_avutil_LIBRARY}"
|
||||||
|
)
|
||||||
|
else()
|
||||||
|
list(APPEND SMDATA_LINK_LIB
|
||||||
|
"${SM_EXTERN_DIR}/ffmpeg-linux/src/ffmpeg-build/libavformat/libavformat.a"
|
||||||
|
"${SM_EXTERN_DIR}/ffmpeg-linux/src/ffmpeg-build/libavcodec/libavcodec.a"
|
||||||
|
"${SM_EXTERN_DIR}/ffmpeg-linux/src/ffmpeg-build/libswscale/libswscale.a"
|
||||||
|
"${SM_EXTERN_DIR}/ffmpeg-linux/src/ffmpeg-build/libavutil/libavutil.a"
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
list(APPEND SMDATA_LINK_LIB
|
list(APPEND SMDATA_LINK_LIB
|
||||||
"${SM_EXTERN_DIR}/ffmpeg-linux/src/ffmpeg-build/libavformat/libavformat.a"
|
|
||||||
"${SM_EXTERN_DIR}/ffmpeg-linux/src/ffmpeg-build/libavcodec/libavcodec.a"
|
|
||||||
"${SM_EXTERN_DIR}/ffmpeg-linux/src/ffmpeg-build/libswscale/libswscale.a"
|
|
||||||
"${SM_EXTERN_DIR}/ffmpeg-linux/src/ffmpeg-build/libavutil/libavutil.a"
|
|
||||||
"${DL_LIBRARY}"
|
"${DL_LIBRARY}"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -476,11 +490,15 @@ if(NOT APPLE)
|
|||||||
)
|
)
|
||||||
else()
|
else()
|
||||||
if (HAS_FFMPEG)
|
if (HAS_FFMPEG)
|
||||||
add_dependencies("${SM_EXE_NAME}" "ffmpeg")
|
if (WITH_SYSTEM_FFMPEG)
|
||||||
list(APPEND SM_INCLUDE_DIRS
|
list(APPEND SM_INCLUDE_DIRS "${FFMPEG_INCLUDE_DIR}")
|
||||||
"${SM_EXTERN_DIR}/ffmpeg-linux/src/ffmpeg"
|
else()
|
||||||
"${SM_EXTERN_DIR}/ffmpeg-linux/src/ffmpeg-build"
|
add_dependencies("${SM_EXE_NAME}" "ffmpeg")
|
||||||
)
|
list(APPEND SM_INCLUDE_DIRS
|
||||||
|
"${SM_EXTERN_DIR}/ffmpeg-linux/src/ffmpeg"
|
||||||
|
"${SM_EXTERN_DIR}/ffmpeg-linux/src/ffmpeg-build"
|
||||||
|
)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
if (HAS_GTK2)
|
if (HAS_GTK2)
|
||||||
list(APPEND SM_INCLUDE_DIRS "${GTK2_INCLUDE_DIRS}")
|
list(APPEND SM_INCLUDE_DIRS "${GTK2_INCLUDE_DIRS}")
|
||||||
|
|||||||
Reference in New Issue
Block a user