cmake_modules/FindFFMPEG.cmake
changeset 7816 a25e943dd4b0
parent 7617 0ac281e1b58b
child 8279 c03d64969112
equal deleted inserted replaced
7815:1a3a62b0ac11 7816:a25e943dd4b0
    29     pkg_check_modules(_FFMPEG_AVUTIL libavutil)
    29     pkg_check_modules(_FFMPEG_AVUTIL libavutil)
    30   endif (PKG_CONFIG_FOUND)
    30   endif (PKG_CONFIG_FOUND)
    31 
    31 
    32   find_path(FFMPEG_AVCODEC_INCLUDE_DIR
    32   find_path(FFMPEG_AVCODEC_INCLUDE_DIR
    33     NAMES libavcodec/avcodec.h
    33     NAMES libavcodec/avcodec.h
    34     PATHS ${_FFMPEG_AVCODEC_INCLUDE_DIRS} /usr/include /usr/local/include /opt/local/include /sw/include
    34     PATHS ${_FFMPEG_AVCODEC_INCLUDE_DIRS}
       
    35         /usr/include /usr/local/include #system level
       
    36         /opt/local/include #macports
       
    37         /sw/include #fink
    35     PATH_SUFFIXES ffmpeg libav
    38     PATH_SUFFIXES ffmpeg libav
    36   )
    39   )
    37 
    40 
    38   find_library(FFMPEG_LIBAVCODEC
    41   find_library(FFMPEG_LIBAVCODEC
    39     NAMES avcodec
    42     NAMES avcodec
    40     PATHS ${_FFMPEG_AVCODEC_LIBRARY_DIRS} /usr/lib /usr/local/lib /opt/local/lib /sw/lib
    43     PATHS ${_FFMPEG_AVCODEC_LIBRARY_DIRS}
       
    44         /usr/lib /usr/local/lib #system level
       
    45         /opt/local/lib #macports
       
    46         /sw/lib #fink
    41   )
    47   )
    42 
    48 
    43   find_library(FFMPEG_LIBAVFORMAT
    49   find_library(FFMPEG_LIBAVFORMAT
    44     NAMES avformat
    50     NAMES avformat
    45     PATHS ${_FFMPEG_AVFORMAT_LIBRARY_DIRS} /usr/lib /usr/local/lib /opt/local/lib /sw/lib
    51     PATHS ${_FFMPEG_AVFORMAT_LIBRARY_DIRS}
       
    52         /usr/lib /usr/local/lib #system level
       
    53         /opt/local/lib #macports
       
    54         /sw/lib #fink
    46   )
    55   )
    47 
    56 
    48   find_library(FFMPEG_LIBAVUTIL
    57   find_library(FFMPEG_LIBAVUTIL
    49     NAMES avutil
    58     NAMES avutil
    50     PATHS ${_FFMPEG_AVUTIL_LIBRARY_DIRS} /usr/lib /usr/local/lib /opt/local/lib /sw/lib
    59     PATHS ${_FFMPEG_AVUTIL_LIBRARY_DIRS}
       
    60         /usr/lib /usr/local/lib #system level
       
    61         /opt/local/lib #macports
       
    62         /sw/lib #fink
    51   )
    63   )
    52 
    64 
    53   if (FFMPEG_LIBAVCODEC AND FFMPEG_LIBAVFORMAT)
    65   if (FFMPEG_LIBAVCODEC AND FFMPEG_LIBAVFORMAT)
    54     set(FFMPEG_FOUND TRUE)
    66     set(FFMPEG_FOUND TRUE)
    55   endif()
    67   endif()
    60     set(FFMPEG_LIBRARIES
    72     set(FFMPEG_LIBRARIES
    61       ${FFMPEG_LIBAVCODEC}
    73       ${FFMPEG_LIBAVCODEC}
    62       ${FFMPEG_LIBAVFORMAT}
    74       ${FFMPEG_LIBAVFORMAT}
    63       ${FFMPEG_LIBAVUTIL}
    75       ${FFMPEG_LIBAVUTIL}
    64     )
    76     )
       
    77     if (APPLE)
       
    78       set(FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} "bz2" "-framework CoreVideo" "-framework VideoDecodeAcceleration")
       
    79     endif(APPLE)
    65 
    80 
    66   endif (FFMPEG_FOUND)
    81   endif (FFMPEG_FOUND)
    67 
    82 
    68   if (FFMPEG_FOUND)
    83   if (FFMPEG_FOUND)
    69     if (NOT FFMPEG_FIND_QUIETLY)
    84     if (NOT FFMPEG_FIND_QUIETLY)
    70       message(STATUS "Found FFMPEG or Libav: ${FFMPEG_LIBRARIES}, ${FFMPEG_INCLUDE_DIR}")
    85       message(STATUS "Found FFMPEG/LibAV: ${FFMPEG_LIBRARIES}, ${FFMPEG_INCLUDE_DIR}")
    71     endif (NOT FFMPEG_FIND_QUIETLY)
    86     endif (NOT FFMPEG_FIND_QUIETLY)
    72   else (FFMPEG_FOUND)
    87   else (FFMPEG_FOUND)
    73     if (FFMPEG_FIND_REQUIRED)
    88     if (FFMPEG_FIND_REQUIRED)
    74       message(FATAL_ERROR "Could not find libavcodec or libavformat or libavutil")
    89       message(FATAL_ERROR "Could NOT find libavcodec or libavformat or libavutil")
    75     endif (FFMPEG_FIND_REQUIRED)
    90     endif (FFMPEG_FIND_REQUIRED)
    76   endif (FFMPEG_FOUND)
    91   endif (FFMPEG_FOUND)
    77 
    92 
    78 endif (FFMPEG_LIBRARIES AND FFMPEG_INCLUDE_DIR)
    93 endif (FFMPEG_LIBRARIES AND FFMPEG_INCLUDE_DIR)
    79 
    94