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