1 |
capela |
3910 |
cmake_minimum_required (VERSION 3.13) |
2 |
capela |
3851 |
|
3 |
capela |
3910 |
project (qsampler |
4 |
capela |
4050 |
VERSION 0.9.8 |
5 |
capela |
3852 |
DESCRIPTION "A LinuxSampler Qt GUI Interface" |
6 |
|
|
LANGUAGES C CXX) |
7 |
capela |
3567 |
|
8 |
capela |
3852 |
set (CONFIG_VERSION ${PROJECT_VERSION}) |
9 |
capela |
3567 |
execute_process ( |
10 |
|
|
COMMAND git describe --tags --dirty --abbrev=6 |
11 |
capela |
3871 |
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} |
12 |
capela |
3567 |
OUTPUT_VARIABLE GIT_DESCRIBE_OUTPUT |
13 |
|
|
RESULT_VARIABLE GIT_DESCRIBE_RESULT |
14 |
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE) |
15 |
|
|
if (GIT_DESCRIBE_RESULT EQUAL 0) |
16 |
|
|
set (VERSION "${GIT_DESCRIBE_OUTPUT}") |
17 |
capela |
3824 |
string (REGEX REPLACE "^[^0-9]+" "" VERSION "${VERSION}") |
18 |
capela |
3873 |
string (REGEX REPLACE "^1_" "" VERSION "${VERSION}") |
19 |
|
|
string (REGEX REPLACE "^[_vV]+" "" VERSION "${VERSION}") |
20 |
capela |
3567 |
string (REGEX REPLACE "-g" "git." VERSION "${VERSION}") |
21 |
capela |
3873 |
string (REGEX REPLACE "[_|-]" "." VERSION "${VERSION}") |
22 |
capela |
3567 |
execute_process ( |
23 |
|
|
COMMAND git rev-parse --abbrev-ref HEAD |
24 |
capela |
3871 |
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} |
25 |
capela |
3567 |
OUTPUT_VARIABLE GIT_REVPARSE_OUTPUT |
26 |
|
|
RESULT_VARIABLE GIT_REVPARSE_RESULT |
27 |
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE) |
28 |
|
|
if (GIT_REVPARSE_RESULT EQUAL 0 AND NOT GIT_REVPARSE_OUTPUT STREQUAL "master") |
29 |
|
|
set (VERSION "${VERSION} [${GIT_REVPARSE_OUTPUT}]") |
30 |
capela |
3571 |
endif () |
31 |
capela |
3852 |
else () |
32 |
|
|
set (VERSION "${PROJECT_VERSION}") |
33 |
capela |
3567 |
endif () |
34 |
|
|
|
35 |
|
|
set (PACKAGE_NAME "Qsampler") |
36 |
|
|
set (PACKAGE_VERSION "${VERSION}") |
37 |
|
|
set (PACKAGE_BUGREPORT "rncbc@rncbc.org") |
38 |
|
|
set (PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}") |
39 |
|
|
set (PACKAGE_TARNAME "qsampler") |
40 |
|
|
|
41 |
|
|
set (CONFIG_BUILD_VERSION "${PACKAGE_VERSION}") |
42 |
|
|
|
43 |
capela |
3907 |
if (CONFIG_DEBUG) |
44 |
|
|
set (CMAKE_BUILD_TYPE "Debug") |
45 |
|
|
endif () |
46 |
|
|
if (CMAKE_BUILD_TYPE MATCHES "Debug") |
47 |
|
|
set (CONFIG_DEBUG 1) |
48 |
|
|
endif () |
49 |
|
|
if (CONFIG_DEBUG) |
50 |
|
|
set (CONFIG_BUILD_TYPE "debug") |
51 |
capela |
3567 |
else () |
52 |
|
|
set (CONFIG_BUILD_TYPE "release") |
53 |
|
|
endif () |
54 |
|
|
|
55 |
|
|
set (CONFIG_PREFIX "${CMAKE_INSTALL_PREFIX}") |
56 |
|
|
|
57 |
capela |
3570 |
include (GNUInstallDirs) |
58 |
|
|
set (CONFIG_BINDIR "${CONFIG_PREFIX}/${CMAKE_INSTALL_BINDIR}") |
59 |
|
|
set (CONFIG_LIBDIR "${CONFIG_PREFIX}/${CMAKE_INSTALL_LIBDIR}") |
60 |
|
|
set (CONFIG_DATADIR "${CONFIG_PREFIX}/${CMAKE_INSTALL_DATADIR}") |
61 |
|
|
set (CONFIG_MANDIR "${CONFIG_PREFIX}/${CMAKE_INSTALL_MANDIR}") |
62 |
capela |
3567 |
|
63 |
capela |
3570 |
|
64 |
capela |
3567 |
# Enable libgig availability. |
65 |
|
|
option (CONFIG_LIBGIG "Enable libgig interface (default=yes)" 1) |
66 |
|
|
|
67 |
|
|
# Enable unique/single instance. |
68 |
|
|
option (CONFIG_XUNIQUE "Enable unique/single instance (default=yes)" 1) |
69 |
|
|
|
70 |
|
|
# Enable debugger stack-trace option (assumes --enable-debug). |
71 |
|
|
option (CONFIG_STACKTRACE "Enable debugger stack-trace (default=no)" 0) |
72 |
|
|
|
73 |
capela |
4029 |
# Enable Wayland support option. |
74 |
|
|
option (CONFIG_WAYLAND "Enable Wayland support (EXPERIMENTAL) (default=no)" 0) |
75 |
capela |
3571 |
|
76 |
capela |
3869 |
# Enable Qt6 build preference. |
77 |
capela |
3907 |
option (CONFIG_QT6 "Enable Qt6 build (default=yes)" 1) |
78 |
capela |
3869 |
|
79 |
|
|
|
80 |
capela |
3567 |
# Fix for new CMAKE_REQUIRED_LIBRARIES policy. |
81 |
|
|
if (POLICY CMP0075) |
82 |
|
|
cmake_policy (SET CMP0075 NEW) |
83 |
|
|
endif () |
84 |
|
|
|
85 |
capela |
3868 |
# Check for Qt... |
86 |
capela |
3869 |
if (CONFIG_QT6) |
87 |
|
|
find_package (Qt6 QUIET) |
88 |
|
|
if (NOT Qt6_FOUND) |
89 |
|
|
set (CONFIG_QT6 0) |
90 |
|
|
endif () |
91 |
|
|
endif () |
92 |
|
|
|
93 |
|
|
if (CONFIG_QT6) |
94 |
capela |
3868 |
find_package (QT QUIET NAMES Qt6) |
95 |
|
|
else () |
96 |
|
|
find_package (QT QUIET NAMES Qt5) |
97 |
|
|
endif () |
98 |
|
|
|
99 |
capela |
4038 |
find_package (Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core Gui Widgets Svg) |
100 |
capela |
3569 |
|
101 |
|
|
if (CONFIG_XUNIQUE) |
102 |
capela |
3841 |
find_package (Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Network) |
103 |
capela |
3569 |
endif () |
104 |
|
|
|
105 |
capela |
3841 |
find_package (Qt${QT_VERSION_MAJOR}LinguistTools) |
106 |
capela |
3567 |
|
107 |
|
|
include (CheckIncludeFile) |
108 |
|
|
include (CheckIncludeFiles) |
109 |
|
|
include (CheckIncludeFileCXX) |
110 |
|
|
include (CheckFunctionExists) |
111 |
|
|
include (CheckLibraryExists) |
112 |
|
|
|
113 |
|
|
# Checks for libraries. |
114 |
|
|
if (WIN32) |
115 |
|
|
check_function_exists (lroundf CONFIG_ROUND) |
116 |
|
|
else () |
117 |
|
|
find_library (MATH_LIBRARY m) |
118 |
|
|
# Check for round math function. |
119 |
|
|
if (MATH_LIBRARY) |
120 |
|
|
set (CMAKE_REQUIRED_LIBRARIES "${MATH_LIBRARY};${CMAKE_REQUIRED_LIBRARIES}") |
121 |
|
|
check_function_exists (lroundf CONFIG_ROUND) |
122 |
|
|
else () |
123 |
|
|
message (FATAL_ERROR "*** math library not found.") |
124 |
|
|
endif () |
125 |
|
|
endif () |
126 |
|
|
|
127 |
|
|
# Checks for header files. |
128 |
|
|
if (UNIX AND NOT APPLE) |
129 |
|
|
check_include_files ("fcntl.h;unistd.h;signal.h" HAVE_SIGNAL_H) |
130 |
|
|
endif () |
131 |
|
|
|
132 |
|
|
|
133 |
|
|
# Find package modules |
134 |
capela |
3968 |
include (FindPkgConfig) |
135 |
capela |
3567 |
|
136 |
|
|
# Check for LSCP libraries. |
137 |
capela |
3851 |
pkg_check_modules (LSCP REQUIRED IMPORTED_TARGET lscp) |
138 |
capela |
3641 |
if (LSCP_FOUND) |
139 |
capela |
3907 |
find_library(LSCP_LIBRARY NAMES ${LSCP_LIBRARIES} HINTS ${LSCP_LIBDIR}) |
140 |
|
|
endif () |
141 |
|
|
if (LSCP_LIBRARY) |
142 |
capela |
3641 |
set (CONFIG_LIBLSCP 1) |
143 |
capela |
3907 |
set (CMAKE_REQUIRED_LIBRARIES "${LSCP_LIBRARY};${CMAKE_REQUIRED_LIBRARIES}") |
144 |
capela |
3567 |
# Check for for instrument_name in lscp_channel_info_t. |
145 |
capela |
3640 |
check_include_file (lscp/client.h HAVE_LSCP_CLIENT_H) |
146 |
|
|
if (NOT HAVE_LSCP_CLIENT_H) |
147 |
|
|
set (CONFIG_INSTRUMENT_NAME 0) |
148 |
|
|
else () |
149 |
|
|
set (CONFIG_INSTRUMENT_NAME 1) |
150 |
|
|
endif () |
151 |
capela |
3567 |
# Check for mute/solo in lscp_channel_info_t. |
152 |
capela |
3640 |
if (NOT HAVE_LSCP_CLIENT_H) |
153 |
|
|
set (CONFIG_MUTE_SOLO 0) |
154 |
|
|
else () |
155 |
|
|
set (CONFIG_MUTE_SOLO 1) |
156 |
|
|
endif () |
157 |
capela |
3567 |
if (CONFIG_MUTE_SOLO) |
158 |
|
|
check_function_exists (lscp_set_channel_mute CONFIG_MUTE_SOLO) |
159 |
|
|
endif () |
160 |
|
|
if (CONFIG_MUTE_SOLO) |
161 |
|
|
check_function_exists (lscp_set_channel_solo CONFIG_MUTE_SOLO) |
162 |
|
|
endif () |
163 |
|
|
# Check if MIDI instrument mapping is available. |
164 |
|
|
check_function_exists (lscp_map_midi_instrument CONFIG_MIDI_INSTRUMENT) |
165 |
|
|
# Check if FX sends is available. |
166 |
|
|
check_function_exists (lscp_create_fxsend CONFIG_FXSEND) |
167 |
|
|
# Check for FX send level in lscp_fxsend_info_t |
168 |
|
|
if (CONFIG_FXSEND) |
169 |
capela |
3640 |
if (NOT HAVE_LSCP_CLIENT_H) |
170 |
|
|
set (CONFIG_FXSEND_LEVEL 0) |
171 |
|
|
else () |
172 |
|
|
set (CONFIG_FXSEND_LEVEL 1) |
173 |
|
|
endif () |
174 |
capela |
3567 |
endif () |
175 |
|
|
# Check if FX send rename is available. |
176 |
|
|
if (CONFIG_FXSEND) |
177 |
|
|
check_function_exists (lscp_set_fxsend_name CONFIG_FXSEND_RENAME) |
178 |
|
|
endif () |
179 |
|
|
# Check for audio_routing array type |
180 |
capela |
3640 |
if (NOT HAVE_LSCP_CLIENT_H) |
181 |
|
|
set (CONFIG_AUDIO_ROUTING 0) |
182 |
|
|
else () |
183 |
|
|
set (CONFIG_AUDIO_ROUTING 1) |
184 |
|
|
endif () |
185 |
capela |
3567 |
# Check if global volume is available. |
186 |
|
|
check_function_exists (lscp_set_volume CONFIG_VOLUME) |
187 |
|
|
# Check if instrument editing is available. |
188 |
|
|
check_function_exists (lscp_edit_channel_instrument CONFIG_EDIT_INSTRUMENT) |
189 |
|
|
# Check for CHANNEL_MIDI LSCP event support in liblscp], |
190 |
capela |
3640 |
check_include_file (lscp/event.h HAVE_LSCP_EVENT_H) |
191 |
|
|
if (NOT HAVE_LSCP_EVENT_H) |
192 |
|
|
set (CONFIG_EVENT_CHANNEL_MIDI 0) |
193 |
|
|
else () |
194 |
|
|
set (CONFIG_EVENT_CHANNEL_MIDI 1) |
195 |
|
|
endif () |
196 |
capela |
3567 |
# Check for DEVICE_MIDI LSCP event support in liblscp], |
197 |
capela |
3640 |
if (NOT HAVE_LSCP_EVENT_H) |
198 |
|
|
set (CONFIG_EVENT_DEVICE_MIDI 0) |
199 |
|
|
else () |
200 |
|
|
set (CONFIG_EVENT_DEVICE_MIDI 1) |
201 |
|
|
endif () |
202 |
capela |
3567 |
# Check if max. voices / streams is available. |
203 |
|
|
check_function_exists (lscp_get_voices CONFIG_MAX_VOICES) |
204 |
|
|
else () |
205 |
|
|
message (FATAL_ERROR "*** LSCP library not found.") |
206 |
capela |
3641 |
set (CONFIG_LIBLSCP 0) |
207 |
capela |
3567 |
endif () |
208 |
|
|
|
209 |
|
|
# Check for GIG libraries. |
210 |
|
|
if (CONFIG_LIBGIG) |
211 |
capela |
3851 |
pkg_check_modules (GIG IMPORTED_TARGET gig>=3.3.0) |
212 |
capela |
3641 |
if (GIG_FOUND) |
213 |
capela |
3907 |
find_library(GIG_LIBRARY NAMES ${GIG_LIBRARIES} HINTS ${GIG_LIBDIR}) |
214 |
|
|
endif () |
215 |
|
|
if (GIG_LIBRARY) |
216 |
|
|
set (CONFIG_LIBGIG 1) |
217 |
|
|
#set (CMAKE_REQUIRED_LIBRARIES "${GIG_LIBRARY};${CMAKE_REQUIRED_LIBRARIES}") |
218 |
capela |
3567 |
# liggig supports fast information retrieval. |
219 |
|
|
set (CONFIG_LIBGIG_SETAUTOLOAD 1) |
220 |
|
|
# Check if libgig/SF.h is available. |
221 |
capela |
3640 |
check_include_file_cxx (libgig/SF.h HAVE_LIBGIG_SF_H) |
222 |
|
|
if (NOT HAVE_LIBGIG_SF_H) |
223 |
|
|
set (CONFIG_LIBGIG_SF2 0) |
224 |
|
|
else () |
225 |
|
|
set (CONFIG_LIBGIG_SF2 1) |
226 |
|
|
endif () |
227 |
capela |
3567 |
else () |
228 |
|
|
message (WARNING "*** GIG library not found.") |
229 |
capela |
3641 |
set (CONFIG_LIBGIG 0) |
230 |
capela |
3567 |
endif () |
231 |
|
|
endif () |
232 |
|
|
|
233 |
|
|
|
234 |
|
|
add_subdirectory (src) |
235 |
|
|
|
236 |
|
|
|
237 |
|
|
# Configuration status |
238 |
|
|
macro (SHOW_OPTION text value) |
239 |
|
|
if (${value}) |
240 |
capela |
3571 |
message ("${text}: yes") |
241 |
capela |
3567 |
else () |
242 |
capela |
3571 |
message ("${text}: no") |
243 |
capela |
3567 |
endif () |
244 |
|
|
endmacro () |
245 |
|
|
|
246 |
capela |
3569 |
|
247 |
capela |
3868 |
message ("\n ${PACKAGE_NAME} ${PACKAGE_VERSION} (Qt ${QT_VERSION})") |
248 |
capela |
3569 |
message ("\n Build target . . . . . . . . . . . . . . . . . . .: ${CONFIG_BUILD_TYPE}\n") |
249 |
capela |
3567 |
show_option (" LSCP instrument name support . . . . . . . . . . ." CONFIG_INSTRUMENT_NAME) |
250 |
|
|
show_option (" LSCP mute/solo support . . . . . . . . . . . . . ." CONFIG_MUTE_SOLO) |
251 |
|
|
show_option (" LSCP MIDI instrument support . . . . . . . . . . ." CONFIG_MIDI_INSTRUMENT) |
252 |
|
|
show_option (" LSCP FX send support . . . . . . . . . . . . . . ." CONFIG_FXSEND) |
253 |
|
|
show_option (" LSCP FX send level support . . . . . . . . . . . ." CONFIG_FXSEND_LEVEL) |
254 |
|
|
show_option (" LSCP FX send rename support . . . . . . . . . . ." CONFIG_FXSEND_RENAME) |
255 |
|
|
show_option (" LSCP audio routing support . . . . . . . . . . . ." CONFIG_AUDIO_ROUTING) |
256 |
|
|
show_option (" LSCP volume support . . . . . . . . . . . . . . ." CONFIG_VOLUME) |
257 |
|
|
show_option (" LSCP edit instrument support . . . . . . . . . . ." CONFIG_EDIT_INSTRUMENT) |
258 |
|
|
show_option (" GigaSampler instrument file support (libgig) . . ." CONFIG_LIBGIG) |
259 |
|
|
if (CONFIG_LIBGIG) |
260 |
|
|
show_option (" libgig supports fast information retrieval . . . ." CONFIG_LIBGIG_SETAUTOLOAD) |
261 |
|
|
show_option (" libgig supports SoundFont2 instruments files . . ." CONFIG_LIBGIG_SF2) |
262 |
|
|
endif () |
263 |
|
|
show_option (" LSCP channel MIDI event support . . . . . . . . ." CONFIG_EVENT_CHANNEL_MIDI) |
264 |
|
|
show_option (" LSCP device MIDI event support . . . . . . . . . ." CONFIG_EVENT_DEVICE_MIDI) |
265 |
|
|
show_option (" LSCP runtime max. voices / disk streams support ." CONFIG_MAX_VOICES) |
266 |
capela |
3569 |
message ("") |
267 |
capela |
3567 |
show_option (" Unique/Single instance support . . . . . . . . . ." CONFIG_XUNIQUE) |
268 |
|
|
show_option (" Debugger stack-trace (gdb) . . . . . . . . . . . ." CONFIG_STACKTRACE) |
269 |
capela |
4005 |
message ("\n Install prefix . . . . . . . . . . . . . . . . . .: ${CONFIG_PREFIX}\n") |