Commit b8aa8354 authored by Ghislain MARY's avatar Ghislain MARY

Improve ffmpeg search when building with CMake.

parent 30e439a0
......@@ -70,6 +70,9 @@ else()
)
endif()
find_package(Threads)
find_library(LIBM names m)
set(FFMPEG_INCLUDE_DIRS ${LIBAVCODEC_INCLUDE_DIRS} ${LIBAVUTIL_INCLUDE_DIRS} ${LIBSWSCALE_INCLUDE_DIRS})
if(NOT ANDROID)
set(FFMPEG_LIBRARIES ${LIBAVCODEC_LIBRARIES} ${LIBAVUTIL_LIBRARIES} ${LIBSWSCALE_LIBRARIES})
......@@ -80,13 +83,13 @@ list(REMOVE_DUPLICATES FFMPEG_LIBRARIES)
if(FFMPEG_LIBRARIES)
cmake_push_check_state(RESET)
list(APPEND CMAKE_REQUIRED_INCLUDES ${FFMPEG_INCLUDE_DIRS})
list(APPEND CMAKE_REQUIRED_LIBRARIES ${FFMPEG_LIBRARIES})
if(ANDROID)
list(APPEND CMAKE_REQUIRED_LIBRARIES m)
endif()
list(APPEND CMAKE_REQUIRED_LIBRARIES ${FFMPEG_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
if(MSVC)
list(APPEND CMAKE_REQUIRED_DEFINITIONS -Dinline=__inline)
endif()
if(LIBM)
list(APPEND CMAKE_REQUIRED_LIBRARIES ${LIBM})
endif()
check_symbol_exists(avcodec_get_context_defaults3 "libavcodec/avcodec.h" HAVE_FUN_avcodec_get_context_defaults3)
check_symbol_exists(avcodec_open2 "libavcodec/avcodec.h" HAVE_FUN_avcodec_open2)
check_symbol_exists(avcodec_encode_video2 "libavcodec/avcodec.h" HAVE_FUN_avcodec_encode_video2)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment