cmake_modules/FindFFMPEG.cmake
author Periklis Ntanasis <pntanasis@gmail.com>
Thu, 29 Aug 2013 08:04:10 +0300
branchspacecampaign
changeset 9590 347e799f01de
parent 8662 bfcc09f2accc
child 9419 fa8324ed4702
permissions -rw-r--r--
fruit side mission map and some logic
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
8662
bfcc09f2accc rewritten findffmpeg.cmake
koda
parents: 8285
diff changeset
     1
# Find ffmpeg/libav libraries (libavcodec, libavformat and libavutil)
7528
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
     2
# Once done this will define
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
     3
#
8662
bfcc09f2accc rewritten findffmpeg.cmake
koda
parents: 8285
diff changeset
     4
#  FFMPEG_FOUND             - system has libavcodec, libavformat, libavutil
bfcc09f2accc rewritten findffmpeg.cmake
koda
parents: 8285
diff changeset
     5
#  FFMPEG_INCLUDE_DIR       - the libav include directories
bfcc09f2accc rewritten findffmpeg.cmake
koda
parents: 8285
diff changeset
     6
#  FFMPEG_LIBRARIES         - the libav libraries
bfcc09f2accc rewritten findffmpeg.cmake
koda
parents: 8285
diff changeset
     7
#
bfcc09f2accc rewritten findffmpeg.cmake
koda
parents: 8285
diff changeset
     8
#  LIBAVCODEC_LIBRARY      - the libavcodec library
bfcc09f2accc rewritten findffmpeg.cmake
koda
parents: 8285
diff changeset
     9
#  LIBAVCODEC_INCLUDE_DIR  - the libavcodec include directory
bfcc09f2accc rewritten findffmpeg.cmake
koda
parents: 8285
diff changeset
    10
#  LIBAVFORMAT_LIBRARY     - the libavformat library
bfcc09f2accc rewritten findffmpeg.cmake
koda
parents: 8285
diff changeset
    11
#  LIBAVUTIL_LIBRARY       - the libavutil library
7528
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    12
#
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    13
#  Copyright (c) 2008 Andreas Schneider <mail@cynapses.org>
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    14
#  Modified for other libraries by Lasse Kärkkäinen <tronic>
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    15
#  Modified for Hedgewars by Stepik777
8662
bfcc09f2accc rewritten findffmpeg.cmake
koda
parents: 8285
diff changeset
    16
#  Copyright (c) 2013 Vittorio Giovara <vittorio.giovara@gmail.com>
7528
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    17
#
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    18
#  Redistribution and use is allowed according to the terms of the New
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    19
#  BSD license.
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    20
#
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    21
8662
bfcc09f2accc rewritten findffmpeg.cmake
koda
parents: 8285
diff changeset
    22
include(FindPackageHandleStandardArgs)
bfcc09f2accc rewritten findffmpeg.cmake
koda
parents: 8285
diff changeset
    23
8285
a1500ffdc343 cmake set variable and typo
koda
parents: 8283
diff changeset
    24
8662
bfcc09f2accc rewritten findffmpeg.cmake
koda
parents: 8285
diff changeset
    25
# use pkg-config to get the directories and then use these values
bfcc09f2accc rewritten findffmpeg.cmake
koda
parents: 8285
diff changeset
    26
# in the FIND_PATH() and FIND_LIBRARY() calls
bfcc09f2accc rewritten findffmpeg.cmake
koda
parents: 8285
diff changeset
    27
find_package(PkgConfig)
bfcc09f2accc rewritten findffmpeg.cmake
koda
parents: 8285
diff changeset
    28
if (PKG_CONFIG_FOUND)
8283
af97cdbb7713 cmake verbosity/documentation/cleanup/formatting
koda
parents: 8279
diff changeset
    29
    pkg_check_modules(_FFMPEG_AVCODEC libavcodec ${VERBOSITY})
af97cdbb7713 cmake verbosity/documentation/cleanup/formatting
koda
parents: 8279
diff changeset
    30
    pkg_check_modules(_FFMPEG_AVFORMAT libavformat ${VERBOSITY})
af97cdbb7713 cmake verbosity/documentation/cleanup/formatting
koda
parents: 8279
diff changeset
    31
    pkg_check_modules(_FFMPEG_AVUTIL libavutil ${VERBOSITY})
8662
bfcc09f2accc rewritten findffmpeg.cmake
koda
parents: 8285
diff changeset
    32
endif (PKG_CONFIG_FOUND)
7528
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    33
8662
bfcc09f2accc rewritten findffmpeg.cmake
koda
parents: 8285
diff changeset
    34
find_path(LIBAVCODEC_INCLUDE_DIR
7534
ccb9c2906160 fix FindFFMPEG
Stepan777 <stepik-777@mail.ru>
parents: 7528
diff changeset
    35
    NAMES libavcodec/avcodec.h
8662
bfcc09f2accc rewritten findffmpeg.cmake
koda
parents: 8285
diff changeset
    36
    PATHS ${_AVCODEC_INCLUDE_DIRS}
7816
a25e943dd4b0 finally videorec on osx
koda
parents: 7617
diff changeset
    37
        /usr/include /usr/local/include #system level
a25e943dd4b0 finally videorec on osx
koda
parents: 7617
diff changeset
    38
        /opt/local/include #macports
a25e943dd4b0 finally videorec on osx
koda
parents: 7617
diff changeset
    39
        /sw/include #fink
8662
bfcc09f2accc rewritten findffmpeg.cmake
koda
parents: 8285
diff changeset
    40
    PATH_SUFFIXES libav ffmpeg
bfcc09f2accc rewritten findffmpeg.cmake
koda
parents: 8285
diff changeset
    41
)
7528
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    42
8662
bfcc09f2accc rewritten findffmpeg.cmake
koda
parents: 8285
diff changeset
    43
