123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150 |
- include(FindPackageHandleStandardArgs)
- if (NOT FFmpeg_FIND_COMPONENTS)
- set(FFmpeg_FIND_COMPONENTS AVCODEC AVFORMAT AVUTIL)
- endif ()
- macro(set_component_found _component )
- if (${_component}_LIBRARIES AND ${_component}_INCLUDE_DIRS)
-
- set(${_component}_FOUND TRUE)
- else ()
-
- endif ()
- endmacro()
- macro(find_component _component _pkgconfig _library _header)
- if (NOT WIN32)
-
-
- find_package(PkgConfig)
- if (PKG_CONFIG_FOUND)
- pkg_check_modules(PC_${_component} ${_pkgconfig})
- endif ()
- endif (NOT WIN32)
- find_path(${_component}_INCLUDE_DIRS ${_header}
- HINTS
- ${FFMPEG_ROOT}
- ${PC_LIB${_component}_INCLUDEDIR}
- ${PC_LIB${_component}_INCLUDE_DIRS}
- PATH_SUFFIXES
- ffmpeg
- )
- find_library(${_component}_LIBRARIES NAMES ${_library}
- HINTS
- ${FFMPEG_ROOT}
- ${PC_LIB${_component}_LIBDIR}
- ${PC_LIB${_component}_LIBRARY_DIRS}
- )
- set(${_component}_DEFINITIONS ${PC_${_component}_CFLAGS_OTHER} CACHE STRING "The ${_component} CFLAGS.")
- set(${_component}_VERSION ${PC_${_component}_VERSION} CACHE STRING "The ${_component} version number.")
- set_component_found(${_component})
- mark_as_advanced(
- ${_component}_INCLUDE_DIRS
- ${_component}_LIBRARIES
- ${_component}_DEFINITIONS
- ${_component}_VERSION)
- endmacro()
- if (NOT FFMPEG_LIBRARIES)
-
- find_component(AVCODEC libavcodec avcodec libavcodec/avcodec.h)
- find_component(AVFORMAT libavformat avformat libavformat/avformat.h)
- find_component(AVDEVICE libavdevice avdevice libavdevice/avdevice.h)
- find_component(AVUTIL libavutil avutil libavutil/avutil.h)
- find_component(SWSCALE libswscale swscale libswscale/swscale.h)
- find_component(POSTPROC libpostproc postproc libpostproc/postprocess.h)
-
- foreach (_component ${FFmpeg_FIND_COMPONENTS})
- if (${_component}_FOUND)
-
- set(FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} ${${_component}_LIBRARIES})
- set(FFMPEG_DEFINITIONS ${FFMPEG_DEFINITIONS} ${${_component}_DEFINITIONS})
- list(APPEND FFMPEG_INCLUDE_DIRS ${${_component}_INCLUDE_DIRS})
- else ()
-
- endif ()
- endforeach ()
-
- if (FFMPEG_INCLUDE_DIRS)
- list(REMOVE_DUPLICATES FFMPEG_INCLUDE_DIRS)
- endif ()
-
- set(FFMPEG_INCLUDE_DIRS ${FFMPEG_INCLUDE_DIRS} CACHE STRING "The FFmpeg include directories." FORCE)
- set(FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} CACHE STRING "The FFmpeg libraries." FORCE)
- set(FFMPEG_DEFINITIONS ${FFMPEG_DEFINITIONS} CACHE STRING "The FFmpeg cflags." FORCE)
- mark_as_advanced(FFMPEG_INCLUDE_DIRS
- FFMPEG_LIBRARIES
- FFMPEG_DEFINITIONS)
- endif ()
- foreach (_component AVCODEC AVDEVICE AVFORMAT AVUTIL POSTPROCESS SWSCALE)
- set_component_found(${_component})
- endforeach ()
- set(_FFmpeg_REQUIRED_VARS FFMPEG_LIBRARIES FFMPEG_INCLUDE_DIRS)
- foreach (_component ${FFmpeg_FIND_COMPONENTS})
- list(APPEND _FFmpeg_REQUIRED_VARS ${_component}_LIBRARIES ${_component}_INCLUDE_DIRS)
- endforeach ()
- find_package_handle_standard_args(FFmpeg DEFAULT_MSG ${_FFmpeg_REQUIRED_VARS})
|