blob: 36adff53a011bf2ed4c59486c4766a8c0845ed6e (
plain) (
blame)
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
|
From 11711398a1ec16f4eaeac8523b77165a560b69cc Mon Sep 17 00:00:00 2001
From: OPNA2608 <christoph.neidahl@gmail.com>
Date: Sun, 13 Jun 2021 13:55:53 +0200
Subject: [PATCH] Look for system-installed Rt libs
---
CMakeLists.txt | 159 +++++++++++++++++++++++++++++++------------------
1 file changed, 102 insertions(+), 57 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f3e53c3..027c1b1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -50,15 +50,6 @@ message("!! Optional feature summary:")
message("!! RtMidi: ${USE_RTMIDI}")
message("!! RtAudio: ${USE_RTAUDIO}")
-if(USE_RTAUDIO)
- if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
- pkg_check_modules(JACK "jack")
- message("!! -- Jack driver: ${JACK_FOUND}")
- pkg_check_modules(PULSEAUDIO "libpulse-simple")
- message("!! -- Pulseaudio driver: ${PULSEAUDIO_FOUND}")
- endif()
-endif()
-
if(ENABLE_PLOTS)
message("!! Qwt: ${QWT_LIBRARY}")
endif()
@@ -250,65 +241,119 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
endif()
if(USE_RTMIDI)
- add_library(RtMidi STATIC "src/midi/external/rtmidi/RtMidi.cpp")
- target_include_directories(RtMidi PUBLIC "src/midi/external/rtmidi")
- if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
- target_compile_definitions(RtMidi PUBLIC "__LINUX_ALSA__")
- target_link_libraries(RtMidi PUBLIC "asound")
- elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows")
- target_compile_definitions(RtMidi PUBLIC "__WINDOWS_MM__")
- target_link_libraries(RtMidi PUBLIC "winmm")
- elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
- target_compile_definitions(RtMidi PUBLIC "__MACOSX_CORE__")
- find_library(COREMIDI_LIBRARY "CoreMIDI")
- target_link_libraries(RtMidi PUBLIC "${COREMIDI_LIBRARY}")
+ if(PKG_CONFIG_FOUND)
+ pkg_check_modules(RTMIDI rtmidi)
+ if(RTMIDI_FOUND)
+ message("Using system-installed RtMidi found by pkg-config.")
+ target_link_libraries(OPL3BankEditor PUBLIC ${RTMIDI_LDFLAGS})
+ target_include_directories(OPL3BankEditor PUBLIC ${RTMIDI_INCLUDE_DIRS})
+ target_compile_options(OPL3BankEditor PUBLIC ${RTMIDI_CFLAGS})
+ endif()
endif()
+
+ if(NOT RTMIDI_FOUND)
+ find_library(RTMIDI_LIBRARY "rtmidi")
+ find_path(RTMIDI_INCLUDE_DIRS "RtMidi.h")
+ message("RtMidi library: ${RTMIDI_LIBRARY}")
+ message("RtMidi header directory: ${RTMIDI_INCLUDE_DIRS}")
+ if(NOT RTMIDI_LIBRARY-NOTFOUND AND NOT RTMIDI_INCLUDE_DIRS STREQUAL RTMIDI_INCLUDE_DIRS-NOTFOUND)
+ message("Using system-installed RtMidi.")
+ set(RTMIDI_FOUND TRUE)
+ target_link_libraries(OPL3BankEditor PUBLIC ${RTMIDI_LIBRARY})
+ target_include_directories(OPL3BankEditor PUBLIC ${RTMIDI_INCLUDE_DIRS})
+ endif()
+ endif()
+
+ if(NOT RTMIDI_FOUND)
+ message("Using bundled RtMidi.")
+ add_library(RtMidi STATIC "src/midi/external/rtmidi/RtMidi.cpp")
+ target_include_directories(RtMidi PUBLIC "src/midi/external/rtmidi")
+ if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
+ target_compile_definitions(RtMidi PUBLIC "__LINUX_ALSA__")
+ target_link_libraries(RtMidi PUBLIC "asound")
+ elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows")
+ target_compile_definitions(RtMidi PUBLIC "__WINDOWS_MM__")
+ target_link_libraries(RtMidi PUBLIC "winmm")
+ elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
+ target_compile_definitions(RtMidi PUBLIC "__MACOSX_CORE__")
+ find_library(COREMIDI_LIBRARY "CoreMIDI")
+ target_link_libraries(RtMidi PUBLIC "${COREMIDI_LIBRARY}")
+ endif()
+ target_link_libraries(OPL3BankEditor PRIVATE RtMidi)
+ endif()
+
target_sources(OPL3BankEditor PRIVATE "src/midi/midi_rtmidi.cpp")
target_compile_definitions(OPL3BankEditor PRIVATE "ENABLE_MIDI")
- target_link_libraries(OPL3BankEditor PRIVATE RtMidi)
endif()
if(USE_RTAUDIO)
- add_library(RtAudio STATIC "src/audio/external/rtaudio/RtAudio.cpp")
- target_include_directories(RtAudio PUBLIC "src/audio/external/rtaudio")
- if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
- target_compile_definitions(RtAudio PUBLIC "__LINUX_ALSA__")
- target_link_libraries(RtAudio PUBLIC "asound")
- if(JACK_FOUND)
- target_compile_definitions(RtAudio PUBLIC "__UNIX_JACK__")
- target_include_directories(RtAudio PUBLIC ${JACK_INCLUDE_DIRS})
- link_directories(${JACK_LIBRARY_DIRS})
- target_link_libraries(RtAudio PUBLIC ${JACK_LIBRARIES})
+ if(PKG_CONFIG_FOUND)
+ pkg_check_modules(RTAUDIO rtaudio)
+ if(RTAUDIO_FOUND)
+ message("Using system-installed RtAudio found by pkg-config.")
+ target_link_libraries(OPL3BankEditor PUBLIC ${RTAUDIO_LDFLAGS})
+ target_include_directories(OPL3BankEditor PUBLIC ${RTAUDIO_INCLUDE_DIRS})
+ target_compile_options(OPL3BankEditor PUBLIC ${RTAUDIO_CFLAGS})
+ endif()
+ endif()
+
+ if(NOT RTAUDIO_FOUND)
+ find_library(RTAUDIO_LIBRARY "rtaudio")
+ find_path(RTAUDIO_INCLUDE_DIRS "RtAudio.h")
+ message("RtAudio library: ${RTAUDIO_LIBRARY}")
+ message("RtAudio header directory: ${RTAUDIO_INCLUDE_DIRS}")
+ if(NOT RTAUDIO_LIBRARY-NOTFOUND AND NOT RTAUDIO_INCLUDE_DIRS STREQUAL RTAUDIO_INCLUDE_DIRS-NOTFOUND)
+ message("Using system-installed RtAudio.")
+ set(RTAUDIO_FOUND TRUE)
+ target_link_libraries(OPL3BankEditor PUBLIC ${RTAUDIO_LIBRARY})
+ target_include_directories(OPL3BankEditor PUBLIC ${RTAUDIO_INCLUDE_DIRS})
endif()
- if(PULSEAUDIO_FOUND)
- target_compile_definitions(RtAudio PUBLIC "__LINUX_PULSE__")
- target_include_directories(RtAudio PUBLIC ${PULSEAUDIO_INCLUDE_DIRS})
- link_directories(${PULSEAUDIO_LIBRARY_DIRS})
- target_link_libraries(RtAudio PUBLIC ${PULSEAUDIO_LIBRARIES})
+ endif()
+
+ if(NOT RTAUDIO_FOUND)
+ message("Using bundled RtAudio.")
+ add_library(RtAudio STATIC "src/audio/external/rtaudio/RtAudio.cpp")
+ target_include_directories(RtAudio PUBLIC "src/audio/external/rtaudio")
+ if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
+ target_compile_definitions(RtAudio PUBLIC "__LINUX_ALSA__")
+ target_link_libraries(RtAudio PUBLIC "asound")
+ if(JACK_FOUND)
+ target_compile_definitions(RtAudio PUBLIC "__UNIX_JACK__")
+ target_include_directories(RtAudio PUBLIC ${JACK_INCLUDE_DIRS})
+ link_directories(${JACK_LIBRARY_DIRS})
+ target_link_libraries(RtAudio PUBLIC ${JACK_LIBRARIES})
+ endif()
+ if(PULSEAUDIO_FOUND)
+ target_compile_definitions(RtAudio PUBLIC "__LINUX_PULSE__")
+ target_include_directories(RtAudio PUBLIC ${PULSEAUDIO_INCLUDE_DIRS})
+ link_directories(${PULSEAUDIO_LIBRARY_DIRS})
+ target_link_libraries(RtAudio PUBLIC ${PULSEAUDIO_LIBRARIES})
+ endif()
+ elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows")
+ target_compile_definitions(RtAudio PUBLIC "__WINDOWS_DS__")
+ target_link_libraries(RtAudio PUBLIC "dsound" "ole32")
+ target_compile_definitions(RtAudio PUBLIC "__WINDOWS_WASAPI__")
+ target_link_libraries(RtAudio PUBLIC "ksguid")
+ target_compile_definitions(RtAudio PUBLIC "__WINDOWS_ASIO__")
+ target_include_directories(RtAudio PRIVATE
+ "src/audio/external/rtaudio/include")
+ target_sources(RtAudio PRIVATE
+ "src/audio/external/rtaudio/include/asio.cpp"
+ "src/audio/external/rtaudio/include/asiodrivers.cpp"
+ "src/audio/external/rtaudio/include/asiolist.cpp"
+ "src/audio/external/rtaudio/include/iasiothiscallresolver.cpp")
+ elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
+ target_compile_definitions(RtAudio PUBLIC "__MACOSX_CORE__")
+ find_library(COREAUDIO_LIBRARY "CoreAudio")
+ target_link_libraries(RtAudio PUBLIC "${COREAUDIO_LIBRARY}")
+ find_library(COREFOUNDATION_LIBRARY "CoreFoundation")
+ target_link_libraries(RtAudio PUBLIC "${COREFOUNDATION_LIBRARY}")
endif()
- elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows")
- target_compile_definitions(RtAudio PUBLIC "__WINDOWS_DS__")
- target_link_libraries(RtAudio PUBLIC "dsound" "ole32")
- target_compile_definitions(RtAudio PUBLIC "__WINDOWS_WASAPI__")
- target_link_libraries(RtAudio PUBLIC "ksguid")
- target_compile_definitions(RtAudio PUBLIC "__WINDOWS_ASIO__")
- target_include_directories(RtAudio PRIVATE
- "src/audio/external/rtaudio/include")
- target_sources(RtAudio PRIVATE
- "src/audio/external/rtaudio/include/asio.cpp"
- "src/audio/external/rtaudio/include/asiodrivers.cpp"
- "src/audio/external/rtaudio/include/asiolist.cpp"
- "src/audio/external/rtaudio/include/iasiothiscallresolver.cpp")
- elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
- target_compile_definitions(RtAudio PUBLIC "__MACOSX_CORE__")
- find_library(COREAUDIO_LIBRARY "CoreAudio")
- target_link_libraries(RtAudio PUBLIC "${COREAUDIO_LIBRARY}")
- find_library(COREFOUNDATION_LIBRARY "CoreFoundation")
- target_link_libraries(RtAudio PUBLIC "${COREFOUNDATION_LIBRARY}")
+ target_link_libraries(OPL3BankEditor PRIVATE RtAudio)
endif()
+
target_sources(OPL3BankEditor PRIVATE "src/audio/ao_rtaudio.cpp")
target_compile_definitions(OPL3BankEditor PRIVATE "ENABLE_AUDIO_TESTING")
- target_link_libraries(OPL3BankEditor PRIVATE RtAudio)
endif()
add_executable(measurer_tool
--
2.29.3
|