1 |
project(QSAMPLER) |
cmake_minimum_required(VERSION 3.10) |
2 |
|
|
3 |
cmake_minimum_required(VERSION 3.1) |
project(qsampler |
4 |
|
VERSION 0.9.3 |
5 |
|
DESCRIPTION "A LinuxSampler Qt GUI Interface" |
6 |
|
LANGUAGES C CXX) |
7 |
|
|
8 |
set (VERSION "0.6.0") |
set (CONFIG_VERSION ${PROJECT_VERSION}) |
|
|
|
|
set (CONFIG_VERSION ${VERSION}) |
|
9 |
execute_process ( |
execute_process ( |
10 |
COMMAND git describe --tags --dirty --abbrev=6 |
COMMAND git describe --tags --dirty --abbrev=6 |
11 |
OUTPUT_VARIABLE GIT_DESCRIBE_OUTPUT |
OUTPUT_VARIABLE GIT_DESCRIBE_OUTPUT |
13 |
OUTPUT_STRIP_TRAILING_WHITESPACE) |
OUTPUT_STRIP_TRAILING_WHITESPACE) |
14 |
if (GIT_DESCRIBE_RESULT EQUAL 0) |
if (GIT_DESCRIBE_RESULT EQUAL 0) |
15 |
set (VERSION "${GIT_DESCRIBE_OUTPUT}") |
set (VERSION "${GIT_DESCRIBE_OUTPUT}") |
16 |
string (REGEX REPLACE "^[^_]+" "" VERSION "${VERSION}") |
string (REGEX REPLACE "^[^0-9]+" "" VERSION "${VERSION}") |
|
string (REGEX REPLACE "^[_vV]+" "" VERSION "${VERSION}") |
|
17 |
string (REGEX REPLACE "-g" "git." VERSION "${VERSION}") |
string (REGEX REPLACE "-g" "git." VERSION "${VERSION}") |
18 |
string (REGEX REPLACE "[_|-]+" "." VERSION "${VERSION}") |
string (REGEX REPLACE "[_|-]+" "." VERSION "${VERSION}") |
19 |
execute_process ( |
execute_process ( |
24 |
if (GIT_REVPARSE_RESULT EQUAL 0 AND NOT GIT_REVPARSE_OUTPUT STREQUAL "master") |
if (GIT_REVPARSE_RESULT EQUAL 0 AND NOT GIT_REVPARSE_OUTPUT STREQUAL "master") |
25 |
set (VERSION "${VERSION} [${GIT_REVPARSE_OUTPUT}]") |
set (VERSION "${VERSION} [${GIT_REVPARSE_OUTPUT}]") |
26 |
endif () |
endif () |
27 |
|
else () |
28 |
|
set (VERSION "${PROJECT_VERSION}") |
29 |
endif () |
endif () |
30 |
|
|
31 |
set (PACKAGE_NAME "Qsampler") |
set (PACKAGE_NAME "Qsampler") |
34 |
set (PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}") |
set (PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}") |
35 |
set (PACKAGE_TARNAME "qsampler") |
set (PACKAGE_TARNAME "qsampler") |
36 |
|
|
37 |
|
set (ac_version "${PROJECT_VERSION}") |
38 |
|
set (ac_prefix "${CMAKE_INSTALL_PREFIX}") |
39 |
|
|
40 |
set (CONFIG_BUILD_VERSION "${PACKAGE_VERSION}") |
set (CONFIG_BUILD_VERSION "${PACKAGE_VERSION}") |
41 |
|
|
42 |
if (CMAKE_BUILD_TYPE) |
if (CMAKE_BUILD_TYPE) |
69 |
option (CONFIG_STACKTRACE "Enable debugger stack-trace (default=no)" 0) |
option (CONFIG_STACKTRACE "Enable debugger stack-trace (default=no)" 0) |
70 |
|
|
71 |
|
|
72 |
|
# Enable Qt6 build preference. |
73 |
|
option (CONFIG_QT6 "Enable Qt6 build (default=no)" 0) |
74 |
|
|
75 |
|
|
76 |
# Fix for new CMAKE_REQUIRED_LIBRARIES policy. |
# Fix for new CMAKE_REQUIRED_LIBRARIES policy. |
77 |
if (POLICY CMP0075) |
if (POLICY CMP0075) |
78 |
cmake_policy (SET CMP0075 NEW) |
cmake_policy (SET CMP0075 NEW) |
79 |
endif () |
endif () |
80 |
|
|
81 |
# Check for Qt |
# Check for Qt... |
82 |
find_package (Qt5 REQUIRED COMPONENTS Core Gui Widgets) |
if (CONFIG_QT6) |
83 |
|
find_package (Qt6 QUIET) |
84 |
|
if (NOT Qt6_FOUND) |
85 |
|
set (CONFIG_QT6 0) |
86 |
|
endif () |
87 |
|
endif () |
88 |
|
|
89 |
|
if (CONFIG_QT6) |
90 |
|
find_package (QT QUIET NAMES Qt6) |
91 |
|
else () |
92 |
|
find_package (QT QUIET NAMES Qt5) |
93 |
|
endif () |
94 |
|
|
95 |
|
find_package (Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core Gui Widgets) |
96 |
|
|
97 |
if (CONFIG_XUNIQUE) |
if (CONFIG_XUNIQUE) |
98 |
find_package (Qt5 REQUIRED COMPONENTS Network) |
find_package (Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Network) |
99 |
endif () |
endif () |
100 |
|
|
101 |
find_package (Qt5LinguistTools) |
find_package (Qt${QT_VERSION_MAJOR}LinguistTools) |
102 |
|
|
103 |
include (CheckIncludeFile) |
include (CheckIncludeFile) |
104 |
include (CheckIncludeFiles) |
include (CheckIncludeFiles) |
130 |
find_package (PkgConfig REQUIRED) |
find_package (PkgConfig REQUIRED) |
131 |
|
|
132 |
# Check for LSCP libraries. |
# Check for LSCP libraries. |
133 |
pkg_check_modules (LSCP REQUIRED lscp) |
pkg_check_modules (LSCP REQUIRED IMPORTED_TARGET lscp) |
134 |
set (CONFIG_LIBLSCP ${LSCP_FOUND}) |
if (LSCP_FOUND) |
135 |
if (CONFIG_LIBLSCP) |
set (CONFIG_LIBLSCP 1) |
136 |
include_directories (${LSCP_INCLUDE_DIRS}) |
include_directories (${LSCP_INCLUDE_DIRS}) |
137 |
link_directories (${LSCP_LIBRARY_DIRS}) |
link_directories (${LSCP_LIBRARY_DIRS}) |
138 |
# link_libraries (${LSCP_LIBRARIES}) |
# link_libraries (${LSCP_LIBRARIES}) |
139 |
set (CMAKE_REQUIRED_LIBRARIES "${LSCP_LIBRARIES};${CMAKE_REQUIRED_LIBRARIES}") |
set (CMAKE_REQUIRED_LIBRARIES "${LSCP_LIBRARIES};${CMAKE_REQUIRED_LIBRARIES}") |
140 |
# Check for for instrument_name in lscp_channel_info_t. |
# Check for for instrument_name in lscp_channel_info_t. |
141 |
check_include_file (lscp/client.h CONFIG_INSTRUMENT_NAME) |
check_include_file (lscp/client.h HAVE_LSCP_CLIENT_H) |
142 |
|
if (NOT HAVE_LSCP_CLIENT_H) |
143 |
|
set (CONFIG_INSTRUMENT_NAME 0) |
144 |
|
else () |
145 |
|
set (CONFIG_INSTRUMENT_NAME 1) |
146 |
|
endif () |
147 |
# Check for mute/solo in lscp_channel_info_t. |
# Check for mute/solo in lscp_channel_info_t. |
148 |
check_include_file (lscp/client.h CONFIG_MUTE_SOLO) |
if (NOT HAVE_LSCP_CLIENT_H) |
149 |
|
set (CONFIG_MUTE_SOLO 0) |
150 |
|
else () |
151 |
|
set (CONFIG_MUTE_SOLO 1) |
152 |
|
endif () |
153 |
if (CONFIG_MUTE_SOLO) |
if (CONFIG_MUTE_SOLO) |
154 |
check_function_exists (lscp_set_channel_mute CONFIG_MUTE_SOLO) |
check_function_exists (lscp_set_channel_mute CONFIG_MUTE_SOLO) |
155 |
endif () |
endif () |
162 |
check_function_exists (lscp_create_fxsend CONFIG_FXSEND) |
check_function_exists (lscp_create_fxsend CONFIG_FXSEND) |
163 |
# Check for FX send level in lscp_fxsend_info_t |
# Check for FX send level in lscp_fxsend_info_t |
164 |
if (CONFIG_FXSEND) |
if (CONFIG_FXSEND) |
165 |
check_include_file (lscp/client.h CONFIG_FXSEND_LEVEL) |
if (NOT HAVE_LSCP_CLIENT_H) |
166 |
|
set (CONFIG_FXSEND_LEVEL 0) |
167 |
|
else () |
168 |
|
set (CONFIG_FXSEND_LEVEL 1) |
169 |
|
endif () |
170 |
endif () |
endif () |
171 |
# Check if FX send rename is available. |
# Check if FX send rename is available. |
172 |
if (CONFIG_FXSEND) |
if (CONFIG_FXSEND) |
173 |
check_function_exists (lscp_set_fxsend_name CONFIG_FXSEND_RENAME) |
check_function_exists (lscp_set_fxsend_name CONFIG_FXSEND_RENAME) |
174 |
endif () |
endif () |
175 |
# Check for audio_routing array type |
# Check for audio_routing array type |
176 |
check_include_file (lscp/client.h CONFIG_AUDIO_ROUTING) |
if (NOT HAVE_LSCP_CLIENT_H) |
177 |
|
set (CONFIG_AUDIO_ROUTING 0) |
178 |
|
else () |
179 |
|
set (CONFIG_AUDIO_ROUTING 1) |
180 |
|
endif () |
181 |
# Check if global volume is available. |
# Check if global volume is available. |
182 |
check_function_exists (lscp_set_volume CONFIG_VOLUME) |
check_function_exists (lscp_set_volume CONFIG_VOLUME) |
183 |
# Check if instrument editing is available. |
# Check if instrument editing is available. |
184 |
check_function_exists (lscp_edit_channel_instrument CONFIG_EDIT_INSTRUMENT) |
check_function_exists (lscp_edit_channel_instrument CONFIG_EDIT_INSTRUMENT) |
185 |
# Check for CHANNEL_MIDI LSCP event support in liblscp], |
# Check for CHANNEL_MIDI LSCP event support in liblscp], |
186 |
check_include_file (lscp/event.h CONFIG_EVENT_CHANNEL_MIDI) |
check_include_file (lscp/event.h HAVE_LSCP_EVENT_H) |
187 |
|
if (NOT HAVE_LSCP_EVENT_H) |
188 |
|
set (CONFIG_EVENT_CHANNEL_MIDI 0) |
189 |
|
else () |
190 |
|
set (CONFIG_EVENT_CHANNEL_MIDI 1) |
191 |
|
endif () |
192 |
# Check for DEVICE_MIDI LSCP event support in liblscp], |
# Check for DEVICE_MIDI LSCP event support in liblscp], |
193 |
check_include_file (lscp/event.h CONFIG_EVENT_DEVICE_MIDI) |
if (NOT HAVE_LSCP_EVENT_H) |
194 |
|
set (CONFIG_EVENT_DEVICE_MIDI 0) |
195 |
|
else () |
196 |
|
set (CONFIG_EVENT_DEVICE_MIDI 1) |
197 |
|
endif () |
198 |
# Check if max. voices / streams is available. |
# Check if max. voices / streams is available. |
199 |
check_function_exists (lscp_get_voices CONFIG_MAX_VOICES) |
check_function_exists (lscp_get_voices CONFIG_MAX_VOICES) |
200 |
else () |
else () |
201 |
message (FATAL_ERROR "*** LSCP library not found.") |
message (FATAL_ERROR "*** LSCP library not found.") |
202 |
|
set (CONFIG_LIBLSCP 0) |
203 |
endif () |
endif () |
204 |
|
|
205 |
# Check for GIG libraries. |
# Check for GIG libraries. |
206 |
if (CONFIG_LIBGIG) |
if (CONFIG_LIBGIG) |
207 |
pkg_check_modules (GIG gig>=3.3.0) |
pkg_check_modules (GIG IMPORTED_TARGET gig>=3.3.0) |
208 |
set (CONFIG_LIBGIG ${GIG_FOUND}) |
if (GIG_FOUND) |
|
if (CONFIG_LIBGIG) |
|
209 |
include_directories (${GIG_INCLUDE_DIRS}) |
include_directories (${GIG_INCLUDE_DIRS}) |
210 |
link_directories (${GIG_LIBRARY_DIRS}) |
link_directories (${GIG_LIBRARY_DIRS}) |
211 |
link_libraries (${GIG_LIBRARIES}) |
link_libraries (${GIG_LIBRARIES}) |
213 |
# liggig supports fast information retrieval. |
# liggig supports fast information retrieval. |
214 |
set (CONFIG_LIBGIG_SETAUTOLOAD 1) |
set (CONFIG_LIBGIG_SETAUTOLOAD 1) |
215 |
# Check if libgig/SF.h is available. |
# Check if libgig/SF.h is available. |
216 |
check_include_file_cxx (libgig/SF.h CONFIG_LIBGIG_SF2) |
check_include_file_cxx (libgig/SF.h HAVE_LIBGIG_SF_H) |
217 |
|
if (NOT HAVE_LIBGIG_SF_H) |
218 |
|
set (CONFIG_LIBGIG_SF2 0) |
219 |
|
else () |
220 |
|
set (CONFIG_LIBGIG_SF2 1) |
221 |
|
endif () |
222 |
else () |
else () |
223 |
message (WARNING "*** GIG library not found.") |
message (WARNING "*** GIG library not found.") |
224 |
|
set (CONFIG_LIBGIG 0) |
225 |
endif () |
endif () |
226 |
endif () |
endif () |
227 |
|
|
243 |
endmacro () |
endmacro () |
244 |
|
|
245 |
|
|
246 |
message ("\n ${PACKAGE_NAME} ${PACKAGE_VERSION}") |
message ("\n ${PACKAGE_NAME} ${PACKAGE_VERSION} (Qt ${QT_VERSION})") |
247 |
message ("\n Build target . . . . . . . . . . . . . . . . . . .: ${CONFIG_BUILD_TYPE}\n") |
message ("\n Build target . . . . . . . . . . . . . . . . . . .: ${CONFIG_BUILD_TYPE}\n") |
248 |
show_option (" LSCP instrument name support . . . . . . . . . . ." CONFIG_INSTRUMENT_NAME) |
show_option (" LSCP instrument name support . . . . . . . . . . ." CONFIG_INSTRUMENT_NAME) |
249 |
show_option (" LSCP mute/solo support . . . . . . . . . . . . . ." CONFIG_MUTE_SOLO) |
show_option (" LSCP mute/solo support . . . . . . . . . . . . . ." CONFIG_MUTE_SOLO) |