~ubuntu-branches/debian/stretch/acoustid-fingerprinter/stretch

« back to all changes in this revision

Viewing changes to .pc/03-pkg-config.patch/cmake/modules/FindFFmpeg.cmake

  • Committer: Package Import Robot
  • Author(s): Jerome Charaoui
  • Date: 2014-08-26 20:30:49 UTC
  • mfrom: (7.1.1 sid)
  • Revision ID: package-import@ubuntu.com-20140826203049-qg3pn0syyg01udl3
Tags: 0.6-4
Make package FFmpeg-friendly (Closes: #758323)
Patch provided by Andreas Cadhalpun.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Locate ffmpeg
 
2
# This module defines
 
3
# FFMPEG_LIBRARIES
 
4
# FFMPEG_FOUND, if false, do not try to link to ffmpeg
 
5
# FFMPEG_INCLUDE_DIR, where to find the headers
 
6
#
 
7
# $FFMPEG_DIR is an environment variable that would
 
8
# correspond to the ./configure --prefix=$FFMPEG_DIR
 
9
#
 
10
# Created by Robert Osfield.
 
11
# Modified by Lukas Lalinsky.
 
12
 
 
13
 
 
14
#In ffmpeg code, old version use "#include <header.h>" and newer use "#include <libname/header.h>"
 
15
#In OSG ffmpeg plugin, we use "#include <header.h>" for compatibility with old version of ffmpeg
 
16
 
 
17
#We have to search the path which contain the header.h (usefull for old version)
 
18
#and search the path which contain the libname/header.h (usefull for new version)
 
19
 
 
20
#Then we need to include ${FFMPEG_libname_INCLUDE_DIRS} (in old version case, use by ffmpeg header and osg plugin code)
 
21
#                                                       (in new version case, use by ffmpeg header) 
 
22
#and ${FFMPEG_libname_INCLUDE_DIRS/libname}             (in new version case, use by osg plugin code)
 
23
 
 
24
# Macro to find header and lib directories
 
25
# example: FFMPEG_FIND(AVFORMAT avformat avformat.h)
 
26
MACRO(FFMPEG_FIND varname shortname headername)
 
27
 
 
28
        FIND_PATH(FFMPEG_${varname}_INCLUDE_DIRS lib${shortname}/${headername}
 
29
                PATHS
 
30
                ${FFMPEG_ROOT}/include
 
31
                $ENV{FFMPEG_DIR}/include
 
32
                ~/Library/Frameworks
 
33
                /Library/Frameworks
 
34
                /usr/local/include
 
35
                /usr/include/
 
36
                /sw/include # Fink
 
37
                /opt/local/include # DarwinPorts
 
38
                /opt/csw/include # Blastwave
 
39
                /opt/include
 
40
                /usr/freeware/include
 
41
                NO_DEFAULT_PATH
 
42
                PATH_SUFFIXES ffmpeg
 
43
                DOC "Location of FFMPEG Headers"
 
44
        )
 
45
        FIND_PATH(FFMPEG_${varname}_INCLUDE_DIRS lib${shortname}/${headername}
 
46
                PATH_SUFFIXES ffmpeg
 
47
                DOC "Location of FFMPEG Headers"
 
48
        )
 
49
 
 
50
    FIND_LIBRARY(FFMPEG_${varname}_LIBRARIES
 
51
        NAMES ${shortname}
 
52
        PATHS
 
53
        ${FFMPEG_ROOT}/lib
 
54
        $ENV{FFMPEG_DIR}/lib
 
55
        ~/Library/Frameworks
 
56
        /Library/Frameworks
 
57
        /usr/local/lib
 
58
        /usr/local/lib64
 
59
        /usr/lib
 
60
        /usr/lib64
 
61
        /sw/lib
 
62
        /opt/local/lib
 
63
        /opt/csw/lib
 
64
        /opt/lib
 
65
        /usr/freeware/lib64
 
66
                NO_DEFAULT_PATH
 
67
        DOC "Location of FFMPEG Libraries"
 
68
    )
 
69
    FIND_LIBRARY(FFMPEG_${varname}_LIBRARIES
 
70
        NAMES ${shortname}
 
71
        DOC "Location of FFMPEG Libraries"
 
72
    )
 
73
 
 
74
    IF (FFMPEG_${varname}_LIBRARIES AND FFMPEG_${varname}_INCLUDE_DIRS)
 
75
        SET(FFMPEG_${varname}_FOUND 1)
 
76
    ENDIF(FFMPEG_${varname}_LIBRARIES AND FFMPEG_${varname}_INCLUDE_DIRS)
 
77
 
 
78
ENDMACRO(FFMPEG_FIND)
 
79
 
 
80
SET(FFMPEG_ROOT "$ENV{FFMPEG_DIR}" CACHE PATH "Location of FFMPEG")
 
81
 
 
82
# find stdint.h
 
83
FIND_PATH(FFMPEG_STDINT_INCLUDE_DIR stdint.h
 
84
    PATHS
 
85
    ${FFMPEG_ROOT}/include
 
86
    $ENV{FFMPEG_DIR}/include
 
87
    ~/Library/Frameworks
 
88
    /Library/Frameworks
 
89
    /usr/local/include
 
90
    /usr/include
 
91
    /sw/include # Fink
 
92
    /opt/local/include # DarwinPorts
 
93
    /opt/csw/include # Blastwave
 
94
    /opt/include
 
95
    /usr/freeware/include
 
96
    PATH_SUFFIXES ffmpeg
 
97
    DOC "Location of FFMPEG stdint.h Header"
 
98
)
 
99
 
 
100
FFMPEG_FIND(LIBAVFORMAT avformat avformat.h)
 
101
FFMPEG_FIND(LIBAVDEVICE avdevice avdevice.h)
 
102
FFMPEG_FIND(LIBAVCODEC  avcodec  avcodec.h)
 
103
FFMPEG_FIND(LIBAVCODEC_FFT  avcodec  avfft.h)
 
104
FFMPEG_FIND(LIBAVUTIL   avutil   avutil.h)
 
105
FFMPEG_FIND(LIBSWSCALE  swscale  swscale.h)  # not sure about the header to look for here.
 
106
 
 
107
SET(FFMPEG_FOUND "NO")
 
108
# Note we don't check FFMPEG_LIBSWSCALE_FOUND here, it's optional.
 
109
IF   (FFMPEG_LIBAVFORMAT_FOUND AND FFMPEG_LIBAVDEVICE_FOUND AND FFMPEG_LIBAVCODEC_FOUND AND FFMPEG_LIBAVUTIL_FOUND AND FFMPEG_STDINT_INCLUDE_DIR)
 
110
 
 
111
    SET(FFMPEG_FOUND "YES")
 
112
 
 
113
    SET(FFMPEG_INCLUDE_DIRS ${FFMPEG_LIBAVFORMAT_INCLUDE_DIRS})
 
114
 
 
115
    SET(FFMPEG_LIBRARY_DIRS ${FFMPEG_LIBAVFORMAT_LIBRARY_DIRS})
 
116
 
 
117
    # Note we don't add FFMPEG_LIBSWSCALE_LIBRARIES here, it will be added if found later.
 
118
    SET(FFMPEG_LIBRARIES
 
119
        ${FFMPEG_LIBAVFORMAT_LIBRARIES}
 
120
        ${FFMPEG_LIBAVDEVICE_LIBRARIES}
 
121
        ${FFMPEG_LIBAVCODEC_LIBRARIES}
 
122
        ${FFMPEG_LIBAVUTIL_LIBRARIES})
 
123
 
 
124
ELSE ()
 
125
 
 
126
#    MESSAGE(STATUS "Could not find FFMPEG")
 
127
 
 
128
ENDIF()