#TODO: add other include paths
bfcc09f2accc rewritten findffmpeg.cmake
koda
parents: 8285
diff changeset
    44
bfcc09f2accc rewritten findffmpeg.cmake
koda
parents: 8285
diff changeset
    45
find_library(LIBAVCODEC_LIBRARY
7528
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    46
    NAMES avcodec
8662
bfcc09f2accc rewritten findffmpeg.cmake
koda
parents: 8285
diff changeset
    47
    PATHS ${_AVCODEC_LIBRARY_DIRS}
7816
a25e943dd4b0 finally videorec on osx
koda
parents: 7617
diff changeset
    48
        /usr/lib /usr/local/lib #system level
a25e943dd4b0 finally videorec on osx
koda
parents: 7617
diff changeset
    49
        /opt/local/lib #macports
a25e943dd4b0 finally videorec on osx
koda
parents: 7617
diff changeset
    50
        /sw/lib #fink
8662
bfcc09f2accc rewritten findffmpeg.cmake
koda
parents: 8285
diff changeset
    51
)
7528
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    52
8662
bfcc09f2accc rewritten findffmpeg.cmake
koda
parents: 8285
diff changeset
    53
find_library(LIBAVFORMAT_LIBRARY
7528
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    54
    NAMES avformat
8662
bfcc09f2accc rewritten findffmpeg.cmake
koda
parents: 8285
diff changeset
    55
    PATHS ${_AVFORMAT_LIBRARY_DIRS}
7816
a25e943dd4b0 finally videorec on osx
koda
parents: 7617
diff changeset
    56
        /usr/lib /usr/local/lib #system level
a25e943dd4b0 finally videorec on osx
koda
parents: 7617
diff changeset
    57
        /opt/local/lib #macports
a25e943dd4b0 finally videorec on osx
koda
parents: 7617
diff changeset
    58
        /sw/lib #fink
8662
bfcc09f2accc rewritten findffmpeg.cmake
koda
parents: 8285
diff changeset
    59
)
7528
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    60
8662
bfcc09f2accc rewritten findffmpeg.cmake
koda
parents: 8285
diff changeset
    61
find_library(LIBAVUTIL_LIBRARY
7528
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    62
    NAMES avutil
8662
bfcc09f2accc rewritten findffmpeg.cmake
koda
parents: 8285
diff changeset
    63
    PATHS ${_AVUTIL_LIBRARY_DIRS}
7816
a25e943dd4b0 finally videorec on osx
koda
parents: 7617
diff changeset
    64
        /usr/lib /usr/local/lib #system level
a25e943dd4b0 finally videorec on osx
koda
parents: 7617
diff changeset
    65
        /opt/local/lib #macports
a25e943dd4b0 finally videorec on osx
koda
parents: 7617
diff changeset
    66
        /sw/lib #fink
8662
bfcc09f2accc rewritten findffmpeg.cmake
koda
parents: 8285
diff changeset
    67
)
7528
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    68
8662
bfcc09f2accc rewritten findffmpeg.cmake
koda
parents: 8285
diff changeset
    69
find_package_handle_standard_args(FFMPEG DEFAULT_MSG LIBAVCODEC_LIBRARY LIBAVCODEC_INCLUDE_DIR
bfcc09f2accc rewritten findffmpeg.cmake
koda
parents: 8285
diff changeset
    70
                                                     LIBAVFORMAT_LIBRARY
bfcc09f2accc rewritten findffmpeg.cmake
koda
parents: 8285
diff changeset
    71
                                                     LIBAVUTIL_LIBRARY
bfcc09f2accc rewritten findffmpeg.cmake
koda
parents: 8285
diff changeset
    72
                                                     )
bfcc09f2accc rewritten findffmpeg.cmake
koda
parents: 8285
diff changeset
    73
set(FFMPEG_INCLUDE_DIR ${LIBAVCODEC_INCLUDE_DIR}
bfcc09f2accc rewritten findffmpeg.cmake
koda
parents: 8285
diff changeset
    74
                       #TODO: add other include paths
bfcc09f2accc rewritten findffmpeg.cmake
koda
parents: 8285
diff changeset
    75
                       )
bfcc09f2accc rewritten findffmpeg.cmake
koda
parents: 8285
diff changeset
    76
set(FFMPEG_LIBRARIES ${LIBAVCODEC_LIBRARY}
bfcc09f2accc rewritten findffmpeg.cmake
koda
parents: 8285
diff changeset
    77
                     ${LIBAVFORMAT_LIBRARY}
bfcc09f2accc rewritten findffmpeg.cmake
koda
parents: 8285
diff changeset
    78
                     ${LIBAVUTIL_LIBRARY}
bfcc09f2accc rewritten findffmpeg.cmake
koda
parents: 8285
diff changeset
    79
                     )
7528
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    80
8662
bfcc09f2accc rewritten findffmpeg.cmake
koda
parents: 8285
diff changeset
    81
mark_as_advanced(FFMPEG_INCLUDE_DIR FFMPEG_LIBRARIES LIBAVCODEC_LIBRARY LIBAVCODEC_INCLUDE_DIR LIBAVFORMAT_LIBRARY LIBAVUTIL_LIBRARY)
7528
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    82
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    83