From 8f2401fee64d0b5535bd4d737a1caf2bffa30682 Mon Sep 17 00:00:00 2001 From: sudden6 Date: Mon, 15 May 2017 22:42:15 +0200 Subject: [PATCH] fix(build): add install steps for libfilteraudio on OSX --- CMakeLists.txt | 22 ++++++++++++++++++++-- cmake/Dependencies.cmake | 2 +- osx/qTox-Mac-Deployer-ULTIMATE.sh | 9 ++++++++- src/audio/backend/openal.h | 6 ------ src/audio/backend/openal2.h | 6 ------ 5 files changed, 29 insertions(+), 16 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b53eaa5c3..a644d32da 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,6 +8,7 @@ cmake_minimum_required(VERSION 2.8.11) set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) option(PLATFORM_EXTENSIONS "Enable platform specific extensions, requires extra dependencies" ON) +option(USE_FILTERAUDIO "Enable the echo canceling backend" ON) if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE Debug) @@ -16,6 +17,12 @@ endif() set(ENV{PKG_CONFIG_PATH} ${CMAKE_SOURCE_DIR}/libs/lib/pkgconfig:/opt/ffmpeg/lib/pkgconfig:$ENV{PKG_CONFIG_PATH}) +# necessary to find openal-soft on mac os +if(APPLE) + set(ENV{PKG_CONFIG_PATH} + /usr/local/opt/openal-soft/lib/pkgconfig:$ENV{PKG_CONFIG_PATH}) +endif() + execute_process( COMMAND brew --prefix qt5 OUTPUT_VARIABLE QT_PREFIX_PATH @@ -185,8 +192,6 @@ set(${PROJECT_NAME}_SOURCES src/audio/audio.h src/audio/backend/openal.cpp src/audio/backend/openal.h - src/audio/backend/openal2.cpp - src/audio/backend/openal2.h src/chatlog/chatlinecontent.cpp src/chatlog/chatlinecontent.h src/chatlog/chatlinecontentproxy.cpp @@ -520,6 +525,19 @@ if(${ENABLE_GTK_SYSTRAY}) endif() endif() +if(${USE_FILTERAUDIO}) + search_dependency(FILTERAUDIO LIBRARY filteraudio OPTIONAL) + if(${FILTERAUDIO_FOUND}) + set(${PROJECT_NAME}_SOURCES ${${PROJECT_NAME}_SOURCES} + src/audio/backend/openal2.cpp + src/audio/backend/openal2.h) + add_definitions(-DUSE_FILTERAUDIO=1) + message(STATUS "using filteraudio") + else() + message(STATUS "not using filteraudio, libfilteraudio not found") + endif() +endif() + # the compiler flags for compiling C sources MESSAGE( STATUS "CMAKE_C_FLAGS: " ${CMAKE_C_FLAGS} ) diff --git a/cmake/Dependencies.cmake b/cmake/Dependencies.cmake index 7b828bed9..558c5e44a 100644 --- a/cmake/Dependencies.cmake +++ b/cmake/Dependencies.cmake @@ -116,7 +116,7 @@ if (NOT TOXCORE_FOUND OR search_dependency(TOXAV PACKAGE libtoxav) endif() -search_dependency(OPENAL PACKAGE openal FRAMEWORK OpenAL) +search_dependency(OPENAL PACKAGE openal) search_dependency(FILTERAUDIO LIBRARY filteraudio) if (PLATFORM_EXTENSIONS AND UNIX AND NOT APPLE) diff --git a/osx/qTox-Mac-Deployer-ULTIMATE.sh b/osx/qTox-Mac-Deployer-ULTIMATE.sh index 13708be14..0cae55c39 100755 --- a/osx/qTox-Mac-Deployer-ULTIMATE.sh +++ b/osx/qTox-Mac-Deployer-ULTIMATE.sh @@ -41,6 +41,7 @@ QT_VER=($(ls ${QT_DIR} | sed -n -e 's/^\([0-9]*\.([0-9]*\.([0-9]*\).*/\1/' -e '1 QT_DIR_VER="${QT_DIR}/${QT_VER[1]}" TOXCORE_DIR="${MAIN_DIR}/toxcore" # Change to Git location +FILTERAUIO_DIR="${MAIN_DIR}/filter_audio" # Change to Git location LIB_INSTALL_PREFIX="${QTOX_DIR}/libs" @@ -166,7 +167,13 @@ install() { else brew install cmake fi - brew install ffmpeg qrencode qt5 sqlcipher + brew install ffmpeg qrencode qt5 sqlcipher openal-soft + + fcho "Cloning filter_audio ... " + git clone --branch v0.0.1 --depth=1 https://github.com/irungentoo/filter_audio "$FILTERAUIO_DIR" + cd "$FILTERAUIO_DIR" + fcho "Installing filter_audio ... " + make install PREFIX="$LIB_INSTALL_PREFIX" QT_VER=($(ls ${QT_DIR} | sed -n -e 's/^\([0-9]*\.([0-9]*\.([0-9]*\).*/\1/' -e '1p;$p')) QT_DIR_VER="${QT_DIR}/${QT_VER[1]}" diff --git a/src/audio/backend/openal.h b/src/audio/backend/openal.h index d11738ae6..40a3eef91 100644 --- a/src/audio/backend/openal.h +++ b/src/audio/backend/openal.h @@ -32,14 +32,8 @@ #include -#if defined(__APPLE__) && defined(__MACH__) -#include -#include -#else #include #include -#endif - #ifndef ALC_ALL_DEVICES_SPECIFIER // compatibility with older versions of OpenAL diff --git a/src/audio/backend/openal2.h b/src/audio/backend/openal2.h index b6c82e7c4..28d0eaf9c 100644 --- a/src/audio/backend/openal2.h +++ b/src/audio/backend/openal2.h @@ -32,15 +32,9 @@ #include -#if defined(__APPLE__) && defined(__MACH__) -#include -#include -#include -#else #include #include #include -#endif extern "C" { #include