Only build toxav if opus and vpx are found.

This commit is contained in:
iphydf 2016-09-18 02:18:24 +01:00
parent 8e43ca834c
commit f41b010e9b
No known key found for this signature in database
GPG Key ID: 3855DBA2D74403C9

View File

@ -55,8 +55,8 @@ find_library(RT_LIBRARIES rt )
pkg_use_module(LIBSODIUM REQUIRED libsodium ) pkg_use_module(LIBSODIUM REQUIRED libsodium )
# For toxav. # For toxav.
pkg_use_module(OPUS REQUIRED opus ) pkg_use_module(OPUS opus )
pkg_use_module(VPX REQUIRED vpx ) pkg_use_module(VPX vpx )
# For tox-bootstrapd. # For tox-bootstrapd.
pkg_use_module(LIBCONFIG libconfig ) pkg_use_module(LIBCONFIG libconfig )
@ -69,6 +69,11 @@ pkg_use_module(OPENCV opencv )
pkg_use_module(PORTAUDIO portaudio-2.0 ) pkg_use_module(PORTAUDIO portaudio-2.0 )
pkg_use_module(SNDFILE sndfile ) pkg_use_module(SNDFILE sndfile )
if(OPUS_FOUND AND VPX_FOUND)
set(BUILD_TOXAV TRUE)
else()
set(BUILD_TOXAV FALSE)
endif()
################################################################################ ################################################################################
# #
@ -173,16 +178,18 @@ target_link_modules(toxcore toxgroup)
# #
################################################################################ ################################################################################
add_module(toxav if(BUILD_TOXAV)
toxav/audio.c add_module(toxav
toxav/bwcontroller.c toxav/audio.c
toxav/group.c toxav/bwcontroller.c
toxav/msi.c toxav/group.c
toxav/rtp.c toxav/msi.c
toxav/toxav.c toxav/rtp.c
toxav/toxav_old.c toxav/toxav.c
toxav/video.c) toxav/toxav_old.c
target_link_modules(toxav toxcore ${OPUS_LIBRARIES} ${VPX_LIBRARIES}) toxav/video.c)
target_link_modules(toxav toxcore ${OPUS_LIBRARIES} ${VPX_LIBRARIES})
endif()
################################################################################ ################################################################################
@ -215,9 +222,11 @@ function(auto_test target)
add_executable(auto_${target} auto_tests/${target}.c) add_executable(auto_${target} auto_tests/${target}.c)
target_link_modules(auto_${target} target_link_modules(auto_${target}
toxcore toxcore
toxav
toxencryptsave toxencryptsave
${CHECK_LIBRARIES}) ${CHECK_LIBRARIES})
if(BUILD_TOXAV)
target_link_modules(auto_${target} toxav)
endif()
add_test(NAME ${target} COMMAND auto_${target}) add_test(NAME ${target} COMMAND auto_${target})
endif() endif()
endfunction() endfunction()
@ -232,8 +241,10 @@ auto_test(network_test)
auto_test(onion_test) auto_test(onion_test)
auto_test(skeleton_test) auto_test(skeleton_test)
auto_test(tox_test) auto_test(tox_test)
auto_test(toxav_basic_test) if(BUILD_TOXAV)
auto_test(toxav_many_test) auto_test(toxav_basic_test)
auto_test(toxav_many_test)
endif()
################################################################################ ################################################################################
@ -270,7 +281,7 @@ endif()
# #
################################################################################ ################################################################################
if(NOT WIN32 AND SNDFILE_FOUND AND PORTAUDIO_FOUND AND OPENCV_FOUND) if(NOT WIN32 AND BUILD_TOXAV AND SNDFILE_FOUND AND PORTAUDIO_FOUND AND OPENCV_FOUND)
add_executable(av_test testing/av_test.c) add_executable(av_test testing/av_test.c)
target_link_modules(av_test target_link_modules(av_test
toxav toxav
@ -315,11 +326,13 @@ endif()
# #
################################################################################ ################################################################################
configure_file( if(BUILD_TOXAV)
"${CMAKE_SOURCE_DIR}/other/pkgconfig/toxav.pc.in" configure_file(
"${CMAKE_BINARY_DIR}/toxav.pc" "${CMAKE_SOURCE_DIR}/other/pkgconfig/toxav.pc.in"
@ONLY "${CMAKE_BINARY_DIR}/toxav.pc"
) @ONLY
)
endif()
configure_file( configure_file(
"${CMAKE_SOURCE_DIR}/other/pkgconfig/toxcore.pc.in" "${CMAKE_SOURCE_DIR}/other/pkgconfig/toxcore.pc.in"
@ -341,14 +354,21 @@ configure_file(
install(FILES install(FILES
${CMAKE_BINARY_DIR}/toxav.pc
${CMAKE_BINARY_DIR}/toxcore.pc ${CMAKE_BINARY_DIR}/toxcore.pc
${CMAKE_BINARY_DIR}/toxdns.pc ${CMAKE_BINARY_DIR}/toxdns.pc
${CMAKE_BINARY_DIR}/toxencryptsave.pc ${CMAKE_BINARY_DIR}/toxencryptsave.pc
DESTINATION "lib/pkgconfig") DESTINATION "lib/pkgconfig")
install(FILES install(FILES
toxav/toxav.h
toxcore/tox.h toxcore/tox.h
toxdns/toxdns.h toxdns/toxdns.h
toxencryptsave/toxencryptsave.h toxencryptsave/toxencryptsave.h
DESTINATION "include/tox") DESTINATION "include/tox")
if(BUILD_TOXAV)
install(FILES
${CMAKE_BINARY_DIR}/toxav.pc
DESTINATION "lib/pkgconfig")
install(FILES
toxav/toxav.h
DESTINATION "include/tox")
endif()