-
Notifications
You must be signed in to change notification settings - Fork 3
/
CMakeLists.txt
174 lines (142 loc) · 4.48 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
########################################################################
# Build Soapy SDR support module for Audio Devices
########################################################################
cmake_minimum_required(VERSION 2.8.7)
project(SoapyAudio CXX)
find_package(SoapySDR "0.4.0" NO_MODULE REQUIRED)
if (NOT SoapySDR_FOUND)
message(FATAL_ERROR "Soapy SDR development files not found...")
endif ()
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/")
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
option(USE_HAMLIB OFF "Support hamlib for radio control functions.")
if (USE_HAMLIB)
find_package(hamlib REQUIRED)
if (NOT hamlib_FOUND)
message(FATAL_ERROR "hamlib development files not found...")
endif ()
include_directories(${hamlib_INCLUDE_DIRS})
if (${hamlib_STATIC_FOUND})
link_libraries(${hamlib_STATIC_LIBRARIES})
else()
link_libraries(${hamlib_LIBRARIES})
endif()
ADD_DEFINITIONS(-DUSE_HAMLIB)
endif ()
#enable c++11 features
if(CMAKE_COMPILER_IS_GNUCXX)
#C++11 is a required language feature for this project
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-std=c++11" HAS_STD_CXX11)
if(HAS_STD_CXX11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
else(HAS_STD_CXX11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
endif()
#Thread support enabled (not the same as -lpthread)
list(APPEND AUDIO_LIBS -pthread)
#disable warnings for unused parameters
add_definitions(-Wno-unused-parameter)
endif(CMAKE_COMPILER_IS_GNUCXX)
if (APPLE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wc++11-extensions")
endif(APPLE)
find_package(RtAudio)
if (RTAUDIO_FOUND)
SET(AUDIO_LIBS ${AUDIO_LIBS} ${RTAUDIO_LIBRARIES})
ADD_DEFINITIONS(${RTAUDIO_DEFINITIONS})
include_directories(${RTAUDIO_INCLUDE_DIR})
else (RTAUDIO_FOUND)
message(STATUS "Using internal RtAudio library")
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/RtAudio)
set (
RTAUDIO_SOURCES
RtAudio/RtAudio.cpp
RtAudio/RtAudio.h
)
IF (WIN32)
set(USE_AUDIO_DS ON CACHE BOOL "Support DirectSound Audio")
set(USE_AUDIO_WASAPI OFF CACHE BOOL "Support WASAPI Audio")
# TODO:
# set(USE_AUDIO_ASIO OFF CACHE BOOL "Include support for ASIO Audio")
# WASAPI
IF(USE_AUDIO_WASAPI)
ADD_DEFINITIONS(-D__WINDOWS_WASAPI__)
IF (NOT MSVC)
SET(AUDIO_LIBS ${AUDIO_LIBS} -luuid -lksuser)
ENDIF(NOT MSVC)
ENDIF(USE_AUDIO_WASAPI)
# DirectSound
IF (USE_AUDIO_DS)
ADD_DEFINITIONS(-D__WINDOWS_DS__)
IF (MSVC)
SET(AUDIO_LIBS ${AUDIO_LIBS} dsound.lib)
ELSE (MSVC)
SET(AUDIO_LIBS ${AUDIO_LIBS} -ldsound)
ENDIF (MSVC)
ENDIF(USE_AUDIO_DS)
ENDIF (WIN32)
IF (UNIX AND NOT APPLE)
SET(USE_AUDIO_PULSE ON CACHE BOOL "Support Pulse Audio")
SET(USE_AUDIO_JACK OFF CACHE BOOL "Support Jack Audio")
SET(USE_AUDIO_ALSA OFF CACHE BOOL "Support ALSA Audio")
SET(USE_AUDIO_OSS OFF CACHE BOOL "Support OSS Audio")
IF(USE_AUDIO_PULSE)
SET (AUDIO_LIBS ${AUDIO_LIBS} pulse-simple pulse)
ADD_DEFINITIONS(
-D__LINUX_PULSE__
)
ENDIF(USE_AUDIO_PULSE)
IF(USE_AUDIO_JACK)
find_package(Jack)
SET (AUDIO_LIBS ${AUDIO_LIBS} ${JACK_LIBRARIES})
ADD_DEFINITIONS(
-D__UNIX_JACK__
)
include_directories(${JACK_INCLUDE_DIRS})
ENDIF(USE_AUDIO_JACK)
IF(USE_AUDIO_ALSA)
SET (AUDIO_LIBS ${AUDIO_LIBS} 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 (AUDIO_LIBS ${AUDIO_LIBS} oss)
ADD_DEFINITIONS(
-D__LINUX_OSS__
)
ENDIF(USE_AUDIO_OSS)
ENDIF(UNIX AND NOT APPLE)
IF (APPLE)
ADD_DEFINITIONS(
-D__MACOSX_CORE__
)
FIND_LIBRARY(COREAUDIO_LIBRARY CoreAudio)
FIND_LIBRARY(COREFOUNDATION_LIBRARY CoreFoundation)
SET (AUDIO_LIBS ${COREAUDIO_LIBRARY} ${COREFOUNDATION_LIBRARY} ${AUDIO_LIBS} )
ENDIF (APPLE)
endif (RTAUDIO_FOUND)
IF (USE_HAMLIB)
SET (
HAMLIB_SOURCES
RigThread.cpp
RigThread.h
)
ENDIF()
SOAPY_SDR_MODULE_UTIL(
TARGET audioSupport
SOURCES
SoapyAudio.hpp
Registration.cpp
Settings.cpp
Streaming.cpp
${RTAUDIO_SOURCES}
${HAMLIB_SOURCES}
LIBRARIES
${AUDIO_LIBS}
)