Changeset 9948

Show
Ignore:
Timestamp:
03/23/09 16:48:19 (6 years ago)
Author:
robert
Message:

From David Callu, clean up of FindFFmpeg include paths

Location:
OpenSceneGraph/trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • OpenSceneGraph/trunk/CMakeModules/FindFFmpeg.cmake

    r9866 r9948  
    1010# Created by Robert Osfield. 
    1111 
     12 
     13#In ffmpeg code, old version use "#include <header.h>" and newer use "#include <libname/header.h>" 
     14#In OSG ffmpeg plugin, we use "#include <header.h>" for compatibility with old version of ffmpeg 
     15 
     16#We have to search the path which contain the header.h (usefull for old version) 
     17#and search the path which contain the libname/header.h (usefull for new version) 
     18 
     19#Then we need to include ${FFMPEG_libname_INCLUDE_DIRS} (in old version case, use by ffmpeg header and osg plugin code) 
     20#                                                       (in new version case, use by ffmpeg header)  
     21#and ${FFMPEG_libname_INCLUDE_DIRS/libname}             (in new version case, use by osg plugin code) 
     22 
     23 
    1224# Macro to find header and lib directories 
    1325# example: FFMPEG_FIND(AVFORMAT avformat avformat.h) 
    14  
    1526MACRO(FFMPEG_FIND varname shortname headername) 
    16     # First try to find header directly in include directory 
     27    # old version of ffmpeg put header in $prefix/include/[ffmpeg] 
     28    # so try to find header in include directory 
    1729    FIND_PATH(FFMPEG_${varname}_INCLUDE_DIRS ${headername} 
     30        PATHS 
    1831        ${FFMPEG_ROOT}/include 
    1932        $ENV{FFMPEG_DIR}/include 
     
    2336        /Library/Frameworks 
    2437        /usr/local/include 
    25         /usr/include/ 
     38        /usr/include 
    2639        /sw/include # Fink 
    2740        /opt/local/include # DarwinPorts 
     
    2942        /opt/include 
    3043        /usr/freeware/include 
     44        PATH_SUFFIXES ffmpeg 
     45        DOC "Location of FFMPEG Headers" 
    3146    ) 
    3247 
    33     # If not found, try to find it in a subdirectory. Tanguy's build has 
    34     # avformat.h in include/libavformat, so this catches that case. If that's 
    35     # standard, perhaps we can keep just this case. 
     48    # newer version of ffmpeg put header in $prefix/include/[ffmpeg/]lib${shortname} 
     49    # so try to find lib${shortname}/header in include directory 
    3650    IF(NOT FFMPEG_${varname}_INCLUDE_DIRS) 
    3751        FIND_PATH(FFMPEG_${varname}_INCLUDE_DIRS lib${shortname}/${headername} 
     
    4963            /opt/include 
    5064            /usr/freeware/include 
    51         ) 
    52     ENDIF(NOT FFMPEG_${varname}_INCLUDE_DIRS) 
    53  
    54  
    55     # If not found, try to find it in a subdirectory. Tanguy's build has 
    56     # avformat.h in include/libavformat, so this catches that case. If that's 
    57     # standard, perhaps we can keep just this case. 
    58     IF(NOT FFMPEG_${varname}_INCLUDE_DIRS) 
    59         FIND_PATH(FFMPEG_${varname}_INCLUDE_DIRS ffmpeg/${headername} 
    60             ${FFMPEG_ROOT}/include 
    61             $ENV{FFMPEG_DIR}/include 
    62             $ENV{OSGDIR}/include 
    63             $ENV{OSG_ROOT}/include 
    64             ~/Library/Frameworks 
    65             /Library/Frameworks 
    66             /usr/local/include 
    67             /usr/include/ 
    68             /sw/include # Fink 
    69             /opt/local/include # DarwinPorts 
    70             /opt/csw/include # Blastwave 
    71             /opt/include 
    72             /usr/freeware/include 
     65            PATH_SUFFIXES ffmpeg 
     66            DOC "Location of FFMPEG Headers" 
    7367        ) 
    7468    ENDIF(NOT FFMPEG_${varname}_INCLUDE_DIRS) 
     
    9286        /opt/lib 
    9387        /usr/freeware/lib64 
     88        DOC "Location of FFMPEG Libraries" 
    9489    ) 
    9590 
    96     IF   (FFMPEG_${varname}_LIBRARIES AND FFMPEG_${varname}_INCLUDE_DIRS) 
     91    IF (FFMPEG_${varname}_LIBRARIES AND FFMPEG_${varname}_INCLUDE_DIRS) 
    9792        SET(FFMPEG_${varname}_FOUND 1) 
    9893    ENDIF(FFMPEG_${varname}_LIBRARIES AND FFMPEG_${varname}_INCLUDE_DIRS) 
  • OpenSceneGraph/trunk/src/osgPlugins/ffmpeg/CMakeLists.txt

    r9854 r9948  
    11# INCLUDE_DIRECTORIES( ${FFMPEG_INCLUDE_DIRS} ) 
     2 
     3 
     4INCLUDE_DIRECTORIES(  
     5    ${FFMPEG_LIBAVFORMAT_INCLUDE_DIRS} ${FFMPEG_LIBAVFORMAT_INCLUDE_DIRS}/libavformat 
     6    ${FFMPEG_LIBAVDEVICE_INCLUDE_DIRS} ${FFMPEG_LIBAVDEVICE_INCLUDE_DIRS}/libavdevice 
     7    ${FFMPEG_LIBAVCODEC_INCLUDE_DIRS} ${FFMPEG_LIBAVCODEC_INCLUDE_DIRS}/libavcodec 
     8    ${FFMPEG_LIBAVUTIL_INCLUDE_DIRS} ${FFMPEG_LIBAVUTIL_INCLUDE_DIRS}/libavcodec 
     9) 
     10 
     11LINK_DIRECTORIES(${FFMPEG_LIBRARY_DIRS}) 
     12 
     13SET(TARGET_EXTERNAL_LIBRARIES ${FFMPEG_LIBRARIES} ) 
     14 
     15 
    216 
    317IF (FFMPEG_LIBSWSCALE_FOUND) 
    418 
    5     INCLUDE_DIRECTORIES(  
    6         ${FFMPEG_LIBAVFORMAT_INCLUDE_DIRS} ${FFMPEG_LIBAVFORMAT_INCLUDE_DIRS}/libavformat ${FFMPEG_LIBAVFORMAT_INCLUDE_DIRS}/ffmpeg 
    7         ${FFMPEG_LIBAVDEVICE_INCLUDE_DIRS} ${FFMPEG_LIBAVDEVICE_INCLUDE_DIRS}/libavdevice ${FFMPEG_LIBAVDEVICE_INCLUDE_DIRS}/ffmpeg 
    8         ${FFMPEG_LIBAVCODEC_INCLUDE_DIRS} ${FFMPEG_LIBAVCODEC_INCLUDE_DIRS}/libavcodec ${FFMPEG_LIBAVCODEC_INCLUDE_DIRS}/ffmpeg 
    9         ${FFMPEG_LIBAVUTIL_INCLUDE_DIRS} ${FFMPEG_LIBAVUTIL_INCLUDE_DIRS}/libavcodec ${FFMPEG_LIBAVUTIL_INCLUDE_DIRS}/ffmpeg 
    10         ${FFMPEG_LIBSWSCALE_INCLUDE_DIRS} ${FFMPEG_LIBSWSCALE_INCLUDE_DIRS}/libswscale ${FFMPEG_LIBSWSCALE_INCLUDE_DIRS}/ffmpeg 
    11     ) 
     19    INCLUDE_DIRECTORIES( ${FFMPEG_LIBSWSCALE_INCLUDE_DIRS} ${FFMPEG_LIBSWSCALE_INCLUDE_DIRS}/libswscale ) 
    1220 
    1321    ADD_DEFINITIONS(-DUSE_SWSCALE) 
    1422 
    15     LINK_DIRECTORIES(${FFMPEG_LIBRARY_DIRS}) 
    16  
    1723    SET(TARGET_EXTERNAL_LIBRARIES ${FFMPEG_LIBRARIES} ${FFMPEG_LIBSWSCALE_LIBRARIES}) 
    18  
    19 ELSE(FFMPEG_LIBSWSCALE_FOUND) 
    20  
    21     INCLUDE_DIRECTORIES(  
    22         ${FFMPEG_LIBAVFORMAT_INCLUDE_DIRS} ${FFMPEG_LIBAVFORMAT_INCLUDE_DIRS}/libavformat ${FFMPEG_LIBAVFORMAT_INCLUDE_DIRS}/ffmpeg 
    23         ${FFMPEG_LIBAVDEVICE_INCLUDE_DIRS} ${FFMPEG_LIBAVDEVICE_INCLUDE_DIRS}/libavdevice ${FFMPEG_LIBAVDEVICE_INCLUDE_DIRS}/ffmpeg 
    24         ${FFMPEG_LIBAVCODEC_INCLUDE_DIRS} ${FFMPEG_LIBAVCODEC_INCLUDE_DIRS}/libavcodec ${FFMPEG_LIBAVCODEC_INCLUDE_DIRS}/ffmpeg 
    25         ${FFMPEG_LIBAVUTIL_INCLUDE_DIRS} ${FFMPEG_LIBAVUTIL_INCLUDE_DIRS}/libavcodec ${FFMPEG_LIBAVUTIL_INCLUDE_DIRS}/ffmpeg 
    26     ) 
    27  
    28     LINK_DIRECTORIES(${FFMPEG_LIBRARY_DIRS}) 
    29  
    30     SET(TARGET_EXTERNAL_LIBRARIES ${FFMPEG_LIBRARIES} ) 
    3124 
    3225ENDIF()