2010-12-09 19:00:05 -07:00
|
|
|
include(FindPkgConfig OPTIONAL)
|
|
|
|
|
2010-12-12 22:29:13 -07:00
|
|
|
macro(_internal_message msg)
|
|
|
|
if(NOT ${_is_quiet})
|
2010-12-09 19:00:05 -07:00
|
|
|
message("${msg}")
|
|
|
|
endif()
|
|
|
|
endmacro()
|
|
|
|
|
|
|
|
macro(check_lib var lib)
|
|
|
|
set(_is_required 0)
|
|
|
|
set(_is_quiet 0)
|
2010-12-12 22:29:13 -07:00
|
|
|
set(_arg_list ${ARGN})
|
2010-12-09 19:00:05 -07:00
|
|
|
foreach(_arg ${ARGN})
|
|
|
|
if(_arg STREQUAL "REQUIRED")
|
2010-12-12 22:29:13 -07:00
|
|
|
list(REMOVE_ITEM _arg_list "REQUIRED")
|
2010-12-09 19:00:05 -07:00
|
|
|
set(_is_required 1)
|
|
|
|
endif()
|
|
|
|
if(_arg STREQUAL "QUIET")
|
2010-12-12 22:29:13 -07:00
|
|
|
list(REMOVE_ITEM _arg_list "QUIET")
|
2010-12-09 19:00:05 -07:00
|
|
|
set(_is_quiet 1)
|
|
|
|
endif()
|
|
|
|
endforeach()
|
|
|
|
|
|
|
|
if(PKG_CONFIG_FOUND AND NOT ${var}_FOUND)
|
|
|
|
string(TOLOWER ${lib} lower_lib)
|
|
|
|
pkg_search_module(${var} QUIET ${lower_lib})
|
|
|
|
endif()
|
|
|
|
|
2010-11-11 22:05:27 -07:00
|
|
|
if(${var}_FOUND)
|
2010-12-12 22:29:13 -07:00
|
|
|
include_directories(${${var}_INCLUDE_DIRS})
|
|
|
|
# Make sure include directories for headers found using find_path below
|
|
|
|
# are re-added when reconfiguring
|
|
|
|
include_directories(${${var}_INCLUDE})
|
|
|
|
_internal_message("${lib} found")
|
2010-11-11 22:05:27 -07:00
|
|
|
else()
|
|
|
|
find_library(${var} ${lib})
|
2010-12-14 16:19:34 -07:00
|
|
|
if(_arg_list)
|
|
|
|
find_path(${var}_INCLUDE ${_arg_list})
|
|
|
|
else()
|
|
|
|
set(${var}_INCLUDE FALSE)
|
|
|
|
endif()
|
2010-12-09 19:00:05 -07:00
|
|
|
if(${var} AND ${var}_INCLUDE)
|
2010-12-12 22:29:13 -07:00
|
|
|
include_directories(${${var}_INCLUDE})
|
|
|
|
_internal_message("${lib} found")
|
2010-11-11 22:05:27 -07:00
|
|
|
set(${var}_FOUND 1 CACHE INTERNAL "")
|
|
|
|
else()
|
2010-12-09 19:00:05 -07:00
|
|
|
if(_is_required)
|
2010-11-11 22:05:27 -07:00
|
|
|
message(FATAL_ERROR "${lib} is required but not found")
|
|
|
|
else()
|
2010-12-12 22:29:13 -07:00
|
|
|
_internal_message("${lib} not found")
|
2010-11-11 22:05:27 -07:00
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
endmacro()
|
|
|
|
|
2010-12-09 19:00:05 -07:00
|
|
|
macro(check_libav)
|
|
|
|
if(PKG_CONFIG_FOUND)
|
2012-08-28 21:38:21 -06:00
|
|
|
pkg_check_modules(LIBAV libavcodec>=53.35.0 libavformat>=53.21.0
|
|
|
|
libswscale>=2.1.0 libavutil>=51.22.1)
|
2010-11-18 16:27:27 -07:00
|
|
|
else()
|
2014-06-15 01:20:13 -06:00
|
|
|
message("pkg-config is required to check for libav/ffmpeg")
|
2010-12-09 19:00:05 -07:00
|
|
|
endif()
|
|
|
|
if(LIBAV_FOUND)
|
2014-06-15 01:20:13 -06:00
|
|
|
message("libav/ffmpeg found, enabling AVI frame dumps")
|
2010-12-09 19:00:05 -07:00
|
|
|
add_definitions(-DHAVE_LIBAV)
|
2011-09-13 08:39:28 -06:00
|
|
|
include_directories(${LIBAV_INCLUDE_DIRS})
|
2010-12-09 19:00:05 -07:00
|
|
|
else()
|
2014-06-15 01:20:13 -06:00
|
|
|
message("libav/ffmpeg not found, disabling AVI frame dumps")
|
2010-11-18 16:27:27 -07:00
|
|
|
endif()
|
|
|
|
endmacro()
|
|
|
|
|