Merge lp:~morphis/aethercast/support-cross-compile into lp:aethercast
- support-cross-compile
- Merge into trunk
Proposed by
Simon Fels
Status: | Superseded |
---|---|
Proposed branch: | lp:~morphis/aethercast/support-cross-compile |
Merge into: | lp:aethercast |
Diff against target: |
539 lines (+401/-16) 9 files modified
cmake/LinuxCrossCompile.cmake (+43/-0) cross-compile-chroot.sh (+162/-0) debian/control (+2/-1) scripts/setup-partial-armhf-chroot.sh (+155/-0) src/CMakeLists.txt (+14/-15) src/mcs/basesourcemediamanager.cpp (+12/-0) src/mcs/basesourcemediamanager.h (+4/-0) src/mcs/miracastsourceclient.cpp (+8/-0) src/mcs/miracastsourceclient.h (+1/-0) |
To merge this branch: | bzr merge lp:~morphis/aethercast/support-cross-compile |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Ubuntu Phablet Team | Pending | ||
Review via email: mp+287441@code.launchpad.net |
This proposal has been superseded by a proposal from 2016-02-29.
Commit message
Add cross-compilation support
Description of the change
Add cross-compilation support
To post a comment you must log in.
- 187. By Simon Fels
-
Merge trunk
Unmerged revisions
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === added file 'cmake/LinuxCrossCompile.cmake' | |||
2 | --- cmake/LinuxCrossCompile.cmake 1970-01-01 00:00:00 +0000 | |||
3 | +++ cmake/LinuxCrossCompile.cmake 2016-02-29 08:26:24 +0000 | |||
4 | @@ -0,0 +1,43 @@ | |||
5 | 1 | set(CMAKE_SYSTEM_NAME Linux) | ||
6 | 2 | set(CMAKE_SYSTEM_VERSION 1) | ||
7 | 3 | |||
8 | 4 | set(AC_NDK_PATH $ENV{AC_NDK_PATH} CACHE STRING "path of mir android bundle") | ||
9 | 5 | |||
10 | 6 | if (NOT DEFINED AC_TARGET_MACHINE) | ||
11 | 7 | set(AC_TARGET_MACHINE $ENV{AC_TARGET_MACHINE} CACHE STRING "target machine") | ||
12 | 8 | endif() | ||
13 | 9 | if (NOT DEFINED AC_GCC_VARIANT) | ||
14 | 10 | set(AC_GCC_VARIANT $ENV{AC_GCC_VARIANT} CACHE STRING "gcc variant required") | ||
15 | 11 | endif() | ||
16 | 12 | |||
17 | 13 | set(CMAKE_C_COMPILER /usr/bin/${AC_TARGET_MACHINE}-gcc${AC_GCC_VARIANT}) | ||
18 | 14 | set(CMAKE_CXX_COMPILER /usr/bin/${AC_TARGET_MACHINE}-g++${AC_GCC_VARIANT}) | ||
19 | 15 | |||
20 | 16 | # where to look to find dependencies in the target environment | ||
21 | 17 | set(CMAKE_FIND_ROOT_PATH "${AC_NDK_PATH}") | ||
22 | 18 | |||
23 | 19 | #treat the chroot's includes as system includes | ||
24 | 20 | include_directories(SYSTEM "${AC_NDK_PATH}/usr/include" "${AC_NDK_PATH}/usr/include/${AC_TARGET_MACHINE}") | ||
25 | 21 | list(APPEND CMAKE_SYSTEM_INCLUDE_PATH "${AC_NDK_PATH}/usr/include" "${AC_NDK_PATH}/usr/include/${AC_TARGET_MACHINE}" ) | ||
26 | 22 | |||
27 | 23 | # Add the chroot libraries as system libraries | ||
28 | 24 | list(APPEND CMAKE_SYSTEM_LIBRARY_PATH | ||
29 | 25 | "${AC_NDK_PATH}/lib" | ||
30 | 26 | "${AC_NDK_PATH}/lib/${AC_TARGET_MACHINE}" | ||
31 | 27 | "${AC_NDK_PATH}/usr/lib" | ||
32 | 28 | "${AC_NDK_PATH}/usr/lib/${AC_TARGET_MACHINE}" | ||
33 | 29 | ) | ||
34 | 30 | |||
35 | 31 | set(CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE) | ||
36 | 32 | set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) | ||
37 | 33 | set(CMAKE_EXECUTABLE_RUNTIME_C_FLAG "-Wl,-rpath-link,") | ||
38 | 34 | set(CMAKE_EXECUTABLE_RUNTIME_CXX_FLAG "-Wl,-rpath-link,") | ||
39 | 35 | set(CMAKE_INSTALL_RPATH "${AC_NDK_PATH}/lib:${AC_NDK_PATH}/lib/${AC_TARGET_MACHINE}:${AC_NDK_PATH}/usr/lib:${AC_NDK_PATH}/usr/lib/${AC_TARGET_MACHINE}") | ||
40 | 36 | |||
41 | 37 | set(ENV{PKG_CONFIG_PATH} "${AC_NDK_PATH}/usr/lib/pkgconfig:${AC_NDK_PATH}/usr/lib/${AC_TARGET_MACHINE}/pkgconfig") | ||
42 | 38 | set(ENV{PKG_CONFIG_SYSROOT_DIR} "${AC_NDK_PATH}") | ||
43 | 39 | |||
44 | 40 | #use only the cross compile system | ||
45 | 41 | set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) | ||
46 | 42 | set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) | ||
47 | 43 | set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) | ||
48 | 0 | 44 | ||
49 | === added file 'cross-compile-chroot.sh' | |||
50 | --- cross-compile-chroot.sh 1970-01-01 00:00:00 +0000 | |||
51 | +++ cross-compile-chroot.sh 2016-02-29 08:26:24 +0000 | |||
52 | @@ -0,0 +1,162 @@ | |||
53 | 1 | #!/bin/bash | ||
54 | 2 | # build script to compile Aethercast for armhf devices | ||
55 | 3 | # | ||
56 | 4 | set -e | ||
57 | 5 | |||
58 | 6 | usage() { | ||
59 | 7 | echo "usage: $(basename $0) [-a <arch>] [-c] [-h] [-d <dist>] [-u]" | ||
60 | 8 | echo " -a <arch> Specify target architecture (armhf/arm64/powerpc/ppc64el/amd64/i386/host)" | ||
61 | 9 | echo " -c Clean before building" | ||
62 | 10 | echo " -d <dist> Select the distribution to build for (vivid/wily/xenial)" | ||
63 | 11 | echo " -h This message" | ||
64 | 12 | echo " -u Update partial chroot directory" | ||
65 | 13 | } | ||
66 | 14 | |||
67 | 15 | clean_build_dir() { | ||
68 | 16 | rm -rf ${1} | ||
69 | 17 | mkdir ${1} | ||
70 | 18 | } | ||
71 | 19 | |||
72 | 20 | # Default to a dist-agnostic directory name so as to not break Jenkins right now | ||
73 | 21 | BUILD_DIR=build-android-arm | ||
74 | 22 | NUM_JOBS=$(( $(grep -c ^processor /proc/cpuinfo) + 1 )) | ||
75 | 23 | _do_update_chroot=0 | ||
76 | 24 | |||
77 | 25 | # Default to vivid as we don't seem to have any working wily devices right now | ||
78 | 26 | dist=vivid | ||
79 | 27 | clean=0 | ||
80 | 28 | update_build_dir=0 | ||
81 | 29 | |||
82 | 30 | target_arch=armhf | ||
83 | 31 | |||
84 | 32 | while getopts "a:cd:hu" OPTNAME | ||
85 | 33 | do | ||
86 | 34 | case $OPTNAME in | ||
87 | 35 | a ) | ||
88 | 36 | target_arch=${OPTARG} | ||
89 | 37 | update_build_dir=1 | ||
90 | 38 | ;; | ||
91 | 39 | c ) | ||
92 | 40 | clean=1 | ||
93 | 41 | ;; | ||
94 | 42 | d ) | ||
95 | 43 | dist=${OPTARG} | ||
96 | 44 | update_build_dir=1 | ||
97 | 45 | ;; | ||
98 | 46 | u ) | ||
99 | 47 | _do_update_chroot=1 | ||
100 | 48 | ;; | ||
101 | 49 | h ) | ||
102 | 50 | usage | ||
103 | 51 | exit 0 | ||
104 | 52 | ;; | ||
105 | 53 | : ) | ||
106 | 54 | echo "Parameter -${OPTARG} needs an argument" | ||
107 | 55 | usage | ||
108 | 56 | exit 1; | ||
109 | 57 | ;; | ||
110 | 58 | * ) | ||
111 | 59 | echo "invalid option specified" | ||
112 | 60 | usage | ||
113 | 61 | exit 1 | ||
114 | 62 | ;; | ||
115 | 63 | esac | ||
116 | 64 | done | ||
117 | 65 | |||
118 | 66 | shift $((${OPTIND}-1)) | ||
119 | 67 | |||
120 | 68 | if [ "${target_arch}" = "host" ]; then | ||
121 | 69 | target_arch=`dpkg-architecture -qDEB_HOST_ARCH` | ||
122 | 70 | fi | ||
123 | 71 | |||
124 | 72 | if [ ${clean} -ne 0 ]; then | ||
125 | 73 | clean_build_dir ${BUILD_DIR} | ||
126 | 74 | fi | ||
127 | 75 | |||
128 | 76 | if [ ${update_build_dir} -eq 1 ]; then | ||
129 | 77 | BUILD_DIR=build-${target_arch}-${dist} | ||
130 | 78 | fi | ||
131 | 79 | |||
132 | 80 | if [ "${AC_NDK_PATH}" = "" ]; then | ||
133 | 81 | export AC_NDK_PATH=~/.cache/aethercast-${target_arch}-chroot-${dist} | ||
134 | 82 | fi | ||
135 | 83 | |||
136 | 84 | if [ ! -d ${AC_NDK_PATH} ]; then | ||
137 | 85 | echo "no partial chroot dir detected. attempting to create one" | ||
138 | 86 | _do_update_chroot=1 | ||
139 | 87 | fi | ||
140 | 88 | |||
141 | 89 | if [ ! -d ${BUILD_DIR} ]; then | ||
142 | 90 | mkdir ${BUILD_DIR} | ||
143 | 91 | fi | ||
144 | 92 | |||
145 | 93 | echo "Building for distro: $dist" | ||
146 | 94 | echo "Using AC_NDK_PATH: ${AC_NDK_PATH}" | ||
147 | 95 | |||
148 | 96 | additional_repositories= | ||
149 | 97 | if [ ${dist} == "vivid" ] ; then | ||
150 | 98 | additional_repositories="-r http://ppa.launchpad.net/ci-train-ppa-service/stable-phone-overlay/ubuntu -r http://ppa.launchpad.net/ci-train-ppa-service/landing-000/ubuntu" | ||
151 | 99 | fi | ||
152 | 100 | |||
153 | 101 | gcc_variant= | ||
154 | 102 | if [ "${dist}" = "vivid" ]; then | ||
155 | 103 | gcc_variant=-4.9 | ||
156 | 104 | fi | ||
157 | 105 | |||
158 | 106 | case ${target_arch} in | ||
159 | 107 | armhf ) | ||
160 | 108 | target_machine=arm-linux-gnueabihf | ||
161 | 109 | ;; | ||
162 | 110 | amd64 ) | ||
163 | 111 | target_machine=x86_64-linux-gnu | ||
164 | 112 | ;; | ||
165 | 113 | i386 ) | ||
166 | 114 | target_machine=i386-linux-gnu | ||
167 | 115 | ;; | ||
168 | 116 | arm64 ) | ||
169 | 117 | target_machine=aarch64-linux-gnu | ||
170 | 118 | ;; | ||
171 | 119 | ppc64el ) | ||
172 | 120 | target_machine=powerpc64le-linux-gnu | ||
173 | 121 | ;; | ||
174 | 122 | powerpc ) | ||
175 | 123 | target_machine=powerpc-linux-gnu | ||
176 | 124 | ;; | ||
177 | 125 | * ) | ||
178 | 126 | # A good guess (assuming you have dpkg-architecture) | ||
179 | 127 | target_machine=`dpkg-architecture -A${target_arch} -qDEB_HOST_MULTIARCH` || { | ||
180 | 128 | echo "Unknown architecture ${target_arch}" | ||
181 | 129 | usage | ||
182 | 130 | exit 1 | ||
183 | 131 | } | ||
184 | 132 | ;; | ||
185 | 133 | esac | ||
186 | 134 | |||
187 | 135 | echo "Target architecture: ${target_arch}" | ||
188 | 136 | echo "Target machine: ${target_machine}" | ||
189 | 137 | |||
190 | 138 | if [ ${_do_update_chroot} -eq 1 ] ; then | ||
191 | 139 | pushd scripts > /dev/null | ||
192 | 140 | ./setup-partial-armhf-chroot.sh -d ${dist} -a ${target_arch} ${additional_repositories} ${AC_NDK_PATH} | ||
193 | 141 | popd > /dev/null | ||
194 | 142 | # force a clean build after an update, since CMake cache maybe out of date | ||
195 | 143 | clean_build_dir ${BUILD_DIR} | ||
196 | 144 | fi | ||
197 | 145 | |||
198 | 146 | pushd ${BUILD_DIR} > /dev/null | ||
199 | 147 | |||
200 | 148 | export PKG_CONFIG_PATH="${AC_NDK_PATH}/usr/lib/pkgconfig:${AC_NDK_PATH}/usr/lib/${target_machine}/pkgconfig" | ||
201 | 149 | export PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1 | ||
202 | 150 | export PKG_CONFIG_ALLOW_SYSTEM_LIBS=1 | ||
203 | 151 | export PKG_CONFIG_SYSROOT_DIR=$AC_NDK_PATH | ||
204 | 152 | export PKG_CONFIG_EXECUTABLE=`which pkg-config` | ||
205 | 153 | export AC_TARGET_MACHINE=${target_machine} | ||
206 | 154 | export AC_GCC_VARIANT=${gcc_variant} | ||
207 | 155 | echo "Using PKG_CONFIG_PATH: $PKG_CONFIG_PATH" | ||
208 | 156 | echo "Using PKG_CONFIG_EXECUTABLE: $PKG_CONFIG_EXECUTABLE" | ||
209 | 157 | cmake -DCMAKE_TOOLCHAIN_FILE=../cmake/LinuxCrossCompile.cmake \ | ||
210 | 158 | .. | ||
211 | 159 | |||
212 | 160 | make -j${NUM_JOBS} $@ | ||
213 | 161 | |||
214 | 162 | popd > /dev/null | ||
215 | 0 | 163 | ||
216 | === modified file 'debian/control' | |||
217 | --- debian/control 2016-01-21 11:13:32 +0000 | |||
218 | +++ debian/control 2016-02-29 08:26:24 +0000 | |||
219 | @@ -20,7 +20,8 @@ | |||
220 | 20 | libgtest-dev, | 20 | libgtest-dev, |
221 | 21 | libreadline-dev, | 21 | libreadline-dev, |
222 | 22 | libreadline6-dev, | 22 | libreadline6-dev, |
224 | 23 | libwds-dev | 23 | libwds-dev, |
225 | 24 | pkg-config | ||
226 | 24 | Standards-Version: 3.9.4 | 25 | Standards-Version: 3.9.4 |
227 | 25 | Homepage: http://launchpad.net/aethercast | 26 | Homepage: http://launchpad.net/aethercast |
228 | 26 | # If you aren't a member of ~phablet-team but need to upload packaging changes, | 27 | # If you aren't a member of ~phablet-team but need to upload packaging changes, |
229 | 27 | 28 | ||
230 | === added directory 'scripts' | |||
231 | === added file 'scripts/setup-partial-armhf-chroot.sh' | |||
232 | --- scripts/setup-partial-armhf-chroot.sh 1970-01-01 00:00:00 +0000 | |||
233 | +++ scripts/setup-partial-armhf-chroot.sh 2016-02-29 08:26:24 +0000 | |||
234 | @@ -0,0 +1,155 @@ | |||
235 | 1 | #!/bin/bash | ||
236 | 2 | # | ||
237 | 3 | # TODO: Rename this file without "armhf" when it's safe to do so. | ||
238 | 4 | # | ||
239 | 5 | |||
240 | 6 | set -e | ||
241 | 7 | |||
242 | 8 | name=${0} | ||
243 | 9 | |||
244 | 10 | usage() { | ||
245 | 11 | echo "Usage: ${name} [options] mychroot-dir" | ||
246 | 12 | echo "options:" | ||
247 | 13 | echo " -a arch Select architecture, i.e. armhf, arm64, ppc... Default is armhf" | ||
248 | 14 | echo " -d dist Select distribution, i.e. vivid, wily. Default is vivid" | ||
249 | 15 | echo " -r rep Select an additional repository for bootstrap. Default is none" | ||
250 | 16 | echo | ||
251 | 17 | echo "please supply at least a directory to create partial chroot in. (eg, ./setup-partial-armhf-chroot.sh mychroot-dir)" | ||
252 | 18 | } | ||
253 | 19 | |||
254 | 20 | # Default to vivid as we don't seem to have any working wily devices right now. | ||
255 | 21 | # Also Jenkins expects this script to default to vivid (TODO: update CI?) | ||
256 | 22 | arch=armhf | ||
257 | 23 | dist=vivid | ||
258 | 24 | sourceid=0 | ||
259 | 25 | repositories= | ||
260 | 26 | sources= | ||
261 | 27 | |||
262 | 28 | while getopts a:d:r:h opt; do | ||
263 | 29 | case $opt in | ||
264 | 30 | a) | ||
265 | 31 | arch=$OPTARG | ||
266 | 32 | ;; | ||
267 | 33 | d) | ||
268 | 34 | dist=$OPTARG | ||
269 | 35 | ;; | ||
270 | 36 | r) | ||
271 | 37 | repositories="$repositories $OPTARG" | ||
272 | 38 | ((++sourceid)) | ||
273 | 39 | sources="$sources source$sourceid" | ||
274 | 40 | ;; | ||
275 | 41 | :) | ||
276 | 42 | echo "Option -$OPTARG requires an argument" | ||
277 | 43 | usage | ||
278 | 44 | exit 1 | ||
279 | 45 | ;; | ||
280 | 46 | h) | ||
281 | 47 | usage | ||
282 | 48 | exit 0 | ||
283 | 49 | ;; | ||
284 | 50 | \?) | ||
285 | 51 | echo "Invalid option: -$OPTARG" | ||
286 | 52 | usage | ||
287 | 53 | exit 1 | ||
288 | 54 | ;; | ||
289 | 55 | esac | ||
290 | 56 | done | ||
291 | 57 | |||
292 | 58 | shift $((OPTIND-1)) | ||
293 | 59 | |||
294 | 60 | if [ -z ${1} ]; then | ||
295 | 61 | usage | ||
296 | 62 | exit 1 | ||
297 | 63 | fi | ||
298 | 64 | |||
299 | 65 | directory=${1} | ||
300 | 66 | echo "creating phablet-compatible $arch partial chroot for aethercast compilation in directory ${directory}" | ||
301 | 67 | |||
302 | 68 | if [ ! -d ${directory} ]; then | ||
303 | 69 | mkdir -p ${directory} | ||
304 | 70 | fi | ||
305 | 71 | |||
306 | 72 | DEBCONTROL=$(pwd)/../debian/control | ||
307 | 73 | |||
308 | 74 | pushd ${directory} > /dev/null | ||
309 | 75 | |||
310 | 76 | # Empty dpkg status file, so that ALL dependencies are listed with dpkg-checkbuilddeps | ||
311 | 77 | echo "" > status | ||
312 | 78 | |||
313 | 79 | # Manual error code checking is needed for dpkg-checkbuilddeps | ||
314 | 80 | set +e | ||
315 | 81 | |||
316 | 82 | # Parse dependencies from debian/control | ||
317 | 83 | # dpkg-checkbuilddeps returns non-zero when dependencies are not met and the list is sent to stderr | ||
318 | 84 | builddeps=$(dpkg-checkbuilddeps -a ${arch} --admindir=. ${DEBCONTROL} 2>&1 ) | ||
319 | 85 | if [ $? -eq 0 ] ; then | ||
320 | 86 | exit 0 | ||
321 | 87 | fi | ||
322 | 88 | echo "${builddeps}" | ||
323 | 89 | |||
324 | 90 | # now turn exit on error option | ||
325 | 91 | set -e | ||
326 | 92 | |||
327 | 93 | # Sanitize dependencies list for submission to multistrap | ||
328 | 94 | # build-essential is not needed as we are cross-compiling | ||
329 | 95 | builddeps=$(echo ${builddeps} | sed -e 's/dpkg-checkbuilddeps://g' \ | ||
330 | 96 | -e 's/error://g' \ | ||
331 | 97 | -e 's/Unmet build dependencies://g' \ | ||
332 | 98 | -e 's/build-essential:native//g') | ||
333 | 99 | builddeps=$(echo ${builddeps} | sed 's/([^)]*)//g') | ||
334 | 100 | builddeps=$(echo ${builddeps} | sed -e 's/abi-compliance-checker//g') | ||
335 | 101 | builddeps=$(echo ${builddeps} | sed -e 's/multistrap//g') | ||
336 | 102 | |||
337 | 103 | case ${arch} in | ||
338 | 104 | amd64 | i386 ) | ||
339 | 105 | source_url=http://archive.ubuntu.com/ubuntu | ||
340 | 106 | ;; | ||
341 | 107 | * ) | ||
342 | 108 | source_url=http://ports.ubuntu.com/ubuntu-ports | ||
343 | 109 | ;; | ||
344 | 110 | esac | ||
345 | 111 | |||
346 | 112 | echo "[General] | ||
347 | 113 | arch=${arch} | ||
348 | 114 | directory=${directory} | ||
349 | 115 | unpack=false | ||
350 | 116 | noauth=true | ||
351 | 117 | bootstrap=Ubuntu ${sources} | ||
352 | 118 | |||
353 | 119 | [Ubuntu] | ||
354 | 120 | packages=${builddeps} | ||
355 | 121 | source=${source_url} | ||
356 | 122 | suite=${dist} | ||
357 | 123 | " > mstrap.conf | ||
358 | 124 | |||
359 | 125 | sourceid=0 | ||
360 | 126 | for x in ${repositories}; | ||
361 | 127 | do | ||
362 | 128 | ((++sourceid)) | ||
363 | 129 | echo "[source${sourceid}] | ||
364 | 130 | source=${x} | ||
365 | 131 | suite=${dist} | ||
366 | 132 | " >> mstrap.conf | ||
367 | 133 | done | ||
368 | 134 | |||
369 | 135 | multistrap -f mstrap.conf | ||
370 | 136 | |||
371 | 137 | rm -f var/cache/apt/archives/lock | ||
372 | 138 | |||
373 | 139 | # Remove libc libraries that confuse the cross-compiler | ||
374 | 140 | rm -f var/cache/apt/archives/libc-dev*.deb | ||
375 | 141 | rm -f var/cache/apt/archives/libc6*.deb | ||
376 | 142 | |||
377 | 143 | for deb in var/cache/apt/archives/* ; do | ||
378 | 144 | if [ ! -d ${deb} ] ; then | ||
379 | 145 | echo "unpacking: ${deb}" | ||
380 | 146 | dpkg -x ${deb} . | ||
381 | 147 | fi | ||
382 | 148 | done | ||
383 | 149 | |||
384 | 150 | # Fix up symlinks which asssumed the usual root path | ||
385 | 151 | for broken_symlink in $(find . -name \*.so -type l -xtype l) ; do | ||
386 | 152 | ln -sf $(pwd)$(readlink ${broken_symlink}) ${broken_symlink} | ||
387 | 153 | done | ||
388 | 154 | |||
389 | 155 | popd > /dev/null | ||
390 | 0 | 156 | ||
391 | === modified file 'src/CMakeLists.txt' | |||
392 | --- src/CMakeLists.txt 2016-01-21 13:25:31 +0000 | |||
393 | +++ src/CMakeLists.txt 2016-02-29 08:26:24 +0000 | |||
394 | @@ -27,15 +27,15 @@ | |||
395 | 27 | configure_file(w11tng/config.h.in w11tng/config.h @ONLY) | 27 | configure_file(w11tng/config.h.in w11tng/config.h @ONLY) |
396 | 28 | 28 | ||
397 | 29 | set(HEADERS | 29 | set(HEADERS |
404 | 30 | mcs/ip_v4_address.h | 30 | mcs/ip_v4_address.h |
405 | 31 | mcs/keep_alive.h | 31 | mcs/keep_alive.h |
406 | 32 | mcs/mac_address.h | 32 | mcs/mac_address.h |
407 | 33 | mcs/types.h | 33 | mcs/types.h |
408 | 34 | mcs/shared_gobject.h | 34 | mcs/shared_gobject.h |
409 | 35 | mcs/keep_alive.h | 35 | mcs/keep_alive.h |
410 | 36 | mcs/config.h | ||
411 | 36 | 37 | ||
414 | 37 | mcs/config.h | 38 | w11tng/config.h |
413 | 38 | w11tng/config.h | ||
415 | 39 | ) | 39 | ) |
416 | 40 | 40 | ||
417 | 41 | set(SOURCES | 41 | set(SOURCES |
418 | @@ -83,13 +83,6 @@ | |||
419 | 83 | w11tng/hostname1stub.cpp | 83 | w11tng/hostname1stub.cpp |
420 | 84 | ) | 84 | ) |
421 | 85 | 85 | ||
422 | 86 | link_directories( | ||
423 | 87 | ${GLIB_LIBRARY_DIRS} | ||
424 | 88 | ${GIO_LIBRARY_DIRS} | ||
425 | 89 | ${GIO-UNIX_LIBRARY_DIRS} | ||
426 | 90 | ${WDS_LIBRARY_DIRS} | ||
427 | 91 | ) | ||
428 | 92 | |||
429 | 93 | include_directories( | 86 | include_directories( |
430 | 94 | ${Boost_INCLUDE_DIRS} | 87 | ${Boost_INCLUDE_DIRS} |
431 | 95 | ${GLIB_INCLUDE_DIRS} | 88 | ${GLIB_INCLUDE_DIRS} |
432 | @@ -106,12 +99,18 @@ | |||
433 | 106 | add_executable(aethercast mcs/main.cpp) | 99 | add_executable(aethercast mcs/main.cpp) |
434 | 107 | 100 | ||
435 | 108 | target_link_libraries(aethercast-core | 101 | target_link_libraries(aethercast-core |
436 | 102 | ${Boost_LDFLAGS} | ||
437 | 109 | ${Boost_LIBRARIES} | 103 | ${Boost_LIBRARIES} |
438 | 104 | ${GLIB_LDFLAGS} | ||
439 | 110 | ${GLIB_LIBRARIES} | 105 | ${GLIB_LIBRARIES} |
440 | 106 | ${GIO_LDFLAGS} | ||
441 | 111 | ${GIO_LIBRARIES} | 107 | ${GIO_LIBRARIES} |
442 | 108 | ${GIO-UNIX_LDFLAGS} | ||
443 | 112 | ${GIO-UNIX_LIBRARIES} | 109 | ${GIO-UNIX_LIBRARIES} |
444 | 110 | ${GST_LDFLAGS} | ||
445 | 113 | ${GST_LIBRARIES} | 111 | ${GST_LIBRARIES} |
446 | 114 | ${CMAKE_THREAD_LIBS_INIT} | 112 | ${CMAKE_THREAD_LIBS_INIT} |
447 | 113 | ${WDS_LDFLAGS} | ||
448 | 115 | ${WDS_LIBRARIES} | 114 | ${WDS_LIBRARIES} |
449 | 116 | -ldl | 115 | -ldl |
450 | 117 | ) | 116 | ) |
451 | 118 | 117 | ||
452 | === modified file 'src/mcs/basesourcemediamanager.cpp' | |||
453 | --- src/mcs/basesourcemediamanager.cpp 2015-12-07 16:02:43 +0000 | |||
454 | +++ src/mcs/basesourcemediamanager.cpp 2016-02-29 08:26:24 +0000 | |||
455 | @@ -20,7 +20,15 @@ | |||
456 | 20 | #include "basesourcemediamanager.h" | 20 | #include "basesourcemediamanager.h" |
457 | 21 | #include "logger.h" | 21 | #include "logger.h" |
458 | 22 | 22 | ||
459 | 23 | namespace { | ||
460 | 24 | static unsigned int next_session_id = 0; | ||
461 | 25 | } | ||
462 | 26 | |||
463 | 23 | namespace mcs { | 27 | namespace mcs { |
464 | 28 | BaseSourceMediaManager::BaseSourceMediaManager() : | ||
465 | 29 | session_id_(++next_session_id) { | ||
466 | 30 | } | ||
467 | 31 | |||
468 | 24 | wds::SessionType BaseSourceMediaManager::GetSessionType() const { | 32 | wds::SessionType BaseSourceMediaManager::GetSessionType() const { |
469 | 25 | return wds::VideoSession; | 33 | return wds::VideoSession; |
470 | 26 | } | 34 | } |
471 | @@ -102,4 +110,8 @@ | |||
472 | 102 | void BaseSourceMediaManager::SendIDRPicture() { | 110 | void BaseSourceMediaManager::SendIDRPicture() { |
473 | 103 | WARNING("Unimplemented IDR picture request"); | 111 | WARNING("Unimplemented IDR picture request"); |
474 | 104 | } | 112 | } |
475 | 113 | |||
476 | 114 | std::string BaseSourceMediaManager::GetSessionId() const { | ||
477 | 115 | return mcs::Utils::Sprintf("%d", session_id_); | ||
478 | 116 | } | ||
479 | 105 | } // namespace mcs | 117 | } // namespace mcs |
480 | 106 | 118 | ||
481 | === modified file 'src/mcs/basesourcemediamanager.h' | |||
482 | --- src/mcs/basesourcemediamanager.h 2015-11-26 16:48:53 +0000 | |||
483 | +++ src/mcs/basesourcemediamanager.h 2016-02-29 08:26:24 +0000 | |||
484 | @@ -24,6 +24,8 @@ | |||
485 | 24 | class BaseSourceMediaManager : public wds::SourceMediaManager | 24 | class BaseSourceMediaManager : public wds::SourceMediaManager |
486 | 25 | { | 25 | { |
487 | 26 | public: | 26 | public: |
488 | 27 | explicit BaseSourceMediaManager(); | ||
489 | 28 | |||
490 | 27 | void SetSinkRtpPorts(int port1, int port2) override; | 29 | void SetSinkRtpPorts(int port1, int port2) override; |
491 | 28 | std::pair<int,int> GetSinkRtpPorts() const override; | 30 | std::pair<int,int> GetSinkRtpPorts() const override; |
492 | 29 | int GetLocalRtpPort() const override; | 31 | int GetLocalRtpPort() const override; |
493 | @@ -35,6 +37,7 @@ | |||
494 | 35 | bool InitOptimalAudioFormat(const std::vector<wds::AudioCodec>& sink_supported_codecs) override; | 37 | bool InitOptimalAudioFormat(const std::vector<wds::AudioCodec>& sink_supported_codecs) override; |
495 | 36 | wds::AudioCodec GetOptimalAudioFormat() const override; | 38 | wds::AudioCodec GetOptimalAudioFormat() const override; |
496 | 37 | void SendIDRPicture() override; | 39 | void SendIDRPicture() override; |
497 | 40 | std::string GetSessionId() const override; | ||
498 | 38 | 41 | ||
499 | 39 | protected: | 42 | protected: |
500 | 40 | virtual void Configure() = 0; | 43 | virtual void Configure() = 0; |
501 | @@ -43,6 +46,7 @@ | |||
502 | 43 | int sink_port1_; | 46 | int sink_port1_; |
503 | 44 | int sink_port2_; | 47 | int sink_port2_; |
504 | 45 | wds::H264VideoFormat format_; | 48 | wds::H264VideoFormat format_; |
505 | 49 | unsigned int session_id_; | ||
506 | 46 | }; | 50 | }; |
507 | 47 | } // namespace mcs | 51 | } // namespace mcs |
508 | 48 | #endif | 52 | #endif |
509 | 49 | 53 | ||
510 | === modified file 'src/mcs/miracastsourceclient.cpp' | |||
511 | --- src/mcs/miracastsourceclient.cpp 2015-12-09 16:07:13 +0000 | |||
512 | +++ src/mcs/miracastsourceclient.cpp 2016-02-29 08:26:24 +0000 | |||
513 | @@ -85,6 +85,14 @@ | |||
514 | 85 | return local_address_; | 85 | return local_address_; |
515 | 86 | } | 86 | } |
516 | 87 | 87 | ||
517 | 88 | int MiracastSourceClient::GetNextCSeq(int *initial_peer_cseq) const { | ||
518 | 89 | static int send_cseq = 0; | ||
519 | 90 | ++send_cseq; | ||
520 | 91 | if (initial_peer_cseq && send_cseq == *initial_peer_cseq) | ||
521 | 92 | send_cseq *= 2; | ||
522 | 93 | return send_cseq; | ||
523 | 94 | } | ||
524 | 95 | |||
525 | 88 | class TimerCallbackData { | 96 | class TimerCallbackData { |
526 | 89 | public: | 97 | public: |
527 | 90 | TimerCallbackData(MiracastSourceClient *delegate) : | 98 | TimerCallbackData(MiracastSourceClient *delegate) : |
528 | 91 | 99 | ||
529 | === modified file 'src/mcs/miracastsourceclient.h' | |||
530 | --- src/mcs/miracastsourceclient.h 2015-12-07 09:07:50 +0000 | |||
531 | +++ src/mcs/miracastsourceclient.h 2016-02-29 08:26:24 +0000 | |||
532 | @@ -57,6 +57,7 @@ | |||
533 | 57 | std::string GetLocalIPAddress() const override; | 57 | std::string GetLocalIPAddress() const override; |
534 | 58 | uint CreateTimer(int seconds) override; | 58 | uint CreateTimer(int seconds) override; |
535 | 59 | void ReleaseTimer(uint timerId) override; | 59 | void ReleaseTimer(uint timerId) override; |
536 | 60 | int GetNextCSeq(int* initial_peer_cseq = nullptr) const override; | ||
537 | 60 | 61 | ||
538 | 61 | public: | 62 | public: |
539 | 62 | static gboolean OnTimeout(gpointer user_data); | 63 | static gboolean OnTimeout(gpointer user_data); |