Add cmake to find rtaudio library

pull/53/head
michal.szwaj 2018-03-24 01:16:04 +01:00
parent e4771d0d1c
commit 023c7619c7
2 changed files with 73 additions and 0 deletions

View File

@ -32,6 +32,7 @@ find_package(libusb-1.0 REQUIRED)
find_package(Qt5 COMPONENTS Multimedia MultimediaWidgets Bluetooth)
find_package(Protobuf REQUIRED)
find_package(OpenSSL REQUIRED)
find_package(rtaudio REQUIRED)
if(WIN32)
set(WINSOCK2_LIBRARIES "ws2_32")
@ -54,6 +55,7 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR}
${LIBUSB_1_INCLUDE_DIRS}
${PROTOBUF_INCLUDE_DIR}
${OPENSSL_INCLUDE_DIR}
${RTAUDIO_INCLUDE_DIRS}
${AASDK_PROTO_INCLUDE_DIRS}
${AASDK_INCLUDE_DIRS}
${BCM_HOST_INCLUDE_DIRS}
@ -80,6 +82,7 @@ target_link_libraries(autoapp
${BCM_HOST_LIBRARIES}
${ILCLIENT_LIBRARIES}
${WINSOCK2_LIBRARIES}
${RTAUDIO_LIBRARIES}
${AASDK_PROTO_LIBRARIES}
${AASDK_LIBRARIES})

View File

@ -0,0 +1,70 @@
#
# This file is part of openauto project.
# Copyright (C) 2018 f1x.studio (Michal Szwaj)
#
# openauto is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
# openauto is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with openauto. If not, see <http://www.gnu.org/licenses/>.
#
if (RTAUDIO_LIBRARIES AND RTAUDIO_INCLUDE_DIRS)
# in cache already
set(RTAUDIO_FOUND TRUE)
else (RTAUDIO_LIBRARIES AND RTAUDIO_INCLUDE_DIRS)
find_path(RTAUDIO_INCLUDE_DIR
NAMES
RtAudio.h
PATHS
/usr/include
/usr/local/include
/opt/local/include
/sw/include
PATH_SUFFIXES
rtaudio
)
find_library(RTAUDIO_LIBRARY
NAMES
rtaudio
PATHS
/usr/lib
/usr/local/lib
/opt/local/lib
/sw/lib
)
set(RTAUDIO_INCLUDE_DIRS
${RTAUDIO_INCLUDE_DIR}
)
set(RTAUDIO_LIBRARIES
${RTAUDIO_LIBRARY}
)
if (RTAUDIO_INCLUDE_DIRS AND RTAUDIO_LIBRARIES)
set(RTAUDIO_FOUND TRUE)
endif (RTAUDIO_INCLUDE_DIRS AND RTAUDIO_LIBRARIES)
if (RTAUDIO_FOUND)
if (NOT rtaudio_FIND_QUIETLY)
message(STATUS "Found rtaudio:")
message(STATUS " - Includes: ${RTAUDIO_INCLUDE_DIRS}")
message(STATUS " - Libraries: ${RTAUDIO_LIBRARIES}")
endif (NOT rtaudio_FIND_QUIETLY)
else (RTAUDIO_FOUND)
if (rtaudio_FIND_REQUIRED)
message(FATAL_ERROR "Could not find rtaudio")
endif (rtaudio_FIND_REQUIRED)
endif (RTAUDIO_FOUND)
mark_as_advanced(RTAUDIO_INCLUDE_DIRS RTAUDIO_LIBRARIES)
endif (RTAUDIO_LIBRARIES AND RTAUDIO_INCLUDE_DIRS)