author | Periklis Ntanasis <pntanasis@gmail.com> |
Wed, 04 Dec 2013 02:08:46 +0200 | |
changeset 9747 | abe0c8a2d573 |
parent 9419 | fa8324ed4702 |
permissions | -rw-r--r-- |
8662 | 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 | 4 |
# FFMPEG_FOUND - system has libavcodec, libavformat, libavutil |
5 |
# FFMPEG_INCLUDE_DIR - the libav include directories |
|
6 |
# FFMPEG_LIBRARIES - the libav libraries |
|
7 |
# |
|
8 |
# LIBAVCODEC_LIBRARY - the libavcodec library |
|
9 |
# LIBAVCODEC_INCLUDE_DIR - the libavcodec include directory |
|
10 |
# LIBAVFORMAT_LIBRARY - the libavformat library |
|
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 | 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 | 22 |
include(FindPackageHandleStandardArgs) |
23 |
||
8285 | 24 |
|
8662 | 25 |
# use pkg-config to get the directories and then use these values |
26 |
# in the FIND_PATH() and FIND_LIBRARY() calls |
|
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) |
fa8324ed4702
avoid duplicate pkg-config calls and make sure to use the pkg-config paths when found
koda
parents:
8662
diff
changeset
|
30 |
pkg_check_modules(_FFMPEG_AVCODEC libavcodec) |
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) |
fa8324ed4702
avoid duplicate pkg-config calls and make sure to use the pkg-config paths when found
koda
parents:
8662
diff
changeset
|
33 |
pkg_check_modules(_FFMPEG_AVFORMAT libavformat) |
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) |
fa8324ed4702
avoid duplicate pkg-config calls and make sure to use the pkg-config paths when found
koda
parents:
8662
diff
changeset
|
36 |
pkg_check_modules(_FFMPEG_AVUTIL libavutil) |
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 | 40 |
find_path(LIBAVCODEC_INCLUDE_DIR |
7534 | 41 |
NAMES libavcodec/avcodec.h |
9419
fa8324ed4702
avoid duplicate pkg-config calls and make sure to use the pkg-config paths when found
koda
parents:
8662
diff
changeset
|
42 |
PATHS ${_FFMPEG_AVCODEC_INCLUDE_DIRS} #pkg-config |
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 | 45 |
PATH_SUFFIXES libav ffmpeg |
46 |
) |
|
7528
f8cf277dca36
FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
47 |
|
8662 | 48 |
#TODO: add other include paths |
49 |
||
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 |
9419
fa8324ed4702
avoid duplicate pkg-config calls and make sure to use the pkg-config paths when found
koda
parents:
8662
diff
changeset
|
52 |
PATHS ${_FFMPEG_AVCODEC_LIBRARY_DIRS} #pkg-config |
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 | 55 |
) |
7528
f8cf277dca36
FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
56 |
|
8662 | 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 |
9419
fa8324ed4702
avoid duplicate pkg-config calls and make sure to use the pkg-config paths when found
koda
parents:
8662
diff
changeset
|
59 |
PATHS ${_FFMPEG_AVFORMAT_LIBRARY_DIRS} #pkg-config |
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 | 62 |
) |
7528
f8cf277dca36
FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
63 |
|
8662 | 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 |
9419
fa8324ed4702
avoid duplicate pkg-config calls and make sure to use the pkg-config paths when found
koda
parents:
8662
diff
changeset
|
66 |
PATHS ${_FFMPEG_AVUTIL_LIBRARY_DIRS} #pkg-config |
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 | 69 |
) |
7528
f8cf277dca36
FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
70 |
|
8662 | 71 |
find_package_handle_standard_args(FFMPEG DEFAULT_MSG LIBAVCODEC_LIBRARY LIBAVCODEC_INCLUDE_DIR |
72 |
LIBAVFORMAT_LIBRARY |
|
73 |
LIBAVUTIL_LIBRARY |
|
74 |
) |
|
75 |
set(FFMPEG_INCLUDE_DIR ${LIBAVCODEC_INCLUDE_DIR} |
|
76 |
#TODO: add other include paths |
|
77 |
) |
|
78 |
set(FFMPEG_LIBRARIES ${LIBAVCODEC_LIBRARY} |
|
79 |
${LIBAVFORMAT_LIBRARY} |
|
80 |
${LIBAVUTIL_LIBRARY} |
|
81 |
) |
|
7528
f8cf277dca36
FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
82 |
|
8662 | 83 |
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
|
84 |
|
f8cf277dca36
FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
85 |