-
Notifications
You must be signed in to change notification settings - Fork 11
/
CMakeLists.txt
364 lines (310 loc) · 11.6 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
cmake_minimum_required (VERSION 3.15)
project (synthv1
VERSION 1.1.0
DESCRIPTION "an old-school polyphonic synthesizer"
HOMEPAGE_URL "https://synthv1.sourceforge.io"
LANGUAGES C CXX)
set (PROJECT_COPYRIGHT "Copyright (C) 2012-2024, rncbc aka Rui Nuno Capela. All rights reserved.")
set (PROJECT_DOMAIN "rncbc.org")
execute_process (
COMMAND git describe --tags --dirty --abbrev=6
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_DESCRIBE_OUTPUT
RESULT_VARIABLE GIT_DESCRIBE_RESULT
OUTPUT_STRIP_TRAILING_WHITESPACE)
if (GIT_DESCRIBE_RESULT EQUAL 0)
set (GIT_VERSION "${GIT_DESCRIBE_OUTPUT}")
string (REGEX REPLACE "^[^0-9]+" "" GIT_VERSION "${GIT_VERSION}")
string (REGEX REPLACE "-g" "git." GIT_VERSION "${GIT_VERSION}")
string (REGEX REPLACE "[_|-]" "." GIT_VERSION "${GIT_VERSION}")
execute_process (
COMMAND git rev-parse --abbrev-ref HEAD
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_REVPARSE_OUTPUT
RESULT_VARIABLE GIT_REVPARSE_RESULT
OUTPUT_STRIP_TRAILING_WHITESPACE)
if (GIT_REVPARSE_RESULT EQUAL 0 AND NOT GIT_REVPARSE_OUTPUT STREQUAL "main")
set (GIT_VERSION "${GIT_VERSION} [${GIT_REVPARSE_OUTPUT}]")
endif ()
set (PROJECT_VERSION "${GIT_VERSION}")
endif ()
if (CMAKE_BUILD_TYPE MATCHES "Debug")
set (CONFIG_DEBUG 1)
set (CONFIG_BUILD_TYPE "debug")
else ()
set (CONFIG_DEBUG 0)
set (CONFIG_BUILD_TYPE "release")
set (CMAKE_BUILD_TYPE "Release")
endif ()
set (CONFIG_PREFIX "${CMAKE_INSTALL_PREFIX}")
include (GNUInstallDirs)
set (CONFIG_BINDIR "${CONFIG_PREFIX}/${CMAKE_INSTALL_BINDIR}")
set (CONFIG_LIBDIR "${CONFIG_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
set (CONFIG_DATADIR "${CONFIG_PREFIX}/${CMAKE_INSTALL_DATADIR}")
set (CONFIG_MANDIR "${CONFIG_PREFIX}/${CMAKE_INSTALL_MANDIR}")
# Enable JACK standalone build.
option (CONFIG_JACK "Enable JACK stand-alone build (default=yes)" 1)
# Enable JACK session support.
option (CONFIG_JACK_SESSION "Enable JACK session support (default=yes)" 1)
# Enable JACK MIDI support option.
option (CONFIG_JACK_MIDI "Enable JACK MIDI support (default=yes)" 1)
# Enable ALSA MIDI support option.
option (CONFIG_ALSA_MIDI "Enable ALSA MIDI support (default=yes)" 1)
# Enable LV2 plugin build.
option (CONFIG_LV2 "Enable LV2 plug-in build (default=yes)" 1)
if (WIN32)
option (CONFIG_LV2_UI_WINDOWS "Enable LV2 plug-in Windows UI support (default=yes)" 1)
# Windows install target path.
set (CONFIG_WINDOWS_LV2_PATH "$ENV{SYSTEMDRIVE}/Program Files/Common Files/LV2" CACHE STRING "Specify Windows LV2 install path")
else ()
option (CONFIG_LV2_UI_X11 "Enable LV2 plug-in X11 UI support (default=yes)" 1)
endif ()
option (CONFIG_LV2_UI_EXTERNAL "Enable LV2 plug-in External UI support (default=yes)" 1)
option (CONFIG_LV2_UI_IDLE "Enable LV2 UI Idle interface support (default=yes)" 1)
option (CONFIG_LV2_UI_SHOW "Enable LV2 UI Show interface support (default=yes)" 1)
option (CONFIG_LV2_UI_RESIZE "Enable LV2 UI Resize interface support (default=yes)" 1)
option (CONFIG_LV2_PROGRAMS "Enable LV2 plug-in Programs support (default=yes)" 1)
option (CONFIG_LV2_PATCH "Enable LV2 plug-in Patch support (default=yes)" 1)
option (CONFIG_LV2_PORT_EVENT "Enable LV2 plug-in Port-event support (default=yes)" 1)
option (CONFIG_LV2_PORT_CHANGE_REQUEST "Enable LV2 plug-in Port-change request support (default=yes)" 1)
# Enable liblo availability.
option (CONFIG_LIBLO "Enable liblo interface (default=yes)" 1)
# Enable NSM support.
option (CONFIG_NSM "Enable NSM support (default=yes)" 1)
# Enable Wayland support option.
option (CONFIG_WAYLAND "Enable Wayland support (EXPERIMENTAL) (default=no)" 0)
# Enable Qt6 build preference.
option (CONFIG_QT6 "Enable Qt6 build (default=yes)" 1)
# Fix for new CMAKE_REQUIRED_LIBRARIES policy.
if (POLICY CMP0075)
cmake_policy (SET CMP0075 NEW)
endif ()
# Fix for CXX_VISIBILITY_PRESET policy.
if (POLICY CMP0063)
cmake_policy (SET CMP0063 NEW)
set (CMAKE_CXX_VISIBILITY_PRESET hidden)
set (CMAKE_VISIBILITY_INLINES_HIDDEN 1)
endif ()
# Check for Qt...
if (CONFIG_QT6)
find_package (Qt6 QUIET)
if (NOT Qt6_FOUND)
set (CONFIG_QT6 0)
endif ()
endif ()
if (CONFIG_QT6)
find_package (QT QUIET NAMES Qt6)
else ()
find_package (QT QUIET NAMES Qt5)
endif ()
find_package (Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core Gui Widgets Xml Svg)
#find_package (Qt${QT_VERSION_MAJOR}LinguistTools)
include (CheckIncludeFile)
include (CheckIncludeFiles)
include (CheckIncludeFileCXX)
include (CheckFunctionExists)
include (CheckLibraryExists)
# Make sure we get some subtle optimizations out there...
add_compile_options (-ffast-math)
# Checks for header files.
if (UNIX AND NOT APPLE)
check_include_files ("fcntl.h;unistd.h;signal.h" HAVE_SIGNAL_H)
endif ()
# Find package modules
include (FindPkgConfig)
# Check for JACK libraries.
if (CONFIG_JACK)
pkg_check_modules (JACK IMPORTED_TARGET jack>=0.100.0)
if (JACK_FOUND)
find_library (JACK_LIBRARY NAMES ${JACK_LIBRARIES} HINTS ${JACK_LIBDIR})
endif ()
if (JACK_LIBRARY)
set (CONFIG_JACK 1)
set (CMAKE_REQUIRED_LIBRARIES "${JACK_LIBRARY};${CMAKE_REQUIRED_LIBRARIES}")
# Check for JACK MIDI headers availability.
if (CONFIG_JACK_MIDI)
check_include_file (jack/midiport.h HAVE_JACK_MIDIPORT_H)
if (NOT HAVE_JACK_MIDIPORT_H)
set (CONFIG_JACK_MIDI 0)
endif ()
endif ()
# Check for JACK session headers availability.
if (CONFIG_JACK_SESSION)
check_include_file (jack/session.h HAVE_JACK_SESSION_H)
if (NOT HAVE_JACK_SESSION_H)
set (CONFIG_JACK_SESSION 0)
endif ()
endif ()
# Check for JACK session event callback availability.
if (CONFIG_JACK_SESSION)
check_function_exists (jack_set_session_callback CONFIG_JACK_SESSION)
endif ()
# Check for ALSA libraries.
if (CONFIG_ALSA_MIDI)
pkg_check_modules (ALSA IMPORTED_TARGET alsa)
if (ALSA_FOUND)
find_library (ALSA_LIBRARY NAMES ${ALSA_LIBRARIES} HINTS ${ALSA_LIBDIR})
endif ()
if (ALSA_LIBRARY)
set (CONFIG_ALSA_MIDI 1)
#set (CMAKE_REQUIRED_LIBRARIES "${ALSA_LIBRARY};${CMAKE_REQUIRED_LIBRARIES}")
else ()
message (WARNING "*** ALSA library not found.")
endif ()
endif ()
else ()
message (WARNING "*** JACK library not found.")
set (CONFIG_JACK 0)
endif ()
endif ()
if (NOT CONFIG_JACK)
set (CONFIG_JACK_SESSION 0)
set (CONFIG_JACK_MIDI 0)
set (CONFIG_ALSA_MIDI 0)
set (CONFIG_LIBLO 0)
set (CONFIG_NSM 0)
endif ()
# Check for LIBLO libraries.
if (CONFIG_LIBLO)
pkg_check_modules (LIBLO IMPORTED_TARGET liblo)
if (NOT LIBLO_FOUND)
message (WARNING "*** LIBLO library not found.")
set (CONFIG_LIBLO 0)
endif ()
endif ()
# Check for LV2 support.
if (CONFIG_LV2)
pkg_check_modules (LV2 lv2)
if (LV2_FOUND)
include_directories (${LV2_INCLUDE_DIRS})
# Check for LV2 old/new headers style.
check_include_file (lv2/urid/urid.h HAVE_LV2_URID_H)
if (NOT HAVE_LV2_URID_H)
check_include_file (lv2/lv2plug.in/ns/ext/urid/urid.h HAVE_OLD_LV2_URID_H)
if (NOT HAVE_OLD_LV2_URID_H)
set (CONFIG_LV2 0)
else ()
set (CONFIG_LV2_OLD_HEADERS 1)
endif ()
else ()
set (CONFIG_LV2_OLD_HEADERS 0)
endif ()
endif ()
if (NOT CONFIG_LV2)
message (WARNING "*** LV2 SDK not found.")
endif ()
endif ()
if (CONFIG_LV2)
# Check for LV2 Atom support.
if (CONFIG_LV2_OLD_HEADERS)
check_include_file (lv2/lv2plug.in/ns/ext/atom/atom.h HAVE_LV2_ATOM_H)
else ()
check_include_file (lv2/atom/atom.h HAVE_LV2_ATOM_H)
endif ()
if (NOT HAVE_LV2_ATOM_H)
set (CONFIG_LV2_ATOM 0)
else ()
set (CONFIG_LV2_ATOM 1)
endif ()
set (CONFIG_LV2_ATOM_FORGE_OBJECT ${CONFIG_LV2_ATOM})
set (CONFIG_LV2_ATOM_FORGE_KEY ${CONFIG_LV2_ATOM})
# Check for LV2 UI support.
if (CONFIG_LV2_OLD_HEADERS)
check_include_file (lv2/lv2plug.in/ns/extensions/ui/ui.h HAVE_LV2_UI_H)
else ()
check_include_file (lv2/ui/ui.h HAVE_LV2_UI_H)
endif ()
if (NOT HAVE_LV2_UI_H)
set (CONFIG_LV2_UI 0)
else ()
set (CONFIG_LV2_UI 1)
endif ()
if (NOT CONFIG_LV2_UI)
set (CONFIG_LV2_UI_X11 0)
set (CONFIG_LV2_UI_WINDOWS 0)
set (CONFIG_LV2_UI_EXTERNAL 0)
set (CONFIG_LV2_UI_IDLE 0)
set (CONFIG_LV2_UI_SHOW 0)
set (CONFIG_LV2_UI_RESIZE 0)
endif ()
endif ()
# Check for LV2 headers.
if (CONFIG_LV2)
set (LV2_INCLUDES ${CMAKE_CURRENT_SOURCE_DIR}/src/lv2)
set (CMAKE_REQUIRED_INCLUDES "${LV2_INCLUDES};${CMAKE_REQUIRED_INCLUDES}")
include_directories (${LV2_INCLUDES})
if (CONFIG_LV2_OLD_HEADERS)
set (CMAKE_REQUIRED_DEFINITIONS "-DCONFIG_LV2_OLD_HEADERS;${CMAKE_REQUIRED_DEFINITIONS}")
endif ()
else ()
set (CONFIG_LV2_UI_X11 0)
set (CONFIG_LV2_UI_WINDOWS 0)
set (CONFIG_LV2_UI_EXTERNAL 0)
set (CONFIG_LV2_UI_IDLE 0)
set (CONFIG_LV2_UI_SHOW 0)
set (CONFIG_LV2_UI_RESIZE 0)
set (CONFIG_LV2_PROGRAMS 0)
set (CONFIG_LV2_PATCH 0)
set (CONFIG_LV2_PORT_EVENT 0)
set (CONFIG_LV2_PORT_CHANGE_REQUEST 0)
endif ()
if (CONFIG_LV2_UI_EXTERNAL)
check_include_file (lv2_external_ui.h HAVE_LV2_EXTERNAL_UI_H)
if (NOT HAVE_LV2_EXTERNAL_UI_H)
set (CONFIG_LV2_UI_EXTERNAL 0)
endif ()
endif ()
if (CONFIG_LV2_PROGRAMS)
check_include_file (lv2_programs.h HAVE_LV2_PROGRAMS_H)
if (NOT HAVE_LV2_PROGRAMS_H)
set (CONFIG_LV2_PROGRAMS 0)
endif ()
endif ()
if (CONFIG_LV2_PATCH)
if (CONFIG_LV2_OLD_HEADERS)
check_include_file (lv2/lv2plug.in/ns/ext/patch/patch.h HAVE_LV2_PATCH_H)
else ()
check_include_file (lv2/patch/patch.h HAVE_LV2_PATCH_H)
endif ()
if (NOT HAVE_LV2_PATCH_H)
set (CONFIG_LV2_PATCH 0)
endif ()
endif ()
if (CONFIG_LV2_PORT_CHANGE_REQUEST)
check_include_file (lv2_port_change_request.h HAVE_LV2_PORT_CHANGE_REQUEST_H)
if (NOT HAVE_LV2_PORT_CHANGE_REQUEST_H)
set (CONFIG_LV2_PORT_CHANGE_REQUEST 0)
endif ()
endif ()
add_subdirectory (src)
# Configuration status
macro (SHOW_OPTION text value)
if (${value})
message ("${text}: yes")
else ()
message ("${text}: no")
endif ()
endmacro ()
message ("\n ${PROJECT_NAME} ${PROJECT_VERSION} (Qt ${QT_VERSION})")
message ("\n Build target . . . . . . . . . . . . . . . . . . .: ${CONFIG_BUILD_TYPE}\n")
show_option (" JACK stand-alone build . . . . . . . . . . . . . ." CONFIG_JACK)
show_option (" JACK session support . . . . . . . . . . . . . . ." CONFIG_JACK_SESSION)
show_option (" JACK MIDI support . . . . . . . . . . . . . . . ." CONFIG_JACK_MIDI)
show_option (" ALSA MIDI support . . . . . . . . . . . . . . . ." CONFIG_ALSA_MIDI)
show_option (" LV2 plug-in build . . . . . . . . . . . . . . . ." CONFIG_LV2)
if (WIN32)
show_option (" LV2 plug-in Windows UI support . . . . . . . . ." CONFIG_LV2_UI_WINDOWS)
else ()
show_option (" LV2 plug-in X11 UI support . . . . . . . . . . ." CONFIG_LV2_UI_X11)
endif ()
show_option (" LV2 plug-in External UI support . . . . . . . . ." CONFIG_LV2_UI_EXTERNAL)
show_option (" LV2 plug-in UI Idle interface support . . . . . ." CONFIG_LV2_UI_IDLE)
show_option (" LV2 plug-in UI Show interface support . . . . . ." CONFIG_LV2_UI_SHOW)
show_option (" LV2 plug-in UI Resize interface support . . . . ." CONFIG_LV2_UI_RESIZE)
show_option (" LV2 plug-in Programs support . . . . . . . . . . ." CONFIG_LV2_PROGRAMS)
show_option (" LV2 plug-in Patch support . . . . . . . . . . . ." CONFIG_LV2_PATCH)
show_option (" LV2 plug-in Port-event support . . . . . . . . . ." CONFIG_LV2_PORT_EVENT)
show_option (" LV2 plug-in Port-change request . . . . . . . . ." CONFIG_LV2_PORT_CHANGE_REQUEST)
show_option (" OSC service support (liblo) . . . . . . . . . . ." CONFIG_LIBLO)
show_option (" Non/New Session Management (NSM) support . . . . ." CONFIG_NSM)
message ("\n Install prefix . . . . . . . . . . . . . . . . . .: ${CONFIG_PREFIX}\n")