diff options
author | iphydf <iphydf@users.noreply.github.com> | 2016-09-18 02:18:24 +0100 |
---|---|---|
committer | iphydf <iphydf@users.noreply.github.com> | 2016-09-18 02:18:24 +0100 |
commit | f41b010e9b9459295bd8e030159a27db463cde33 (patch) | |
tree | ce39afca8076e235f821182efa53a11b7182cd7e /CMakeLists.txt | |
parent | 8e43ca834cc0a5b2f904ce2589154c2f17bd12ce (diff) |
Only build toxav if opus and vpx are found.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 66 |
1 files changed, 43 insertions, 23 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 67b55390..aec584a2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt | |||
@@ -55,8 +55,8 @@ find_library(RT_LIBRARIES rt ) | |||
55 | pkg_use_module(LIBSODIUM REQUIRED libsodium ) | 55 | pkg_use_module(LIBSODIUM REQUIRED libsodium ) |
56 | 56 | ||
57 | # For toxav. | 57 | # For toxav. |
58 | pkg_use_module(OPUS REQUIRED opus ) | 58 | pkg_use_module(OPUS opus ) |
59 | pkg_use_module(VPX REQUIRED vpx ) | 59 | pkg_use_module(VPX vpx ) |
60 | 60 | ||
61 | # For tox-bootstrapd. | 61 | # For tox-bootstrapd. |
62 | pkg_use_module(LIBCONFIG libconfig ) | 62 | pkg_use_module(LIBCONFIG libconfig ) |
@@ -69,6 +69,11 @@ pkg_use_module(OPENCV opencv ) | |||
69 | pkg_use_module(PORTAUDIO portaudio-2.0 ) | 69 | pkg_use_module(PORTAUDIO portaudio-2.0 ) |
70 | pkg_use_module(SNDFILE sndfile ) | 70 | pkg_use_module(SNDFILE sndfile ) |
71 | 71 | ||
72 | if(OPUS_FOUND AND VPX_FOUND) | ||
73 | set(BUILD_TOXAV TRUE) | ||
74 | else() | ||
75 | set(BUILD_TOXAV FALSE) | ||
76 | endif() | ||
72 | 77 | ||
73 | ################################################################################ | 78 | ################################################################################ |
74 | # | 79 | # |
@@ -173,16 +178,18 @@ target_link_modules(toxcore toxgroup) | |||
173 | # | 178 | # |
174 | ################################################################################ | 179 | ################################################################################ |
175 | 180 | ||
176 | add_module(toxav | 181 | if(BUILD_TOXAV) |
177 | toxav/audio.c | 182 | add_module(toxav |
178 | toxav/bwcontroller.c | 183 | toxav/audio.c |
179 | toxav/group.c | 184 | toxav/bwcontroller.c |
180 | toxav/msi.c | 185 | toxav/group.c |
181 | toxav/rtp.c | 186 | toxav/msi.c |
182 | toxav/toxav.c | 187 | toxav/rtp.c |
183 | toxav/toxav_old.c | 188 | toxav/toxav.c |
184 | toxav/video.c) | 189 | toxav/toxav_old.c |
185 | target_link_modules(toxav toxcore ${OPUS_LIBRARIES} ${VPX_LIBRARIES}) | 190 | toxav/video.c) |
191 | target_link_modules(toxav toxcore ${OPUS_LIBRARIES} ${VPX_LIBRARIES}) | ||
192 | endif() | ||
186 | 193 | ||
187 | 194 | ||
188 | ################################################################################ | 195 | ################################################################################ |
@@ -215,9 +222,11 @@ function(auto_test target) | |||
215 | add_executable(auto_${target} auto_tests/${target}.c) | 222 | add_executable(auto_${target} auto_tests/${target}.c) |
216 | target_link_modules(auto_${target} | 223 | target_link_modules(auto_${target} |
217 | toxcore | 224 | toxcore |
218 | toxav | ||
219 | toxencryptsave | 225 | toxencryptsave |
220 | ${CHECK_LIBRARIES}) | 226 | ${CHECK_LIBRARIES}) |
227 | if(BUILD_TOXAV) | ||
228 | target_link_modules(auto_${target} toxav) | ||
229 | endif() | ||
221 | add_test(NAME ${target} COMMAND auto_${target}) | 230 | add_test(NAME ${target} COMMAND auto_${target}) |
222 | endif() | 231 | endif() |
223 | endfunction() | 232 | endfunction() |
@@ -232,8 +241,10 @@ auto_test(network_test) | |||
232 | auto_test(onion_test) | 241 | auto_test(onion_test) |
233 | auto_test(skeleton_test) | 242 | auto_test(skeleton_test) |
234 | auto_test(tox_test) | 243 | auto_test(tox_test) |
235 | auto_test(toxav_basic_test) | 244 | if(BUILD_TOXAV) |
236 | auto_test(toxav_many_test) | 245 | auto_test(toxav_basic_test) |
246 | auto_test(toxav_many_test) | ||
247 | endif() | ||
237 | 248 | ||
238 | 249 | ||
239 | ################################################################################ | 250 | ################################################################################ |
@@ -270,7 +281,7 @@ endif() | |||
270 | # | 281 | # |
271 | ################################################################################ | 282 | ################################################################################ |
272 | 283 | ||
273 | if(NOT WIN32 AND SNDFILE_FOUND AND PORTAUDIO_FOUND AND OPENCV_FOUND) | 284 | if(NOT WIN32 AND BUILD_TOXAV AND SNDFILE_FOUND AND PORTAUDIO_FOUND AND OPENCV_FOUND) |
274 | add_executable(av_test testing/av_test.c) | 285 | add_executable(av_test testing/av_test.c) |
275 | target_link_modules(av_test | 286 | target_link_modules(av_test |
276 | toxav | 287 | toxav |
@@ -315,11 +326,13 @@ endif() | |||
315 | # | 326 | # |
316 | ################################################################################ | 327 | ################################################################################ |
317 | 328 | ||
318 | configure_file( | 329 | if(BUILD_TOXAV) |
319 | "${CMAKE_SOURCE_DIR}/other/pkgconfig/toxav.pc.in" | 330 | configure_file( |
320 | "${CMAKE_BINARY_DIR}/toxav.pc" | 331 | "${CMAKE_SOURCE_DIR}/other/pkgconfig/toxav.pc.in" |
321 | @ONLY | 332 | "${CMAKE_BINARY_DIR}/toxav.pc" |
322 | ) | 333 | @ONLY |
334 | ) | ||
335 | endif() | ||
323 | 336 | ||
324 | configure_file( | 337 | configure_file( |
325 | "${CMAKE_SOURCE_DIR}/other/pkgconfig/toxcore.pc.in" | 338 | "${CMAKE_SOURCE_DIR}/other/pkgconfig/toxcore.pc.in" |
@@ -341,14 +354,21 @@ configure_file( | |||
341 | 354 | ||
342 | 355 | ||
343 | install(FILES | 356 | install(FILES |
344 | ${CMAKE_BINARY_DIR}/toxav.pc | ||
345 | ${CMAKE_BINARY_DIR}/toxcore.pc | 357 | ${CMAKE_BINARY_DIR}/toxcore.pc |
346 | ${CMAKE_BINARY_DIR}/toxdns.pc | 358 | ${CMAKE_BINARY_DIR}/toxdns.pc |
347 | ${CMAKE_BINARY_DIR}/toxencryptsave.pc | 359 | ${CMAKE_BINARY_DIR}/toxencryptsave.pc |
348 | DESTINATION "lib/pkgconfig") | 360 | DESTINATION "lib/pkgconfig") |
349 | install(FILES | 361 | install(FILES |
350 | toxav/toxav.h | ||
351 | toxcore/tox.h | 362 | toxcore/tox.h |
352 | toxdns/toxdns.h | 363 | toxdns/toxdns.h |
353 | toxencryptsave/toxencryptsave.h | 364 | toxencryptsave/toxencryptsave.h |
354 | DESTINATION "include/tox") | 365 | DESTINATION "include/tox") |
366 | |||
367 | if(BUILD_TOXAV) | ||
368 | install(FILES | ||
369 | ${CMAKE_BINARY_DIR}/toxav.pc | ||
370 | DESTINATION "lib/pkgconfig") | ||
371 | install(FILES | ||
372 | toxav/toxav.h | ||
373 | DESTINATION "include/tox") | ||
374 | endif() | ||