author | koda |
Mon, 04 Mar 2013 11:09:36 +0100 | |
changeset 8639 | 33d29ed99faa |
parent 8285 | a1500ffdc343 |
child 8662 | bfcc09f2accc |
permissions | -rw-r--r-- |
7534 | 1 |
# - Try to find ffmpeg 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 |
# |
7540 | 4 |
# FFMPEG_FOUND - system has ffmpeg or libav |
7534 | 5 |
# FFMPEG_INCLUDE_DIR - the ffmpeg include directory |
6 |
# FFMPEG_LIBRARIES - Link these to use ffmpeg |
|
7538 | 7 |
# FFMPEG_LIBAVCODEC |
8 |
# FFMPEG_LIBAVFORMAT |
|
9 |
# FFMPEG_LIBAVUTIL |
|
7528
f8cf277dca36
FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
10 |
# |
f8cf277dca36
FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
11 |
# 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
|
12 |
# 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
|
13 |
# Modified for Hedgewars by Stepik777 |
f8cf277dca36
FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
14 |
# |
f8cf277dca36
FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
15 |
# 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
|
16 |
# BSD license. |
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 |
|
8285 | 19 |
set(FFMPEG_FOUND FALSE) |
20 |
||
7534 | 21 |
if (FFMPEG_LIBRARIES AND FFMPEG_INCLUDE_DIR) |
7528
f8cf277dca36
FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
22 |
# in cache already |
f8cf277dca36
FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
23 |
set(FFMPEG_FOUND TRUE) |
7534 | 24 |
else (FFMPEG_LIBRARIES AND FFMPEG_INCLUDE_DIR) |
8283 | 25 |
# silence output option |
26 |
if (FFMPEG_FIND_QUIETLY) |
|
27 |
set(VERBOSITY "QUIET") |
|
28 |
endif () |
|
7528
f8cf277dca36
FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
29 |
# use pkg-config to get the directories and then use these values |
f8cf277dca36
FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
30 |
# in the FIND_PATH() and FIND_LIBRARY() calls |
f8cf277dca36
FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
31 |
find_package(PkgConfig) |
f8cf277dca36
FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
32 |
if (PKG_CONFIG_FOUND) |
8283 | 33 |
pkg_check_modules(_FFMPEG_AVCODEC libavcodec ${VERBOSITY}) |
34 |
pkg_check_modules(_FFMPEG_AVFORMAT libavformat ${VERBOSITY}) |
|
35 |
pkg_check_modules(_FFMPEG_AVUTIL libavutil ${VERBOSITY}) |
|
7528
f8cf277dca36
FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
36 |
endif (PKG_CONFIG_FOUND) |
f8cf277dca36
FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
37 |
|
f8cf277dca36
FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
38 |
find_path(FFMPEG_AVCODEC_INCLUDE_DIR |
7534 | 39 |
NAMES libavcodec/avcodec.h |
7816 | 40 |
PATHS ${_FFMPEG_AVCODEC_INCLUDE_DIRS} |
41 |
/usr/include /usr/local/include #system level |
|
42 |
/opt/local/include #macports |
|
43 |
/sw/include #fink |
|
7534 | 44 |
PATH_SUFFIXES ffmpeg libav |
7528
f8cf277dca36
FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
45 |
) |
f8cf277dca36
FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
46 |
|
7538 | 47 |
find_library(FFMPEG_LIBAVCODEC |
7528
f8cf277dca36
FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
48 |
NAMES avcodec |
7816 | 49 |
PATHS ${_FFMPEG_AVCODEC_LIBRARY_DIRS} |
50 |
/usr/lib /usr/local/lib #system level |
|
51 |
/opt/local/lib #macports |
|
52 |
/sw/lib #fink |
|
7528
f8cf277dca36
FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
53 |
) |
f8cf277dca36
FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
54 |
|
7538 | 55 |
find_library(FFMPEG_LIBAVFORMAT |
7528
f8cf277dca36
FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
56 |
NAMES avformat |
7816 | 57 |
PATHS ${_FFMPEG_AVFORMAT_LIBRARY_DIRS} |
58 |
/usr/lib /usr/local/lib #system level |
|
59 |
/opt/local/lib #macports |
|
60 |
/sw/lib #fink |
|
7528
f8cf277dca36
FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
61 |
) |
f8cf277dca36
FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
62 |
|
7538 | 63 |
find_library(FFMPEG_LIBAVUTIL |
7528
f8cf277dca36
FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
64 |
NAMES avutil |
7816 | 65 |
PATHS ${_FFMPEG_AVUTIL_LIBRARY_DIRS} |
66 |
/usr/lib /usr/local/lib #system level |
|
67 |
/opt/local/lib #macports |
|
68 |
/sw/lib #fink |
|
7528
f8cf277dca36
FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
69 |
) |
f8cf277dca36
FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
70 |
|
7538 | 71 |
if (FFMPEG_LIBAVCODEC AND FFMPEG_LIBAVFORMAT) |
7528
f8cf277dca36
FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
72 |
set(FFMPEG_FOUND TRUE) |
7538 | 73 |
endif() |
7528
f8cf277dca36
FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
74 |
|
f8cf277dca36
FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
75 |
if (FFMPEG_FOUND) |
7617 | 76 |
set(FFMPEG_INCLUDE_DIR ${FFMPEG_AVCODEC_INCLUDE_DIR}) |
7528
f8cf277dca36
FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
77 |
|
f8cf277dca36
FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
78 |
set(FFMPEG_LIBRARIES |
7538 | 79 |
${FFMPEG_LIBAVCODEC} |
80 |
${FFMPEG_LIBAVFORMAT} |
|
81 |
${FFMPEG_LIBAVUTIL} |
|
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 |
endif (FFMPEG_FOUND) |
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 |
if (FFMPEG_FOUND) |
f8cf277dca36
FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
86 |
if (NOT FFMPEG_FIND_QUIETLY) |
7816 | 87 |
message(STATUS "Found FFMPEG/LibAV: ${FFMPEG_LIBRARIES}, ${FFMPEG_INCLUDE_DIR}") |
7528
f8cf277dca36
FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
88 |
endif (NOT FFMPEG_FIND_QUIETLY) |
f8cf277dca36
FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
89 |
else (FFMPEG_FOUND) |
f8cf277dca36
FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
90 |
if (FFMPEG_FIND_REQUIRED) |
7816 | 91 |
message(FATAL_ERROR "Could NOT find libavcodec or libavformat or libavutil") |
7528
f8cf277dca36
FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
92 |
endif (FFMPEG_FIND_REQUIRED) |
f8cf277dca36
FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
93 |
endif (FFMPEG_FOUND) |
f8cf277dca36
FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
94 |
|
7534 | 95 |
endif (FFMPEG_LIBRARIES AND FFMPEG_INCLUDE_DIR) |
7528
f8cf277dca36
FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
96 |