Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only build toxav if opus and vpx are found. #144

Merged
merged 1 commit into from
Sep 18, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 43 additions & 23 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ find_library(RT_LIBRARIES rt )
pkg_use_module(LIBSODIUM REQUIRED libsodium )

# For toxav.
pkg_use_module(OPUS REQUIRED opus )
pkg_use_module(VPX REQUIRED vpx )
pkg_use_module(OPUS opus )
pkg_use_module(VPX vpx )

# For tox-bootstrapd.
pkg_use_module(LIBCONFIG libconfig )
Expand All @@ -69,6 +69,11 @@ pkg_use_module(OPENCV opencv )
pkg_use_module(PORTAUDIO portaudio-2.0 )
pkg_use_module(SNDFILE sndfile )

if(OPUS_FOUND AND VPX_FOUND)
set(BUILD_TOXAV TRUE)
else()
set(BUILD_TOXAV FALSE)
endif()

################################################################################
#
Expand Down Expand Up @@ -173,16 +178,18 @@ target_link_modules(toxcore toxgroup)
#
################################################################################

add_module(toxav
toxav/audio.c
toxav/bwcontroller.c
toxav/group.c
toxav/msi.c
toxav/rtp.c
toxav/toxav.c
toxav/toxav_old.c
toxav/video.c)
target_link_modules(toxav toxcore ${OPUS_LIBRARIES} ${VPX_LIBRARIES})
if(BUILD_TOXAV)
add_module(toxav
toxav/audio.c
toxav/bwcontroller.c
toxav/group.c
toxav/msi.c
toxav/rtp.c
toxav/toxav.c
toxav/toxav_old.c
toxav/video.c)
target_link_modules(toxav toxcore ${OPUS_LIBRARIES} ${VPX_LIBRARIES})
endif()


################################################################################
Expand Down Expand Up @@ -215,9 +222,11 @@ function(auto_test target)
add_executable(auto_${target} auto_tests/${target}.c)
target_link_modules(auto_${target}
toxcore
toxav
toxencryptsave
${CHECK_LIBRARIES})
if(BUILD_TOXAV)
target_link_modules(auto_${target} toxav)
endif()
add_test(NAME ${target} COMMAND auto_${target})
endif()
endfunction()
Expand All @@ -232,8 +241,10 @@ auto_test(network_test)
auto_test(onion_test)
auto_test(skeleton_test)
auto_test(tox_test)
auto_test(toxav_basic_test)
auto_test(toxav_many_test)
if(BUILD_TOXAV)
auto_test(toxav_basic_test)
auto_test(toxav_many_test)
endif()


################################################################################
Expand Down Expand Up @@ -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)
target_link_modules(av_test
toxav
Expand Down Expand Up @@ -315,11 +326,13 @@ endif()
#
################################################################################

configure_file(
"${CMAKE_SOURCE_DIR}/other/pkgconfig/toxav.pc.in"
"${CMAKE_BINARY_DIR}/toxav.pc"
@ONLY
)
if(BUILD_TOXAV)
configure_file(
"${CMAKE_SOURCE_DIR}/other/pkgconfig/toxav.pc.in"
"${CMAKE_BINARY_DIR}/toxav.pc"
@ONLY
)
endif()

configure_file(
"${CMAKE_SOURCE_DIR}/other/pkgconfig/toxcore.pc.in"
Expand All @@ -341,14 +354,21 @@ configure_file(


install(FILES
${CMAKE_BINARY_DIR}/toxav.pc
${CMAKE_BINARY_DIR}/toxcore.pc
${CMAKE_BINARY_DIR}/toxdns.pc
${CMAKE_BINARY_DIR}/toxencryptsave.pc
DESTINATION "lib/pkgconfig")
install(FILES
toxav/toxav.h
toxcore/tox.h
toxdns/toxdns.h
toxencryptsave/toxencryptsave.h
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()