aboutsummaryrefslogtreecommitdiff
path: root/tools/depends/target/ffmpeg/CMakeLists.txt
blob: 5bc3d791f9ae1d65985b15619bae1fbf9fa314d1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
project(ffmpeg)

cmake_minimum_required(VERSION 2.8)

list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR})

set(ffmpeg_conf "")

if(CROSSCOMPILING)
  set(pkgconf "PKG_CONFIG_LIBDIR=${DEPENDS_PATH}/lib/pkgconfig")
  list(APPEND ffmpeg_conf --pkg-config=${PKG_CONFIG_EXECUTABLE} --pkg-config-flags=--static)
  list(APPEND ffmpeg_conf --enable-cross-compile --cpu=${CPU} --arch=${CPU} --target-os=${OS})
  list(APPEND ffmpeg_conf --cc=${CMAKE_C_COMPILER} --cxx=${CMAKE_CXX_COMPILER} --ar=${CMAKE_AR})
  message(STATUS "CROSS: ${ffmpeg_conf}")
endif()

if(CMAKE_C_FLAGS)
  list(APPEND ffmpeg_conf --extra-cflags=${CMAKE_C_FLAGS})
endif()

if(CMAKE_CXX_FLAGS)
  list(APPEND ffmpeg_conf --extra-cxxflags=${CMAKE_CXX_FLAGS})
endif()

if(CMAKE_EXE_LINKER_FLAGS)
  list(APPEND ffmpeg_conf --extra-ldflags=${CMAKE_EXE_LINKER_FLAGS})
endif()

if(ENABLE_NEON)
  list(APPEND ffmpeg_conf --enable-neon)
endif()

if(CMAKE_BUILD_TYPE STREQUAL Release)
  list(APPEND ffmpeg_conf --disable-debug)
endif()

if(CORE_SYSTEM_NAME STREQUAL linux OR CORE_SYSTEM_NAME STREQUAL freebsd)
  list(APPEND ffmpeg_conf --enable-vdpau --enable-vaapi --enable-pic)
elseif(CORE_SYSTEM_NAME STREQUAL android)
  if(CPU MATCHES arm64)
    list(APPEND ffmpeg_conf --cpu=cortex-a53 --arch=aarch64)
  elseif(CPU MATCHES arm)
    list(APPEND ffmpeg_conf --cpu=cortex-a9)
  else()
    list(APPEND ffmpeg_conf --cpu=i686 --disable-mmx)
  endif()
  list(APPEND ffmpeg_conf --target-os=linux --extra-libs=-liconv)
elseif(CORE_SYSTEM_NAME STREQUAL ios)
  if(NOT CPU MATCHES arm64)
    list(APPEND ffmpeg_conf --cpu=cortex-a8)
  endif()
  list(APPEND ffmpeg_conf --disable-decoder=mpeg_xvmc --disable-vda --disable-crystalhd --enable-videotoolbox
                          --target-os=darwin)
elseif(CORE_SYSTEM_NAME STREQUAL osx)
  list(APPEND ffmpeg_conf --disable-outdev=sdl
                          --disable-decoder=mpeg_xvmc --disable-vda --disable-crystalhd --enable-videotoolbox
                          --target-os=darwin
                          --disable-securetransport)
elseif(CORE_SYSTEM_NAME STREQUAL rbpi)
  if(CPU STREQUAL "cortex-a7" OR CPU STREQUAL "cortex-a53")
    list(APPEND ffmpeg_conf --cpu=${CPU} --enable-pic --disable-armv5te --disable-armv6t2)
  endif()
  list(APPEND ffmpeg_conf --enable-hardcoded-tables --disable-vaapi --disable-vdpau --enable-mmal
                          --enable-omx-rpi)

endif()

if(CPU MATCHES arm)
  list(APPEND ffmpeg_conf --enable-pic --disable-armv5te --disable-armv6t2)
elseif(CPU MATCHES mips)
  list(APPEND ffmpeg_conf --disable-mips32r2 --disable-mipsdspr1 --disable-mipsdspr2)
endif()

find_package(GnuTls)
if(GNUTLS_FOUND)
  list(APPEND ffmpeg_conf --enable-gnutls)
endif()

message(STATUS "FFMPEG_CONF: ${ffmpeg_conf}")

include(ExternalProject)
externalproject_add(ffmpeg
                    SOURCE_DIR ${CMAKE_SOURCE_DIR}
                    CONFIGURE_COMMAND ${pkgconf} <SOURCE_DIR>/configure
                      --prefix=${CMAKE_INSTALL_PREFIX}
                      --extra-version="kodi-${FFMPEG_VER}"
                      --disable-devices
                      --disable-doc
                      --disable-ffplay
                      --disable-ffmpeg
                      --disable-ffprobe
                      --disable-ffserver
                      --disable-sdl
                      --enable-gpl
                      --enable-runtime-cpudetect
                      --enable-postproc
                      --enable-pthreads
                      --enable-muxer=spdif
                      --enable-muxer=adts
                      --enable-muxer=asf
                      --enable-muxer=ipod
                      --enable-encoder=ac3
                      --enable-encoder=aac
                      --enable-encoder=wmav2
                      --enable-protocol=http
                      --enable-encoder=png
                      --enable-encoder=mjpeg
                      ${ffmpeg_conf})

install(CODE "Message(Done)")

# Quell warnings
set(BUILD_SHARED_LIBS)
set(XBMC_BUILD_DIR)
set(KODI_BUILD_DIR)