cmake_modules/FindLIBAV.cmake
author Wuzzy <Wuzzy2@mail.ru>
Fri, 05 Oct 2018 19:37:06 +0200
changeset 13853 46e1c1069ac2
parent 9959 1a42d36f346a
permissions -rw-r--r--
Don't load game scheme from file if name collides with default scheme
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
#
9959
1a42d36f346a use mainstream project name
koda
parents: 9419
diff changeset
     4
#  LIBAV_FOUND             - system has libavcodec, libavformat, libavutil
1a42d36f346a use mainstream project name
koda
parents: 9419
diff changeset
     5
#  LIBAV_INCLUDE_DIR       - libav include directories
1a42d36f346a use mainstream project name
koda
parents: 9419
diff changeset
     6
#  LIBAV_LIBRARIES         - libav libraries (libavcodec, libavformat, libavutil)
8662
bfcc09f2accc rewritten findffmpeg.cmake
koda
parents: 8285
diff changeset
     7
#
9959
1a42d36f346a use mainstream project name
koda
parents: 9419
diff changeset
     8
#  LIBAVCODEC_LIBRARY      - libavcodec library
1a42d36f346a use mainstream project name
koda
parents: 9419
diff changeset
     9
#  LIBAVCODEC_INCLUDE_DIR  - libavcodec include directory
1a42d36f346a use mainstream project name
koda
parents: 9419
diff changeset
    10
#  LIBAVFORMAT_LIBRARY     - libavformat library
1a42d36f346a use mainstream project name
koda
parents: 9419
diff changeset
    11
#  LIBAVUTIL_LIBRARY       - 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)
9419
fa8324ed4702 avoid duplicate pkg-config calls and make sure to use the pkg-config paths when found
koda
parents: 8662
diff changeset
    28
if(PKG_CONFIG_FOUND)
fa8324ed4702 avoid duplicate pkg-config calls and make sure to use the pkg-config paths when found
koda
parents: 8662
diff changeset
    29
    if(NOT LIBAVCODEC_INCLUDE_DIR OR NOT LIBAVCODEC_LIBRARY)
9959
1a42d36f346a use mainstream project name
koda
parents: 9419
diff changeset
    30
        pkg_check_modules(_LIBAV_AVCODEC libavcodec)
9419
fa8324ed4702 avoid duplicate pkg-config calls and make sure to use the pkg-config paths when found
koda
parents: 8662
diff changeset
    31
    endif()
fa8324ed4702 avoid duplicate pkg-config calls and make sure to use the pkg-config paths when found
koda
parents: 8662
diff changeset
    32
    if(NOT LIBAVFORMAT_LIBRARY)
9959
1a42d36f346a use mainstream project name
koda
parents: 9419
diff changeset
    33
        pkg_check_modules(_LIBAV_AVFORMAT libavformat)
9419
fa8324ed4702 avoid duplicate pkg-config calls and make sure to use the pkg-config paths when found
koda
parents: 8662
diff changeset
    34
    endif()
fa8324ed4702 avoid duplicate pkg-config calls and make sure to use the pkg-config paths when found
koda
parents: 8662
diff changeset
    35
    if(NOT LIBAVUTIL_LIBRARY)
9959
1a42d36f346a use mainstream project name
koda
parents: 9419
diff changeset
    36
        pkg_check_modules(_LIBAV_AVUTIL libavutil)
9419
fa8324ed4702 avoid duplicate pkg-config calls and make sure to use the pkg-config paths when found
koda
parents: 8662
diff changeset
    37
    endif()
fa8324ed4702 avoid duplicate pkg-config calls and make sure to use the pkg-config paths when found
koda
parents: 8662
diff changeset
    38
endif(PKG_CONFIG_FOUND)
7528
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    39
8662
bfcc09f2accc rewritten findffmpeg.cmake
koda
parents: 8285
diff changeset
    40
find_path(LIBAVCODEC_INCLUDE_DIR
7534
ccb9c2906160 fix FindFFMPEG
Stepan777 <stepik-777@mail.ru>
parents: 7528
diff changeset
    41
    NAMES libavcodec/avcodec.h
9959
1a42d36f346a use mainstream project name
koda
parents: 9419
diff changeset
    42
    PATHS ${_LIBAV_AVCODEC_INCLUDE_DIRS}     #pkg-config
9419
fa8324ed4702 avoid duplicate pkg-config calls and make sure to use the pkg-config paths when found
koda
parents: 8662
diff changeset
    43
          /usr/include /usr/local/include    #system level
fa8324ed4702 avoid duplicate pkg-config calls and make sure to use the pkg-config paths when found
koda
parents: 8662
diff changeset
    44
          /opt/local/include /sw/include     #macports & fink
8662
bfcc09f2accc rewritten findffmpeg.cmake
koda
parents: 8285
diff changeset
    45
    PATH_SUFFIXES libav ffmpeg
bfcc09f2accc rewritten findffmpeg.cmake
koda
parents: 8285
diff changeset
    46
)
7528
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    47
8662
bfcc09f2accc rewritten findffmpeg.cmake
koda
parents: 8285
diff changeset
    48
#TODO: add other include paths
bfcc09f2accc rewritten findffmpeg.cmake
koda
parents: 8285
diff changeset
    49
bfcc09f2accc rewritten findffmpeg.cmake
koda
parents: 8285
diff changeset
    50
