windows ports: enable PortAudio via pkg-config in CMake build

This commit is contained in:
Matthias Ringwald 2022-11-21 12:30:18 +01:00
parent 07e7c342a4
commit 42c5c5581b
10 changed files with 102 additions and 1 deletions

View File

@ -17,6 +17,20 @@ elseif ("${CMAKE_C_COMPILER_ID}" STREQUAL "MSVC")
# using Visual Studio C++
endif()
# pkgconfig
find_package(PkgConfig REQUIRED)
# portaudio
pkg_check_modules(PORTAUDIO REQUIRED portaudio-2.0)
if(PORTAUDIO_FOUND)
message("HAVE_PORTAUDIO")
include_directories(${PORTAUDIO_INCLUDE_DIRS})
link_directories(${PORTAUDIO_LIBRARY_DIRS})
link_libraries(${PORTAUDIO_LIBRARIES})
# CMake 3.12 - add_compile_definitions(HAVE_PORTAUDIO)
SET(CMAKE_C_FLAGS "-DHAVE_PORTAUDIO")
endif()
# to generate .h from .gatt files
find_package (Python REQUIRED COMPONENTS Interpreter)
include_directories(${CMAKE_CURRENT_BINARY_DIR})

View File

@ -51,6 +51,7 @@
#include "btstack_config.h"
#include "ble/le_device_db_tlv.h"
#include "btstack_audio.h"
#include "btstack_chipset_da145xx.h"
#include "btstack_debug.h"
#include "btstack_event.h"
@ -156,6 +157,11 @@ static void phase2(int status){
const hci_transport_t * transport = hci_transport_h4_instance(uart_driver);
hci_init(transport, (void*) &transport_config);
#ifdef HAVE_PORTAUDIO
btstack_audio_sink_set_instance(btstack_audio_portaudio_sink_get_instance());
btstack_audio_source_set_instance(btstack_audio_portaudio_source_get_instance());
#endif
// inform about BTstack state
hci_event_callback_registration.callback = &packet_handler;
hci_add_event_handler(&hci_event_callback_registration);

View File

@ -17,6 +17,20 @@ elseif ("${CMAKE_C_COMPILER_ID}" STREQUAL "MSVC")
# using Visual Studio C++
endif()
# pkgconfig
find_package(PkgConfig REQUIRED)
# portaudio
pkg_check_modules(PORTAUDIO REQUIRED portaudio-2.0)
if(PORTAUDIO_FOUND)
message("HAVE_PORTAUDIO")
include_directories(${PORTAUDIO_INCLUDE_DIRS})
link_directories(${PORTAUDIO_LIBRARY_DIRS})
link_libraries(${PORTAUDIO_LIBRARIES})
# CMake 3.12 - add_compile_definitions(HAVE_PORTAUDIO)
SET(CMAKE_C_FLAGS "-DHAVE_PORTAUDIO")
endif()
# to generate .h from .gatt files
find_package (Python REQUIRED COMPONENTS Interpreter)
include_directories(${CMAKE_CURRENT_BINARY_DIR})

View File

@ -52,6 +52,7 @@
#include "ble/le_device_db_tlv.h"
#include "bluetooth_company_id.h"
#include "btstack_audio.h"
#include "btstack_chipset_zephyr.h"
#include "btstack_debug.h"
#include "btstack_event.h"
@ -172,6 +173,11 @@ int main(int argc, const char * argv[]){
hci_init(transport, (void*) &config);
hci_set_chipset(btstack_chipset_zephyr_instance());
#ifdef HAVE_PORTAUDIO
btstack_audio_sink_set_instance(btstack_audio_portaudio_sink_get_instance());
btstack_audio_source_set_instance(btstack_audio_portaudio_source_get_instance());
#endif
// inform about BTstack state
hci_event_callback_registration.callback = &packet_handler;
hci_add_event_handler(&hci_event_callback_registration);

View File

@ -17,6 +17,20 @@ elseif ("${CMAKE_C_COMPILER_ID}" STREQUAL "MSVC")
# using Visual Studio C++
endif()
# pkgconfig
find_package(PkgConfig REQUIRED)
# portaudio
pkg_check_modules(PORTAUDIO REQUIRED portaudio-2.0)
if(PORTAUDIO_FOUND)
message("HAVE_PORTAUDIO")
include_directories(${PORTAUDIO_INCLUDE_DIRS})
link_directories(${PORTAUDIO_LIBRARY_DIRS})
link_libraries(${PORTAUDIO_LIBRARIES})
# CMake 3.12 - add_compile_definitions(HAVE_PORTAUDIO)
SET(CMAKE_C_FLAGS "-DHAVE_PORTAUDIO")
endif()
# to generate .h from .gatt files
find_package (Python REQUIRED COMPONENTS Interpreter)
include_directories(${CMAKE_CURRENT_BINARY_DIR})

View File

@ -46,6 +46,7 @@
#include "ble/le_device_db_tlv.h"
#include "bluetooth_company_id.h"
#include "btstack_audio.h"
#include "btstack_chipset_bcm.h"
#include "btstack_chipset_cc256x.h"
#include "btstack_chipset_csr.h"
@ -253,6 +254,11 @@ int main(int argc, const char * argv[]){
const hci_transport_t * transport = hci_transport_h4_instance(uart_driver);
hci_init(transport, (void*) &config);
#ifdef HAVE_PORTAUDIO
btstack_audio_sink_set_instance(btstack_audio_portaudio_sink_get_instance());
btstack_audio_source_set_instance(btstack_audio_portaudio_source_get_instance());
#endif
// inform about BTstack state
hci_event_callback_registration.callback = &packet_handler;
hci_add_event_handler(&hci_event_callback_registration);

View File

@ -17,6 +17,20 @@ elseif ("${CMAKE_C_COMPILER_ID}" STREQUAL "MSVC")
# using Visual Studio C++
endif()
# pkgconfig
find_package(PkgConfig REQUIRED)
# portaudio
pkg_check_modules(PORTAUDIO REQUIRED portaudio-2.0)
if(PORTAUDIO_FOUND)
message("HAVE_PORTAUDIO")
include_directories(${PORTAUDIO_INCLUDE_DIRS})
link_directories(${PORTAUDIO_LIBRARY_DIRS})
link_libraries(${PORTAUDIO_LIBRARIES})
# CMake 3.12 - add_compile_definitions(HAVE_PORTAUDIO)
SET(CMAKE_C_FLAGS "-DHAVE_PORTAUDIO")
endif()
# Generate .h from .gatt files
find_package (Python COMPONENTS Interpreter)
include_directories(${CMAKE_CURRENT_BINARY_DIR})

View File

@ -51,6 +51,7 @@
#include "btstack_config.h"
#include "ble/le_device_db_tlv.h"
#include "btstack_audio.h"
#include "btstack_chipset_intel_firmware.h"
#include "btstack_debug.h"
#include "btstack_event.h"
@ -140,6 +141,11 @@ static void intel_firmware_done(int result){
// init HCI
hci_init(transport, NULL);
#ifdef HAVE_PORTAUDIO
btstack_audio_sink_set_instance(btstack_audio_portaudio_sink_get_instance());
btstack_audio_source_set_instance(btstack_audio_portaudio_source_get_instance());
#endif
// inform about BTstack state
hci_event_callback_registration.callback = &packet_handler;
hci_add_event_handler(&hci_event_callback_registration);

View File

@ -17,6 +17,20 @@ elseif ("${CMAKE_C_COMPILER_ID}" STREQUAL "MSVC")
# using Visual Studio C++
endif()
# pkgconfig
find_package(PkgConfig REQUIRED)
# portaudio
pkg_check_modules(PORTAUDIO REQUIRED portaudio-2.0)
if(PORTAUDIO_FOUND)
message("HAVE_PORTAUDIO")
include_directories(${PORTAUDIO_INCLUDE_DIRS})
link_directories(${PORTAUDIO_LIBRARY_DIRS})
link_libraries(${PORTAUDIO_LIBRARIES})
# CMake 3.12 - add_compile_definitions(HAVE_PORTAUDIO)
SET(CMAKE_C_FLAGS "-DHAVE_PORTAUDIO")
endif()
# to generate .h from .gatt files
find_package (Python REQUIRED COMPONENTS Interpreter)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
@ -51,13 +65,14 @@ file(GLOB SOURCES_RIJNDAEL "../../3rd-party/rijndael/rijndael.c")
file(GLOB SOURCES_WINDOWS "../../platform/windows/*.c")
file(GLOB SOURCES_ZEPHYR "../../chipset/zephyr/*.c")
file(GLOB SOURCES_LC3_GOOGLE "../../3rd-party/lc3-google/src/*.c")
file(GLOB SOURCES_PORT "*.c")
file(GLOB SOURCES_PORT "main.c" "../../platform/posix/btstack_audio_portaudio.c")
file(GLOB SOURCES_YXML "../../3rd-party/yxml/yxml.c")
file(GLOB SOURCES_BLE_OFF "../../src/ble/le_device_db_memory.c")
list(REMOVE_ITEM SOURCES_BLE ${SOURCES_BLE_OFF})
set(SOURCES
${SOURCES_BLE}
${SOURCES_BLUEDROID}

View File

@ -52,6 +52,7 @@
#include "btstack_config.h"
#include "ble/le_device_db_tlv.h"
#include "btstack_audio.h"
#include "btstack_debug.h"
#include "btstack_event.h"
#include "btstack_memory.h"
@ -147,6 +148,11 @@ int main(int argc, const char * argv[]){
// init HCI
hci_init(hci_transport_usb_instance(), NULL);
#ifdef HAVE_PORTAUDIO
btstack_audio_sink_set_instance(btstack_audio_portaudio_sink_get_instance());
btstack_audio_source_set_instance(btstack_audio_portaudio_source_get_instance());
#endif
// inform about BTstack state
hci_event_callback_registration.callback = &packet_handler;
hci_add_event_handler(&hci_event_callback_registration);