forked from PortAudio/portaudio
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
466 lines (419 loc) · 18 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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
cmake_minimum_required(VERSION 3.1.0)
project(PortAudio VERSION 19.8)
#
# General PortAudio stuff
#
option(PA_BUILD_SHARED_LIBS "Build dynamic library" ${BUILD_SHARED_LIBS})
option(PA_BUILD_TESTS "Include test projects" OFF)
option(PA_BUILD_EXAMPLES "Include example projects" OFF)
if(PA_BUILD_SHARED_LIBS)
set(LIBRARY_BUILD_TYPE SHARED)
else()
set(LIBRARY_BUILD_TYPE STATIC)
endif()
option(PA_WARNINGS_ARE_ERRORS "Turn compiler warnings into errors" OFF)
if(PA_WARNINGS_ARE_ERRORS)
if(MSVC)
add_compile_options(/WX
# "Grandfathered" warnings that existed before we started enforcement.
# Do *NOT* add warnings to this list. Instead, fix your code so that it doesn't produce the warning.
# TODO: fix the offending code so that we don't have to exclude specific warnings anymore.
/wd4244 # W2 conversion possible loss of data
/wd4267 # W3 conversion possible loss of data
/wd4996 # W3 unsafe/deprecated
)
else()
add_compile_options(-Werror
# "Grandfathered" warnings that existed before we started enforcement.
# Do *NOT* add warnings to this list. Instead, fix your code so that it doesn't produce the warning.
# TODO: fix the offending code so that we don't have to exclude specific warnings anymore.
-Wno-error=deprecated-declarations # https://github.com/PortAudio/portaudio/issues/213 https://github.com/PortAudio/portaudio/issues/641
-Wno-error=stringop-overflow
)
if (CMAKE_C_COMPILER_ID MATCHES "Clang")
# Don't fail on older clang versions that don't recognize the latest warnings in the list above.
# Note that unrecognized warning options are not a fatal error on GCC, and in fact, GCC will choke on this option. Hence the conditional.
add_compile_options(-Wno-error=unknown-warning-option)
endif()
endif()
endif()
add_library(PortAudio
${LIBRARY_BUILD_TYPE}
src/common/pa_allocation.c
src/common/pa_allocation.h
src/common/pa_converters.c
src/common/pa_converters.h
src/common/pa_cpuload.c
src/common/pa_cpuload.h
src/common/pa_debugprint.c
src/common/pa_debugprint.h
src/common/pa_dither.c
src/common/pa_dither.h
src/common/pa_endianness.h
src/common/pa_front.c
src/common/pa_hostapi.h
src/common/pa_memorybarrier.h
src/common/pa_process.c
src/common/pa_process.h
src/common/pa_ringbuffer.c
src/common/pa_ringbuffer.h
src/common/pa_stream.c
src/common/pa_stream.h
src/common/pa_trace.c
src/common/pa_trace.h
src/common/pa_types.h
src/common/pa_util.h
)
include(GNUInstallDirs)
target_include_directories(PortAudio PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src/common>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
)
if(UNIX)
target_compile_options(PortAudio PRIVATE -fPIC)
endif()
set(PORTAUDIO_PUBLIC_HEADERS include/portaudio.h)
find_package(Threads REQUIRED)
target_link_libraries(PortAudio PRIVATE Threads::Threads)
option(PA_ENABLE_DEBUG_OUTPUT "Enable debug output for Portaudio" OFF)
if(PA_ENABLE_DEBUG_OUTPUT)
target_compile_definitions(PortAudio PRIVATE PA_ENABLE_DEBUG_OUTPUT)
endif()
include(TestBigEndian)
TEST_BIG_ENDIAN(IS_BIG_ENDIAN)
if(IS_BIG_ENDIAN)
target_compile_definitions(PortAudio PRIVATE PA_BIG_ENDIAN)
else()
target_compile_definitions(PortAudio PRIVATE PA_LITTLE_ENDIAN)
endif()
if(WIN32 AND MSVC AND PA_BUILD_SHARED_LIBS
# Check if the user is building PortAudio stand-alone or as part of a larger
# project. If this is part of a larger project (i.e. the CMakeLists.txt has
# been imported by some other CMakeLists.txt), we don't want to override
# that project's global settings.
AND "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_LIST_DIR}")
option(PA_DLL_LINK_WITH_STATIC_RUNTIME
"Link with static runtime libraries (minimizes runtime dependencies)" ON)
if(PA_DLL_LINK_WITH_STATIC_RUNTIME)
foreach(flag_var
CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE
CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO
CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
if(${flag_var} MATCHES "/MD")
string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
endif()
endforeach()
endif()
endif()
#
# Host APIs
#
option(PA_USE_SKELETON "Use skeleton host API" OFF)
if(PA_USE_SKELETON)
target_sources(PortAudio PRIVATE src/hostapi/skeleton/pa_hostapi_skeleton.c)
target_compile_definitions(PortAudio PRIVATE PA_USE_SKELETON=1)
endif()
include(CMakeDependentOption)
set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules")
# JACK is most commonly used on Linux, but it is cross platform, so allow building it on any OS
# if the FindJACK.cmake module finds POSIX headers.
find_package(JACK)
cmake_dependent_option(PA_USE_JACK "Enable support for JACK Audio Connection Kit" ON JACK_FOUND OFF)
if(PA_USE_JACK)
target_link_libraries(PortAudio PRIVATE JACK::jack)
target_sources(PortAudio PRIVATE src/hostapi/jack/pa_jack.c)
set(PORTAUDIO_PUBLIC_HEADERS "${PORTAUDIO_PUBLIC_HEADERS}" include/pa_jack.h)
target_compile_definitions(PortAudio PUBLIC PA_USE_JACK=1)
set(PKGCONFIG_CFLAGS "${PKGCONFIG_CFLAGS} -DPA_USE_JACK=1")
set(PKGCONFIG_REQUIRES_PRIVATE "${PKGCONFIG_REQUIRES_PRIVATE} jack")
# needed for PortAudioConfig.cmake so `find_package(PortAudio)` works in downstream projects
install(FILES cmake/modules/FindRegex.cmake DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/portaudio/modules")
install(FILES cmake/modules/FindJACK.cmake DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/portaudio/modules")
endif()
if(WIN32)
target_sources(PortAudio PRIVATE
src/os/win/pa_win_coinitialize.c
src/os/win/pa_win_coinitialize.h
src/os/win/pa_win_hostapis.c
src/os/win/pa_win_util.c
src/os/win/pa_win_util.h
src/os/win/pa_win_version.c
src/os/win/pa_win_version.h
src/os/win/pa_win_waveformat.c
src/os/win/pa_win_wdmks_utils.h
src/os/win/pa_x86_plain_converters.h
)
target_include_directories(PortAudio PRIVATE src/os/win)
set(PORTAUDIO_PUBLIC_HEADERS "${PORTAUDIO_PUBLIC_HEADERS}" include/pa_win_waveformat.h)
target_link_libraries(PortAudio PRIVATE winmm)
if(MSVC)
target_sources(PortAudio PRIVATE src/os/win/pa_x86_plain_converters.c)
else()
target_compile_definitions(PortAudio PRIVATE _WIN32_WINNT=0x0501 WINVER=0x0501)
set(DEF_EXCLUDE_X86_PLAIN_CONVERTERS ";")
endif()
target_compile_definitions(PortAudio PRIVATE _CRT_SECURE_NO_WARNINGS)
option(PA_USE_ASIO "Enable support for ASIO" OFF)
if(PA_USE_ASIO)
find_package(ASIO)
# Automatically download the ASIO SDK ZIP if it is not found. The ASIO SDK license
# allows for downloading it from Steinberg and using it without charge, but it is
# not allowed to be redistributed.
#
# The file(ARCHIVE_EXTRACT) command needed to extract the ZIP archive was added in
# CMake 3.18, so do not bother downloading the ZIP archive for older CMake versions.
# Instead, FindASIO.cmake directs the user to manually extract the ZIP file to
# CMAKE_PREFIX_PATH or CMAKE_CURRENT_BINARY_DIR.
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.18 AND NOT TARGET ASIO::host)
if(NOT ASIO_SDK_ZIP_PATH)
set(ASIO_SDK_ZIP_PATH "${CMAKE_CURRENT_BINARY_DIR}/asiosdk.zip")
endif()
message(STATUS "Downloading ASIO SDK... ${ASIO_SDK_ZIP_PATH}")
file(DOWNLOAD "https://www.steinberg.net/asiosdk"
"${ASIO_SDK_ZIP_PATH}"
STATUS ASIO_DOWNLOAD_STATUS
SHOW_PROGRESS
)
if("${ASIO_DOWNLOAD_STATUS}" EQUAL 0)
find_package(ASIO)
else()
list(GET "${ASIO_DOWNLOAD_STATUS}" 1 DOWNLOAD_ERROR)
message(FATAL_ERROR "Error downloading ASIO SDK: ${DOWNLOAD_ERROR} "
"Reconfigure CMake with -DPA_USE_ASIO=OFF to build without ASIO. "
"Alternatively, download the ZIP from https://www.steinberg.net/asiosdk "
"and put it in ${CMAKE_PREFIX_PATH} or ${CMAKE_CURRENT_BINARY_DIR}"
)
endif()
endif()
endif()
if(PA_USE_ASIO AND TARGET ASIO::host)
target_link_libraries(PortAudio PRIVATE "$<BUILD_INTERFACE:ASIO::host>")
set(PORTAUDIO_PUBLIC_HEADERS "${PORTAUDIO_PUBLIC_HEADERS}" include/pa_asio.h)
target_compile_definitions(PortAudio PUBLIC PA_USE_ASIO=1)
set(PKGCONFIG_CFLAGS "${PKGCONFIG_CFLAGS} -DPA_USE_ASIO=1")
target_sources(PortAudio PRIVATE
src/hostapi/asio/pa_asio.cpp
src/hostapi/asio/iasiothiscallresolver.cpp
src/hostapi/asio/iasiothiscallresolver.h
)
else()
set(DEF_EXCLUDE_ASIO_SYMBOLS ";")
endif()
option(PA_USE_DS "Enable support for DirectSound" ON)
if(PA_USE_DS)
target_sources(PortAudio PRIVATE
src/hostapi/dsound/pa_win_ds.c
src/hostapi/dsound/pa_win_ds_dynlink.c
src/hostapi/dsound/pa_win_ds_dynlink.h
)
target_include_directories(PortAudio PRIVATE src/hostapi/dsound)
set(PORTAUDIO_PUBLIC_HEADERS "${PORTAUDIO_PUBLIC_HEADERS}" include/pa_win_ds.h)
target_compile_definitions(PortAudio PUBLIC PA_USE_DS=1)
set(PKGCONFIG_CFLAGS "${PKGCONFIG_CFLAGS} -DPA_USE_DS=1")
target_link_libraries(PortAudio PRIVATE dsound)
if(NOT MINGW)
target_compile_definitions(PortAudio PRIVATE PAWIN_USE_DIRECTSOUNDFULLDUPLEXCREATE)
endif()
endif()
option(PA_USE_WMME "Enable support for WMME" ON)
if(PA_USE_WMME)
target_sources(PortAudio PRIVATE src/hostapi/wmme/pa_win_wmme.c)
set(PORTAUDIO_PUBLIC_HEADERS "${PORTAUDIO_PUBLIC_HEADERS}" include/pa_win_wmme.h)
target_compile_definitions(PortAudio PUBLIC PA_USE_WMME=1)
set(PKGCONFIG_CFLAGS "${PKGCONFIG_CFLAGS} -DPA_USE_WMME=1")
target_link_libraries(PortAudio PRIVATE ole32 uuid)
else()
set(DEF_EXCLUDE_WMME_SYMBOLS ";")
endif()
option(PA_USE_WASAPI "Enable support for WASAPI" ON)
if(PA_USE_WASAPI)
target_sources(PortAudio PRIVATE src/hostapi/wasapi/pa_win_wasapi.c)
set(PORTAUDIO_PUBLIC_HEADERS "${PORTAUDIO_PUBLIC_HEADERS}" include/pa_win_wasapi.h)
target_compile_definitions(PortAudio PUBLIC PA_USE_WASAPI=1)
set(PKGCONFIG_CFLAGS "${PKGCONFIG_CFLAGS} -DPA_USE_WASAPI=1")
target_link_libraries(PortAudio PRIVATE ole32 uuid)
else()
set(DEF_EXCLUDE_WASAPI_SYMBOLS ";")
endif()
option(PA_USE_WDMKS "Enable support for WDMKS" ON)
if(PA_USE_WDMKS)
target_sources(PortAudio PRIVATE
src/os/win/pa_win_wdmks_utils.c
src/hostapi/wdmks/pa_win_wdmks.c
)
set(PORTAUDIO_PUBLIC_HEADERS "${PORTAUDIO_PUBLIC_HEADERS}" include/pa_win_wdmks.h)
target_compile_definitions(PortAudio PUBLIC PA_USE_WDMKS=1)
set(PKGCONFIG_CFLAGS "${PKGCONFIG_CFLAGS} -DPA_USE_WDMKS=1")
target_link_libraries(PortAudio PRIVATE setupapi ole32 uuid)
endif()
option(PA_USE_WDMKS_DEVICE_INFO "Use WDM/KS API for device info" ON)
if(PA_USE_WDMKS_DEVICE_INFO)
target_compile_definitions(PortAudio PRIVATE PAWIN_USE_WDMKS_DEVICE_INFO)
endif()
if(PA_BUILD_SHARED_LIBS)
configure_file(cmake/portaudio.def.in "${CMAKE_CURRENT_BINARY_DIR}/portaudio.def" @ONLY)
target_sources(PortAudio PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/portaudio.def")
endif()
elseif(UNIX)
target_sources(PortAudio PRIVATE
src/os/unix/pa_unix_hostapis.c
src/os/unix/pa_unix_util.c
src/os/unix/pa_unix_util.h
)
target_include_directories(PortAudio PRIVATE src/os/unix)
target_link_libraries(PortAudio PRIVATE m)
set(PKGCONFIG_LDFLAGS_PRIVATE "${PKGCONFIG_LDFLAGS_PUBLIC} -lm -lpthread")
set(PKGCONFIG_CFLAGS "${PKGCONFIG_CFLAGS} -pthread")
if(APPLE)
set(CMAKE_MACOSX_RPATH 1)
target_sources(PortAudio PRIVATE
src/hostapi/coreaudio/pa_mac_core.c
src/hostapi/coreaudio/pa_mac_core_blocking.c
src/hostapi/coreaudio/pa_mac_core_blocking.h
src/hostapi/coreaudio/pa_mac_core_internal.h
src/hostapi/coreaudio/pa_mac_core_utilities.c
src/hostapi/coreaudio/pa_mac_core_utilities.h
)
target_include_directories(PortAudio PRIVATE src/hostapi/coreaudio)
set(PORTAUDIO_PUBLIC_HEADERS "${PORTAUDIO_PUBLIC_HEADERS}" include/pa_mac_core.h)
target_link_libraries(PortAudio
PRIVATE
-Wl,-framework,CoreAudio
-Wl,-framework,AudioToolbox
-Wl,-framework,AudioUnit
-Wl,-framework,CoreFoundation
-Wl,-framework,CoreServices
)
target_compile_definitions(PortAudio PUBLIC PA_USE_COREAUDIO=1)
set(PKGCONFIG_CFLAGS "${PKGCONFIG_CFLAGS} -DPA_USE_COREAUDIO=1")
# Use C11 so that we can make use of atomic library and avoid deprecation errors.
set_property(TARGET PortAudio PROPERTY C_STANDARD 11)
set(PKGCONFIG_LDFLAGS_PRIVATE
"${PKGCONFIG_LDFLAGS_PRIVATE} -framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework CoreFoundation -framework CoreServices")
else()
# Some BSDs have a reimplementation of alsalib, so do not explicitly check for Linux.
find_package(ALSA)
cmake_dependent_option(PA_USE_ALSA "Enable support for ALSA" ON ALSA_FOUND OFF)
if(PA_USE_ALSA)
target_link_libraries(PortAudio PRIVATE "${ALSA_LIBRARIES}")
target_sources(PortAudio PRIVATE src/hostapi/alsa/pa_linux_alsa.c)
set(PORTAUDIO_PUBLIC_HEADERS "${PORTAUDIO_PUBLIC_HEADERS}" include/pa_linux_alsa.h)
target_compile_definitions(PortAudio PUBLIC PA_USE_ALSA=1)
set(PKGCONFIG_CFLAGS "${PKGCONFIG_CFLAGS} -DPA_USE_ALSA=1")
option(PA_ALSA_DYNAMIC "Enable dynamically loading libasound with dlopen using PaAlsa_SetLibraryPathName" OFF)
if(PA_ALSA_DYNAMIC)
target_compile_definitions(PortAudio PRIVATE PA_ALSA_DYNAMIC)
target_link_libraries(PortAudio PRIVATE "${CMAKE_DL_LIBS}")
set(PKGCONFIG_LDFLAGS_PRIVATE "${PKGCONFIG_LDFLAGS_PRIVATE} -l${CMAKE_DL_LIBS}")
else()
set(PKGCONFIG_REQUIRES_PRIVATE "${PKGCONFIG_REQUIRES_PRIVATE} alsa")
endif()
endif()
# OSS is intentionally off by default to avoid confusing users of PortAudio
# applications. OSS builds but there are no devices available on modern
# Linux systems.
find_package(OSS)
cmake_dependent_option(PA_USE_OSS "Enable support for OSS" OFF "OSS_FOUND" OFF)
if(PA_USE_OSS)
target_sources(PortAudio PRIVATE src/hostapi/oss/pa_unix_oss.c)
target_compile_definitions(PortAudio PUBLIC PA_USE_OSS=1)
set(PKGCONFIG_CFLAGS "${PKGCONFIG_CFLAGS} -DPA_USE_OSS=1")
target_link_libraries(PortAudio PRIVATE OSS::oss)
# The FindOSS.cmake module does not need to be installed like the JACK modules because it
# does not link any library; it only adds an include directory and compile definition.
endif()
check_include_file(sys/audioio.h HAVE_SYS_AUDIOIO_H)
cmake_dependent_option(AUDIOIO "Enable support for Solaris/NetBSD audio" ON "HAVE_SYS_AUDIOIO_H" AUDIOIO)
if(AUDIOIO AND HAVE_SYS_AUDIOIO_H)
target_sources(PortAudio PRIVATE src/hostapi/audioio/pa_unix_audioio.c)
target_compile_definitions(PortAudio PUBLIC PA_USE_AUDIOIO=1)
set(PKGCONFIG_CFLAGS "${PKGCONFIG_CFLAGS} -DPA_USE_AUDIOIO=1")
endif()
endif()
endif()
# Add public headers to sources of PortAudio (used by some IDEs to list them in project tree)
source_group("Public Header Files" FILES ${PORTAUDIO_PUBLIC_HEADERS})
target_sources(PortAudio PRIVATE ${PORTAUDIO_PUBLIC_HEADERS})
#
# Installation
#
include(CMakePackageConfigHelpers)
if(NOT CMAKE_FRAMEWORK)
install(FILES README.md DESTINATION "${CMAKE_INSTALL_DOCDIR}/portaudio")
install(FILES LICENSE.txt DESTINATION "${CMAKE_INSTALL_DOCDIR}/portaudio")
configure_file(cmake/portaudio-2.0.pc.in "${CMAKE_CURRENT_BINARY_DIR}/portaudio-2.0.pc" @ONLY)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/portaudio-2.0.pc"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
configure_package_config_file(cmake/PortAudioConfig.cmake.in
"${CMAKE_CURRENT_BINARY_DIR}/cmake/portaudio/PortAudioConfig.cmake"
INSTALL_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/portaudio"
NO_CHECK_REQUIRED_COMPONENTS_MACRO
)
write_basic_package_version_file(
"${CMAKE_CURRENT_BINARY_DIR}/cmake/portaudio/PortAudioConfigVersion.cmake"
VERSION "${PORTAUDIO_VERSION}"
COMPATIBILITY SameMajorVersion
)
install(EXPORT PortAudio-targets NAMESPACE "PortAudio::" FILE "PortAudioTargets.cmake"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/portaudio")
export(TARGETS PortAudio
FILE "${CMAKE_CURRENT_BINARY_DIR}/cmake/portaudio/PortAudioTargets.cmake")
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/cmake/portaudio/PortAudioConfig.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/cmake/portaudio/PortAudioConfigVersion.cmake"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/portaudio")
if(NOT TARGET uninstall)
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
IMMEDIATE @ONLY)
add_custom_target(uninstall
COMMAND ${CMAKE_COMMAND} -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
endif()
endif()
set_target_properties(PortAudio PROPERTIES
OUTPUT_NAME portaudio
PUBLIC_HEADER "${PORTAUDIO_PUBLIC_HEADERS}"
MACOSX_FRAMEWORK_IDENTIFIER com.portaudio
FRAMEWORK_VERSION A
WINDOWS_EXPORT_ALL_SYMBOLS TRUE
VERSION ${PROJECT_VERSION}
SOVERSION 2
)
install(TARGETS PortAudio
EXPORT PortAudio-targets
PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
FRAMEWORK DESTINATION "${CMAKE_INSTALL_LIBDIR}"
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
)
#
# Subdirectories
#
# Some of the tests and examples use private symbols which are not
# exposed by the .def file on Windows.
if(WIN32 AND PA_BUILD_SHARED_LIBS)
set(LINK_PRIVATE_SYMBOLS OFF)
else()
set(LINK_PRIVATE_SYMBOLS ON)
endif()
if(PA_BUILD_TESTS)
macro(add_test appl_name)
add_executable(${appl_name} "${appl_name}.c")
target_link_libraries(${appl_name} PortAudio Threads::Threads)
if(UNIX)
target_link_libraries(${appl_name} m)
endif()
set_target_properties(${appl_name}
PROPERTIES
FOLDER "Test"
)
endmacro()
subdirs(test)
subdirs(qa)
endif()
if(PA_BUILD_EXAMPLES)
subdirs(examples)
endif()