use the system RtAudio on Linux

This commit is contained in:
Stefan Talpalaru 2016-09-02 17:54:23 +02:00
parent 27046a51e4
commit 03eb22a5c7
No known key found for this signature in database
GPG Key ID: CBF7934204F1B6F9
2 changed files with 65 additions and 43 deletions

View File

@ -177,48 +177,26 @@ ENDIF (WIN32)
IF (UNIX AND NOT APPLE) IF (UNIX AND NOT APPLE)
set(BUILD_DEB OFF CACHE BOOL "Build DEB") set(BUILD_DEB OFF CACHE BOOL "Build DEB")
SET(USE_AUDIO_PULSE ON CACHE BOOL "Use Pulse Audio")
SET(USE_AUDIO_JACK OFF CACHE BOOL "Use Jack Audio")
SET(USE_AUDIO_ALSA OFF CACHE BOOL "Use ALSA Audio")
SET(USE_AUDIO_OSS OFF CACHE BOOL "Use OSS Audio")
SET(LIQUID_LIB liquid) SET(LIQUID_LIB liquid)
SET(OTHER_LIBRARIES ${OTHER_LIBRARIES} dl) SET(OTHER_LIBRARIES ${OTHER_LIBRARIES} dl)
IF(USE_AUDIO_PULSE) # use the system RtAudio which in turn provides OSS, ALSA, JACK,
SET (OTHER_LIBRARIES ${OTHER_LIBRARIES} pulse-simple pulse) # PulseAudio support depending on how it was compiled
ADD_DEFINITIONS( find_package(RtAudio)
-D__LINUX_PULSE__ SET(OTHER_LIBRARIES ${OTHER_LIBRARIES} ${RTAUDIO_LIBRARIES})
ADD_DEFINITIONS(${RTAUDIO_DEFINITIONS})
include_directories(${RTAUDIO_INCLUDE_DIR})
ELSE(UNIX AND NOT APPLE)
SET (cubicsdr_sources
${cubicsdr_sources}
external/rtaudio/RtAudio.cpp
) )
ENDIF(USE_AUDIO_PULSE) SET (cubicsdr_headers
${cubicsdr_headers}
IF(USE_AUDIO_JACK) external/rtaudio/RtAudio.h
find_package(Jack)
SET (OTHER_LIBRARIES ${OTHER_LIBRARIES} ${JACK_LIBRARIES})
ADD_DEFINITIONS(
-D__UNIX_JACK__
) )
include_directories(${JACK_INCLUDE_DIRS}) SOURCE_GROUP("_ext-RTAudio" REGULAR_EXPRESSION "external/rtaudio/.*${REG_EXT}")
ENDIF(USE_AUDIO_JACK) include_directories(${PROJECT_SOURCE_DIR}/external/rtaudio)
IF(USE_AUDIO_ALSA)
SET (OTHER_LIBRARIES ${OTHER_LIBRARIES} asound)
set(ALSA_INCLUDE_DIR "/usr/include" CACHE FILEPATH "ALSA include path")
include_directories(${ALSA_INCLUDE_DIR})
set(ALSA_LIB_DIR "/usr/lib" CACHE FILEPATH "ALSA lib path")
link_directories(${ALSA_LIB_DIR})
ADD_DEFINITIONS(
-D__LINUX_ALSA__
)
ENDIF(USE_AUDIO_ALSA)
IF(USE_AUDIO_OSS)
SET (OTHER_LIBRARIES ${OTHER_LIBRARIES} oss)
ADD_DEFINITIONS(
-D__LINUX_OSS__
)
ENDIF(USE_AUDIO_OSS)
ENDIF(UNIX AND NOT APPLE) ENDIF(UNIX AND NOT APPLE)
IF (APPLE) IF (APPLE)
@ -304,7 +282,6 @@ SET (cubicsdr_sources
src/forms/SDRDevices/SDRDevicesForm.cpp src/forms/SDRDevices/SDRDevicesForm.cpp
src/forms/SDRDevices/SDRDeviceAdd.cpp src/forms/SDRDevices/SDRDeviceAdd.cpp
src/forms/SDRDevices/SDRDeviceAddForm.cpp src/forms/SDRDevices/SDRDeviceAddForm.cpp
external/rtaudio/RtAudio.cpp
external/lodepng/lodepng.cpp external/lodepng/lodepng.cpp
external/tinyxml/tinyxml.cpp external/tinyxml/tinyxml.cpp
external/tinyxml/tinystr.cpp external/tinyxml/tinystr.cpp
@ -408,7 +385,6 @@ SET (cubicsdr_headers
src/forms/SDRDevices/SDRDevicesForm.h src/forms/SDRDevices/SDRDevicesForm.h
src/forms/SDRDevices/SDRDeviceAdd.h src/forms/SDRDevices/SDRDeviceAdd.h
src/forms/SDRDevices/SDRDeviceAddForm.h src/forms/SDRDevices/SDRDeviceAddForm.h
external/rtaudio/RtAudio.h
external/lodepng/lodepng.h external/lodepng/lodepng.h
external/tinyxml/tinyxml.h external/tinyxml/tinyxml.h
external/tinyxml/tinystr.h external/tinyxml/tinystr.h
@ -512,7 +488,6 @@ SOURCE_GROUP("Visual" REGULAR_EXPRESSION "src/visual/${REG_EXT}")
SOURCE_GROUP("Panel" REGULAR_EXPRESSION "src/panel/${REG_EXT}") SOURCE_GROUP("Panel" REGULAR_EXPRESSION "src/panel/${REG_EXT}")
SOURCE_GROUP("Process" REGULAR_EXPRESSION "src/process/${REG_EXT}") SOURCE_GROUP("Process" REGULAR_EXPRESSION "src/process/${REG_EXT}")
SOURCE_GROUP("UI" REGULAR_EXPRESSION "src/ui/${REG_EXT}") SOURCE_GROUP("UI" REGULAR_EXPRESSION "src/ui/${REG_EXT}")
SOURCE_GROUP("_ext-RTAudio" REGULAR_EXPRESSION "external/rtaudio/.*${REG_EXT}")
SOURCE_GROUP("_ext-LodePNG" REGULAR_EXPRESSION "external/lodepng/.*${REG_EXT}") SOURCE_GROUP("_ext-LodePNG" REGULAR_EXPRESSION "external/lodepng/.*${REG_EXT}")
SOURCE_GROUP("_ext-TinyXML" REGULAR_EXPRESSION "external/tinyxml/.*${REG_EXT}") SOURCE_GROUP("_ext-TinyXML" REGULAR_EXPRESSION "external/tinyxml/.*${REG_EXT}")
SOURCE_GROUP("_ext-CubicVR2" REGULAR_EXPRESSION "external/cubicvr2/.*${REG_EXT}") SOURCE_GROUP("_ext-CubicVR2" REGULAR_EXPRESSION "external/cubicvr2/.*${REG_EXT}")
@ -534,7 +509,6 @@ include_directories (
${PROJECT_SOURCE_DIR}/src/ui ${PROJECT_SOURCE_DIR}/src/ui
${PROJECT_SOURCE_DIR}/src/rig ${PROJECT_SOURCE_DIR}/src/rig
${PROJECT_SOURCE_DIR}/src ${PROJECT_SOURCE_DIR}/src
${PROJECT_SOURCE_DIR}/external/rtaudio
${PROJECT_SOURCE_DIR}/external/lodepng ${PROJECT_SOURCE_DIR}/external/lodepng
${PROJECT_SOURCE_DIR}/external/tinyxml ${PROJECT_SOURCE_DIR}/external/tinyxml
${PROJECT_SOURCE_DIR}/external/cubicvr2/math ${PROJECT_SOURCE_DIR}/external/cubicvr2/math

View File

@ -0,0 +1,48 @@
# https://github.com/idiap/juicer/blob/master/cmake/FindRtAudio.cmake
#
# Copyright 2015 by Idiap Research Institute
#
# Licensed under 3-clause BSD.
#
# Author(s):
# Phil Garner, November 2015
#
# ...but basically copied from FindSndFile in libube, in turn from the examples
# on the web.
#
#
# Try to find RtAudio
# Once done this will define
# RTAUDIO_FOUND - System has RtAudio
# RTAUDIO_INCLUDE_DIR - The RtAudio include directories
# RTAUDIO_LIBRARIES - The libraries needed to use RtAudio
# RTAUDIO_DEFINITIONS - Compiler switches required for using RtAudio
# RTAUDIO_VERSION_STRING - the version of RtAudio found
#
find_package(PkgConfig)
pkg_check_modules(PC_RTAUDIO rtaudio)
set(RTAUDIO_DEFINITIONS ${PC_RTAUDIO_CFLAGS_OTHER})
set(RTAUDIO_VERSION_STRING ${PC_RTAUDIO_VERSION})
find_path(
RTAUDIO_INCLUDE_DIR RtAudio.h
HINTS ${PC_RTAUDIO_INCLUDEDIR} ${PC_RTAUDIO_INCLUDE_DIRS}
)
find_library(
RTAUDIO_LIBRARIES NAMES rtaudio
HINTS ${PC_RTAUDIO_LIBDIR} ${PC_RTAUDIO_LIBRARY_DIRS}
)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(
RtAudio
REQUIRED_VARS RTAUDIO_LIBRARIES RTAUDIO_INCLUDE_DIR
VERSION_VAR RTAUDIO_VERSION_STRING
)
#mark_as_advanced(RTAUDIO_INCLUDE_DIR RTAUDIO_LIBRARIES)