From 023c7619c7680ca3d69500e662c2fb396a3b6384 Mon Sep 17 00:00:00 2001 From: "michal.szwaj" Date: Sat, 24 Mar 2018 01:16:04 +0100 Subject: [PATCH] Add cmake to find rtaudio library --- CMakeLists.txt | 3 ++ cmake_modules/Findrtaudio.cmake | 70 +++++++++++++++++++++++++++++++++ 2 files changed, 73 insertions(+) create mode 100644 cmake_modules/Findrtaudio.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 7a530db..fc87b2e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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}) diff --git a/cmake_modules/Findrtaudio.cmake b/cmake_modules/Findrtaudio.cmake new file mode 100644 index 0000000..60b9384 --- /dev/null +++ b/cmake_modules/Findrtaudio.cmake @@ -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 . +# + +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)