cmake: check for ffmpeg >= 4.0.4

Check for the specific `ffmpeg` lib versions in `ffmpeg` `4.0.4` "Wu",

Do not pass `-DENABLE_FFMPEG=OFF` to the xenial travis job, as this is
detected automatically now.

Add a note about the required ffmpeg version to `README.md`.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
This commit is contained in:
Rafael Kitover 2019-09-01 20:37:39 +00:00
parent 0b9c771027
commit 8b3470507d
No known key found for this signature in database
GPG Key ID: 08AB596679D86240
3 changed files with 10 additions and 7 deletions

View File

@ -32,8 +32,7 @@ matrix:
script:
- mkdir build
- cd build
# ffmpeg currently broken on xenial
- cmake .. -DENABLE_SDL=ON -DENABLE_FFMPEG=OFF
- cmake .. -DENABLE_SDL=ON
- make -j2
# xvfb fails on xenial too
# - xvfb-run ./visualboyadvance-m --help

View File

@ -120,13 +120,17 @@ set(FFMPEG_DEFAULT OFF)
find_package(PkgConfig)
set(FFMPEG_LIBS_LIST libavcodec>=58.18.100 libavformat>=58.12.100 libswscale>=5.1.100 libavutil>=56.14.100 libswresample>=3.1.100)
if(PKGCONFIG_FOUND)
set(FFMPEG_DEFAULT ON)
foreach(ffmpeg_lib libavcodec libavformat libswscale libavutil libswresample)
pkg_check_modules(FFMPEG_LIB_${ffmpeg_lib} ${ffmpeg_lib} QUIET)
foreach(ffmpeg_lib ${FFMPEG_LIBS_LIST})
string(REGEX REPLACE ">=.*" "" ffmpeg_lib_name ${ffmpeg_lib})
if(NOT FFMPEG_LIB_${ffmpeg_lib}_FOUND)
pkg_check_modules(FFMPEG_LIB_${ffmpeg_lib_name} ${ffmpeg_lib} QUIET)
if(NOT FFMPEG_LIB_${ffmpeg_lib_name}_FOUND)
set(FFMPEG_DEFAULT OFF)
break()
endif()
@ -290,7 +294,7 @@ set(
if(ENABLE_FFMPEG)
find_package(PkgConfig REQUIRED)
pkg_check_modules(FFMPEG REQUIRED libavcodec libavformat libswscale libavutil libswresample)
pkg_check_modules(FFMPEG REQUIRED ${FFMPEG_LIBS_LIST})
if(FFMPEG_STATIC)
set(FFMPEG_LIBRARIES ${FFMPEG_STATIC_LIBRARIES})

View File

@ -111,7 +111,7 @@ And the following development libraries:
- [zlib](https://zlib.net/) (required)
- [mesa](https://mesa3d.org/) (if using X11 or any OpenGL otherwise)
- [ffmpeg](https://ffmpeg.org/) (optional, for game recording)
- [ffmpeg](https://ffmpeg.org/) (optional, at least version `4.0.4`, for game recording)
- [gettext](https://www.gnu.org/software/gettext/) and gettext-tools (optional, with ENABLE_NLS)
- [libpng](http://www.libpng.org/pub/png/libpng.html) (required)
- [SDL2](https://www.libsdl.org/) (required)