author | koda |
Fri, 09 Nov 2012 23:11:53 +0100 | |
branch | webgl |
changeset 8006 | 7ca007615b88 |
parent 7816 | a25e943dd4b0 |
child 8279 | c03d64969112 |
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 |
|
7534 | 19 |
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
|
20 |
# in cache already |
f8cf277dca36
FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
21 |
set(FFMPEG_FOUND TRUE) |
7534 | 22 |
else (FFMPEG_LIBRARIES AND FFMPEG_INCLUDE_DIR) |
7528
f8cf277dca36
FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
23 |
# 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
|
24 |
# 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
|
25 |
find_package(PkgConfig) |
f8cf277dca36
FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
26 |
if (PKG_CONFIG_FOUND) |
f8cf277dca36
FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
27 |
pkg_check_modules(_FFMPEG_AVCODEC libavcodec) |
f8cf277dca36
FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
28 |
pkg_check_modules(_FFMPEG_AVFORMAT libavformat) |
f8cf277dca36
FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
29 |
pkg_check_modules(_FFMPEG_AVUTIL libavutil) |
f8cf277dca36
FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
30 |
endif (PKG_CONFIG_FOUND) |
f8cf277dca36
FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
31 |
|
f8cf277dca36
FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
32 |
find_path(FFMPEG_AVCODEC_INCLUDE_DIR |
7534 | 33 |
NAMES libavcodec/avcodec.h |
7816 | 34 |
PATHS ${_FFMPEG_AVCODEC_INCLUDE_DIRS} |
35 |
/usr/include /usr/local/include #system level |
|
36 |
/opt/local/include #macports |
|
37 |
/sw/include #fink |
|
7534 | 38 |
PATH_SUFFIXES ffmpeg libav |
7528
f8cf277dca36
FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
39 |
) |
f8cf277dca36
FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
40 |
|
7538 | 41 |
find_library(FFMPEG_LIBAVCODEC |
7528
f8cf277dca36
FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
42 |
NAMES avcodec |
7816 | 43 |
PATHS ${_FFMPEG_AVCODEC_LIBRARY_DIRS} |
44 |
/usr/lib /usr/local/lib #system level |
|
45 |
/opt/local/lib #macports |
|
46 |
/sw/lib #fink |
|
7528
f8cf277dca36
FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
47 |
) |
f8cf277dca36
FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
48 |
|
7538 | 49 |
find_library(FFMPEG_LIBAVFORMAT |
7528
f8cf277dca36
FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
50 |
NAMES avformat |
7816 | 51 |
PATHS ${_FFMPEG_AVFORMAT_LIBRARY_DIRS} |
52 |
/usr/lib /usr/local/lib #system level |
|
53 |
/opt/local/lib #macports |
|
54 |
/sw/lib #fink |
|
7528
f8cf277dca36
FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
55 |
) |
f8cf277dca36
FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
56 |
|
7538 | 57 |
find_library(FFMPEG_LIBAVUTIL |
7528
f8cf277dca36
FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
58 |
NAMES avutil |
7816 | 59 |
PATHS ${_FFMPEG_AVUTIL_LIBRARY_DIRS} |
60 |
/usr/lib /usr/local/lib #system level |
|
61 |
/opt/local/lib #macports |
|
62 |
/sw/lib #fink |
|
7528
f8cf277dca36
FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
63 |
) |
f8cf277dca36
FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
64 |
|
7538 | 65 |
if (FFMPEG_LIBAVCODEC AND FFMPEG_LIBAVFORMAT) |
7528
f8cf277dca36
FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
66 |
set(FFMPEG_FOUND TRUE) |
7538 | 67 |
endif() |
7528
f8cf277dca36
FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
68 |
|
f8cf277dca36
FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
69 |
if (FFMPEG_FOUND) |
7617 | 70 |
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
|
71 |
|
f8cf277dca36
FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
72 |
set(FFMPEG_LIBRARIES |
7538 | 73 |
${FFMPEG_LIBAVCODEC} |
74 |
${FFMPEG_LIBAVFORMAT} |
|
75 |
${FFMPEG_LIBAVUTIL} |
|
7528
f8cf277dca36
FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
76 |
) |
7816 | 77 |
if (APPLE) |
78 |
set(FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} "bz2" "-framework CoreVideo" "-framework VideoDecodeAcceleration") |
|
79 |
endif(APPLE) |
|
7528
f8cf277dca36
FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
80 |
|
f8cf277dca36
FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
81 |
endif (FFMPEG_FOUND) |
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 |
if (FFMPEG_FOUND) |
f8cf277dca36
FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
84 |
if (NOT FFMPEG_FIND_QUIETLY) |
7816 | 85 |
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
|
86 |
endif (NOT FFMPEG_FIND_QUIETLY) |
f8cf277dca36
FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
87 |
else (FFMPEG_FOUND) |
f8cf277dca36
FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
88 |
if (FFMPEG_FIND_REQUIRED) |
7816 | 89 |
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
|
90 |
endif (FFMPEG_FIND_REQUIRED) |
f8cf277dca36
FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
91 |
endif (FFMPEG_FOUND) |
f8cf277dca36
FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
92 |
|
7534 | 93 |
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
|
94 |