find_library(LIBAVCODEC_LIBRARY
7528
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    51
    NAMES avcodec
9959
1a42d36f346a use mainstream project name
koda
parents: 9419
diff changeset
    52
    PATHS ${_LIBAV_AVCODEC_LIBRARY_DIRS}    #pkg-config
9419
fa8324ed4702 avoid duplicate pkg-config calls and make sure to use the pkg-config paths when found
koda
parents: 8662
diff changeset
    53
          /usr/lib /usr/local/lib           #system level
fa8324ed4702 avoid duplicate pkg-config calls and make sure to use the pkg-config paths when found
koda
parents: 8662
diff changeset
    54
          /opt/local/lib /sw/lib            #macports & fink
8662
bfcc09f2accc rewritten findffmpeg.cmake
koda
parents: 8285
diff changeset
    55
)
7528
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    56
8662
bfcc09f2accc rewritten findffmpeg.cmake
koda
parents: 8285
diff changeset
    57
find_library(LIBAVFORMAT_LIBRARY
7528
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    58
    NAMES avformat
9959
1a42d36f346a use mainstream project name
koda
parents: 9419
diff changeset
    59
    PATHS ${_LIBAV_AVFORMAT_LIBRARY_DIRS}   #pkg-config
9419
fa8324ed4702 avoid duplicate pkg-config calls and make sure to use the pkg-config paths when found
koda
parents: 8662
diff changeset
    60
          /usr/lib /usr/local/lib           #system level
fa8324ed4702 avoid duplicate pkg-config calls and make sure to use the pkg-config paths when found
koda
parents: 8662
diff changeset
    61
          /opt/local/lib /sw/lib            #macports & fink
8662
bfcc09f2accc rewritten findffmpeg.cmake
koda
parents: 8285
diff changeset
    62
)
7528
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    63
8662
bfcc09f2accc rewritten findffmpeg.cmake
koda
parents: 8285
diff changeset
    64
find_library(LIBAVUTIL_LIBRARY
7528
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    65
    NAMES avutil
9959
1a42d36f346a use mainstream project name
koda
parents: 9419
diff changeset
    66
    PATHS ${_LIBAV_AVUTIL_LIBRARY_DIRS}     #pkg-config
9419
fa8324ed4702 avoid duplicate pkg-config calls and make sure to use the pkg-config paths when found
koda
parents: 8662
diff changeset
    67
          /usr/lib /usr/local/lib           #system level
fa8324ed4702 avoid duplicate pkg-config calls and make sure to use the pkg-config paths when found
koda
parents: 8662
diff changeset
    68
          /opt/local/lib /sw/lib            #macports & fink
8662
bfcc09f2accc rewritten findffmpeg.cmake
koda
parents: 8285
diff changeset
    69
)
7528
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    70
9959
1a42d36f346a use mainstream project name
koda
parents: 9419
diff changeset
    71
find_package_handle_standard_args(LIBAV DEFAULT_MSG LIBAVCODEC_LIBRARY
1a42d36f346a use mainstream project name
koda
parents: 9419
diff changeset
    72
                                                    LIBAVCODEC_INCLUDE_DIR
1a42d36f346a use mainstream project name
koda
parents: 9419
diff changeset
    73
                                                    LIBAVFORMAT_LIBRARY
1a42d36f346a use mainstream project name
koda
parents: 9419
diff changeset
    74
                                                    LIBAVUTIL_LIBRARY
1a42d36f346a use mainstream project name
koda
parents: 9419
diff changeset
    75
                                                    )
1a42d36f346a use mainstream project name
koda
parents: 9419
diff changeset
    76
set(LIBAV_INCLUDE_DIR ${LIBAVCODEC_INCLUDE_DIR}
1a42d36f346a use mainstream project name
koda
parents: 9419
diff changeset
    77
                      #TODO: add other include paths
1a42d36f346a use mainstream project name
koda
parents: 9419
diff changeset
    78
                      )
1a42d36f346a use mainstream project name
koda
parents: 9419
diff changeset
    79
set(LIBAV_LIBRARIES ${LIBAVCODEC_LIBRARY}
1a42d36f346a use mainstream project name
koda
parents: 9419
diff changeset
    80
                    ${LIBAVFORMAT_LIBRARY}
1a42d36f346a use mainstream project name
koda
parents: 9419
diff changeset
    81
                    ${LIBAVUTIL_LIBRARY}
1a42d36f346a use mainstream project name
koda
parents: 9419
diff changeset
    82
                    )
7528
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    83
9959
1a42d36f346a use mainstream project name
koda
parents: 9419
diff changeset
    84
mark_as_advanced(LIBAV_INCLUDE_DIR
1a42d36f346a use mainstream project name
koda
parents: 9419
diff changeset
    85
                 LIBAV_LIBRARIES
1a42d36f346a use mainstream project name
koda
parents: 9419
diff changeset
    86
                 LIBAVCODEC_LIBRARY
1a42d36f346a use mainstream project name
koda
parents: 9419
diff changeset
    87
                 LIBAVCODEC_INCLUDE_DIR
1a42d36f346a use mainstream project name
koda
parents: 9419
diff changeset
    88
                 LIBAVFORMAT_LIBRARY
1a42d36f346a use mainstream project name
koda
parents: 9419
diff changeset
    89
                 LIBAVUTIL_LIBRARY)
7528
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    90