Changeset 9863 for OpenSceneGraph/trunk/CMakeModules/FindFFmpeg.cmake
- Timestamp:
- 03/04/09 17:16:07 (4 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/CMakeModules/FindFFmpeg.cmake
r9854 r9863 2 2 # This module defines 3 3 # FFMPEG_LIBRARIES 4 # FFMPEG_FOUND, if false, do not try to link to ffmpeg 4 # FFMPEG_FOUND, if false, do not try to link to ffmpeg 5 5 # FFMPEG_INCLUDE_DIR, where to find the headers 6 6 # … … 8 8 # correspond to the ./configure --prefix=$FFMPEG_DIR 9 9 # 10 # Created by Robert Osfield. 10 # Created by Robert Osfield. 11 11 12 #use pkg-config to find various modes 13 INCLUDE(FindPkgConfig OPTIONAL) 12 # Macro to find header and lib directories 13 # example: FFMPEG_FIND(AVFORMAT avformat avformat.h) 14 MACRO(FFMPEG_FIND varname shortname headername) 15 # First try to find header directly in include directory 16 FIND_PATH(FFMPEG_${varname}_INCLUDE_DIRS ${headername} 17 ${FFMPEG_ROOT}/include 18 $ENV{FFMPEG_DIR}/include 19 $ENV{OSGDIR}/include 20 $ENV{OSG_ROOT}/include 21 ~/Library/Frameworks 22 /Library/Frameworks 23 /usr/local/include 24 /usr/include/ 25 /sw/include # Fink 26 /opt/local/include # DarwinPorts 27 /opt/csw/include # Blastwave 28 /opt/include 29 /usr/freeware/include 30 ) 14 31 15 IF(PKG_CONFIG_FOUND) 32 # If not found, try to find it in a subdirectory. Tanguy's build has 33 # avformat.h in include/libavformat, so this catches that case. If that's 34 # standard, perhaps we can keep just this case. 35 IF(NOT FFMPEG_${varname}_INCLUDE_DIRS) 36 FIND_PATH(FFMPEG_${varname}_INCLUDE_DIRS lib${shortname}/${headername} 37 ${FFMPEG_ROOT}/include 38 $ENV{FFMPEG_DIR}/include 39 $ENV{OSGDIR}/include 40 $ENV{OSG_ROOT}/include 41 ~/Library/Frameworks 42 /Library/Frameworks 43 /usr/local/include 44 /usr/include/ 45 /sw/include # Fink 46 /opt/local/include # DarwinPorts 47 /opt/csw/include # Blastwave 48 /opt/include 49 /usr/freeware/include 50 ) 51 ENDIF(NOT FFMPEG_${varname}_INCLUDE_DIRS) 16 52 17 INCLUDE(FindPkgConfig) 53 FIND_LIBRARY(FFMPEG_${varname}_LIBRARIES 54 NAMES ${shortname} 55 PATHS 56 ${FFMPEG_ROOT}/lib 57 $ENV{FFMPEG_DIR}/lib 58 $ENV{OSGDIR}/lib 59 $ENV{OSG_ROOT}/lib 60 ~/Library/Frameworks 61 /Library/Frameworks 62 /usr/local/lib 63 /usr/local/lib64 64 /usr/lib 65 /usr/lib64 66 /sw/lib 67 /opt/local/lib 68 /opt/csw/lib 69 /opt/lib 70 /usr/freeware/lib64 71 ) 18 72 19 pkg_check_modules(FFMPEG_LIBAVFORMAT libavformat) 20 pkg_check_modules(FFMPEG_LIBAVDEVICE libavdevice) 21 pkg_check_modules(FFMPEG_LIBAVCODEC libavcodec) 22 pkg_check_modules(FFMPEG_LIBAVUTIL libavutil) 23 pkg_check_modules(FFMPEG_LIBSWSCALE libswscale) 73 IF (FFMPEG_${varname}_LIBRARIES) 74 SET(FFMPEG_${varname}_FOUND 1) 75 ENDIF(FFMPEG_${varname}_LIBRARIES) 24 76 25 ENDIF(PKG_CONFIG_FOUND) 77 ENDMACRO(FFMPEG_FIND) 78 79 SET(FFMPEG_ROOT "$ENV{FFMPEG_DIR}" CACHE PATH "Location of FFMPEG") 80 81 FFMPEG_FIND(LIBAVFORMAT avformat avformat.h) 82 FFMPEG_FIND(LIBAVDEVICE avdevice avdevice.h) 83 FFMPEG_FIND(LIBAVCODEC avcodec avcodec.h) 84 FFMPEG_FIND(LIBAVUTIL avutil avutil.h) 85 FFMPEG_FIND(LIBSWSCALE swscale swscale.h) # not sure about the header to look for here. 26 86 27 87 SET(FFMPEG_FOUND "NO") 88 # Note we don't check FFMPEG_LIBSWSCALE_FOUND here, it's optional. 28 89 IF (FFMPEG_LIBAVFORMAT_FOUND AND FFMPEG_LIBAVDEVICE_FOUND AND FFMPEG_LIBAVCODEC_FOUND AND FFMPEG_LIBAVUTIL_FOUND) 29 90 30 91 SET(FFMPEG_FOUND "YES") 31 92 … … 34 95 SET(FFMPEG_LIBRARY_DIRS ${FFMPEG_LIBAVFORMAT_LIBRARY_DIRS}) 35 96 97 # Note we don't add FFMPEG_LIBSWSCALE_LIBRARIES here, it will be added if found later. 36 98 SET(FFMPEG_LIBRARIES 37 99 ${FFMPEG_LIBAVFORMAT_LIBRARIES} … … 39 101 ${FFMPEG_LIBAVCODEC_LIBRARIES} 40 102 ${FFMPEG_LIBAVUTIL_LIBRARIES}) 41 103 104 ELSE (FFMPEG_LIBAVFORMAT_FOUND AND FFMPEG_LIBAVDEVICE_FOUND AND FFMPEG_LIBAVCODEC_FOUND AND FFMPEG_LIBAVUTIL_FOUND) 105 106 MESSAGE(STATUS "Could not find FFMPEG") 107 42 108 ENDIF(FFMPEG_LIBAVFORMAT_FOUND AND FFMPEG_LIBAVDEVICE_FOUND AND FFMPEG_LIBAVCODEC_FOUND AND FFMPEG_LIBAVUTIL_FOUND) 43 44
