summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authoriphydf <iphydf@users.noreply.github.com>2016-09-18 02:18:24 +0100
committeriphydf <iphydf@users.noreply.github.com>2016-09-18 02:18:24 +0100
commitf41b010e9b9459295bd8e030159a27db463cde33 (patch)
treece39afca8076e235f821182efa53a11b7182cd7e /CMakeLists.txt
parent8e43ca834cc0a5b2f904ce2589154c2f17bd12ce (diff)
Only build toxav if opus and vpx are found.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt66
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 )
55pkg_use_module(LIBSODIUM REQUIRED libsodium ) 55pkg_use_module(LIBSODIUM REQUIRED libsodium )
56 56
57# For toxav. 57# For toxav.
58pkg_use_module(OPUS REQUIRED opus ) 58pkg_use_module(OPUS opus )
59pkg_use_module(VPX REQUIRED vpx ) 59pkg_use_module(VPX vpx )
60 60
61# For tox-bootstrapd. 61# For tox-bootstrapd.
62pkg_use_module(LIBCONFIG libconfig ) 62pkg_use_module(LIBCONFIG libconfig )
@@ -69,6 +69,11 @@ pkg_use_module(OPENCV opencv )
69pkg_use_module(PORTAUDIO portaudio-2.0 ) 69pkg_use_module(PORTAUDIO portaudio-2.0 )
70pkg_use_module(SNDFILE sndfile ) 70pkg_use_module(SNDFILE sndfile )
71 71
72if(OPUS_FOUND AND VPX_FOUND)
73 set(BUILD_TOXAV TRUE)
74else()
75 set(BUILD_TOXAV FALSE)
76endif()
72 77
73################################################################################ 78################################################################################
74# 79#
@@ -173,16 +178,18 @@ target_link_modules(toxcore toxgroup)
173# 178#
174################################################################################ 179################################################################################
175 180
176add_module(toxav 181if(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
185target_link_modules(toxav toxcore ${OPUS_LIBRARIES} ${VPX_LIBRARIES}) 190 toxav/video.c)
191 target_link_modules(toxav toxcore ${OPUS_LIBRARIES} ${VPX_LIBRARIES})
192endif()
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()
223endfunction() 232endfunction()
@@ -232,8 +241,10 @@ auto_test(network_test)
232auto_test(onion_test) 241auto_test(onion_test)
233auto_test(skeleton_test) 242auto_test(skeleton_test)
234auto_test(tox_test) 243auto_test(tox_test)
235auto_test(toxav_basic_test) 244if(BUILD_TOXAV)
236auto_test(toxav_many_test) 245 auto_test(toxav_basic_test)
246 auto_test(toxav_many_test)
247endif()
237 248
238 249
239################################################################################ 250################################################################################
@@ -270,7 +281,7 @@ endif()
270# 281#
271################################################################################ 282################################################################################
272 283
273if(NOT WIN32 AND SNDFILE_FOUND AND PORTAUDIO_FOUND AND OPENCV_FOUND) 284if(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
318configure_file( 329if(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 )
335endif()
323 336
324configure_file( 337configure_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
343install(FILES 356install(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")
349install(FILES 361install(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
367if(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")
374endif()