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) |
74 |
cmake_policy (SET CMP0075 NEW) |
cmake_policy (SET CMP0075 NEW) |
75 |
endif () |
endif () |
76 |
|
|
77 |
# Check for Qt |
# Check for Qt... |
78 |
find_package (Qt5 REQUIRED COMPONENTS Core Gui Widgets) |
find_package (Qt6 QUIET) |
79 |
|
if (Qt6_FOUND) |
80 |
|
find_package (QT QUIET NAMES Qt6) |
81 |
|
else () |
82 |
|
find_package (QT QUIET NAMES Qt5) |
83 |
|
endif () |
84 |
|
|
85 |
|
find_package (Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core Gui Widgets) |
86 |
|
|
87 |
if (CONFIG_XUNIQUE) |
if (CONFIG_XUNIQUE) |
88 |
find_package (Qt5 REQUIRED COMPONENTS Network) |
find_package (Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Network) |
89 |
endif () |
endif () |
90 |
|
|
91 |
find_package (Qt5LinguistTools) |
find_package (Qt${QT_VERSION_MAJOR}LinguistTools) |
92 |
|
|
93 |
include (CheckIncludeFile) |
include (CheckIncludeFile) |
94 |
include (CheckIncludeFiles) |
include (CheckIncludeFiles) |
120 |
find_package (PkgConfig REQUIRED) |
find_package (PkgConfig REQUIRED) |
121 |
|
|
122 |
# Check for LSCP libraries. |
# Check for LSCP libraries. |
123 |
pkg_check_modules (LSCP REQUIRED lscp) |
pkg_check_modules (LSCP REQUIRED IMPORTED_TARGET lscp) |
124 |
set (CONFIG_LIBLSCP ${LSCP_FOUND}) |
if (LSCP_FOUND) |
125 |
if (CONFIG_LIBLSCP) |
set (CONFIG_LIBLSCP 1) |
126 |
include_directories (${LSCP_INCLUDE_DIRS}) |
include_directories (${LSCP_INCLUDE_DIRS}) |
127 |
link_directories (${LSCP_LIBRARY_DIRS}) |
link_directories (${LSCP_LIBRARY_DIRS}) |
128 |
# link_libraries (${LSCP_LIBRARIES}) |
# link_libraries (${LSCP_LIBRARIES}) |
129 |
set (CMAKE_REQUIRED_LIBRARIES "${LSCP_LIBRARIES};${CMAKE_REQUIRED_LIBRARIES}") |
set (CMAKE_REQUIRED_LIBRARIES "${LSCP_LIBRARIES};${CMAKE_REQUIRED_LIBRARIES}") |
130 |
# Check for for instrument_name in lscp_channel_info_t. |
# Check for for instrument_name in lscp_channel_info_t. |
131 |
check_include_file (lscp/client.h CONFIG_INSTRUMENT_NAME) |
check_include_file (lscp/client.h HAVE_LSCP_CLIENT_H) |
132 |
|
if (NOT HAVE_LSCP_CLIENT_H) |
133 |
|
set (CONFIG_INSTRUMENT_NAME 0) |
134 |
|
else () |
135 |
|
set (CONFIG_INSTRUMENT_NAME 1) |
136 |
|
endif () |
137 |
# Check for mute/solo in lscp_channel_info_t. |
# Check for mute/solo in lscp_channel_info_t. |
138 |
check_include_file (lscp/client.h CONFIG_MUTE_SOLO) |
if (NOT HAVE_LSCP_CLIENT_H) |
139 |
|
set (CONFIG_MUTE_SOLO 0) |
140 |
|
else () |
141 |
|
set (CONFIG_MUTE_SOLO 1) |
142 |
|
endif () |
143 |
if (CONFIG_MUTE_SOLO) |
if (CONFIG_MUTE_SOLO) |
144 |
check_function_exists (lscp_set_channel_mute CONFIG_MUTE_SOLO) |
check_function_exists (lscp_set_channel_mute CONFIG_MUTE_SOLO) |
145 |
endif () |
endif () |
152 |
check_function_exists (lscp_create_fxsend CONFIG_FXSEND) |
check_function_exists (lscp_create_fxsend CONFIG_FXSEND) |
153 |
# Check for FX send level in lscp_fxsend_info_t |
# Check for FX send level in lscp_fxsend_info_t |
154 |
if (CONFIG_FXSEND) |
if (CONFIG_FXSEND) |
155 |
check_include_file (lscp/client.h CONFIG_FXSEND_LEVEL) |
if (NOT HAVE_LSCP_CLIENT_H) |
156 |
|
set (CONFIG_FXSEND_LEVEL 0) |
157 |
|
else () |
158 |
|
set (CONFIG_FXSEND_LEVEL 1) |
159 |
|
endif () |
160 |
endif () |
endif () |
161 |
# Check if FX send rename is available. |
# Check if FX send rename is available. |
162 |
if (CONFIG_FXSEND) |
if (CONFIG_FXSEND) |
163 |
check_function_exists (lscp_set_fxsend_name CONFIG_FXSEND_RENAME) |
check_function_exists (lscp_set_fxsend_name CONFIG_FXSEND_RENAME) |
164 |
endif () |
endif () |
165 |
# Check for audio_routing array type |
# Check for audio_routing array type |
166 |
check_include_file (lscp/client.h CONFIG_AUDIO_ROUTING) |
if (NOT HAVE_LSCP_CLIENT_H) |
167 |
|
set (CONFIG_AUDIO_ROUTING 0) |
168 |
|
else () |
169 |
|
set (CONFIG_AUDIO_ROUTING 1) |
170 |
|
endif () |
171 |
# Check if global volume is available. |
# Check if global volume is available. |
172 |
check_function_exists (lscp_set_volume CONFIG_VOLUME) |
check_function_exists (lscp_set_volume CONFIG_VOLUME) |
173 |
# Check if instrument editing is available. |
# Check if instrument editing is available. |
174 |
check_function_exists (lscp_edit_channel_instrument CONFIG_EDIT_INSTRUMENT) |
check_function_exists (lscp_edit_channel_instrument CONFIG_EDIT_INSTRUMENT) |
175 |
# Check for CHANNEL_MIDI LSCP event support in liblscp], |
# Check for CHANNEL_MIDI LSCP event support in liblscp], |
176 |
check_include_file (lscp/event.h CONFIG_EVENT_CHANNEL_MIDI) |
check_include_file (lscp/event.h HAVE_LSCP_EVENT_H) |
177 |
|
if (NOT HAVE_LSCP_EVENT_H) |
178 |
|
set (CONFIG_EVENT_CHANNEL_MIDI 0) |
179 |
|
else () |
180 |
|
set (CONFIG_EVENT_CHANNEL_MIDI 1) |
181 |
|
endif () |
182 |
# Check for DEVICE_MIDI LSCP event support in liblscp], |
# Check for DEVICE_MIDI LSCP event support in liblscp], |
183 |
check_include_file (lscp/event.h CONFIG_EVENT_DEVICE_MIDI) |
if (NOT HAVE_LSCP_EVENT_H) |
184 |
|
set (CONFIG_EVENT_DEVICE_MIDI 0) |
185 |
|
else () |
186 |
|
set (CONFIG_EVENT_DEVICE_MIDI 1) |
187 |
|
endif () |
188 |
# Check if max. voices / streams is available. |
# Check if max. voices / streams is available. |
189 |
check_function_exists (lscp_get_voices CONFIG_MAX_VOICES) |
check_function_exists (lscp_get_voices CONFIG_MAX_VOICES) |
190 |
else () |
else () |
191 |
message (FATAL_ERROR "*** LSCP library not found.") |
message (FATAL_ERROR "*** LSCP library not found.") |
192 |
|
set (CONFIG_LIBLSCP 0) |
193 |
endif () |
endif () |
194 |
|
|
195 |
# Check for GIG libraries. |
# Check for GIG libraries. |
196 |
if (CONFIG_LIBGIG) |
if (CONFIG_LIBGIG) |
197 |
pkg_check_modules (GIG gig>=3.3.0) |
pkg_check_modules (GIG IMPORTED_TARGET gig>=3.3.0) |
198 |
set (CONFIG_LIBGIG ${GIG_FOUND}) |
if (GIG_FOUND) |
|
if (CONFIG_LIBGIG) |
|
199 |
include_directories (${GIG_INCLUDE_DIRS}) |
include_directories (${GIG_INCLUDE_DIRS}) |
200 |
link_directories (${GIG_LIBRARY_DIRS}) |
link_directories (${GIG_LIBRARY_DIRS}) |
201 |
link_libraries (${GIG_LIBRARIES}) |
link_libraries (${GIG_LIBRARIES}) |
203 |
# liggig supports fast information retrieval. |
# liggig supports fast information retrieval. |
204 |
set (CONFIG_LIBGIG_SETAUTOLOAD 1) |
set (CONFIG_LIBGIG_SETAUTOLOAD 1) |
205 |
# Check if libgig/SF.h is available. |
# Check if libgig/SF.h is available. |
206 |
check_include_file_cxx (libgig/SF.h CONFIG_LIBGIG_SF2) |
check_include_file_cxx (libgig/SF.h HAVE_LIBGIG_SF_H) |
207 |
|
if (NOT HAVE_LIBGIG_SF_H) |
208 |
|
set (CONFIG_LIBGIG_SF2 0) |
209 |
|
else () |
210 |
|
set (CONFIG_LIBGIG_SF2 1) |
211 |
|
endif () |
212 |
else () |
else () |
213 |
message (WARNING "*** GIG library not found.") |
message (WARNING "*** GIG library not found.") |
214 |
|
set (CONFIG_LIBGIG 0) |
215 |
endif () |
endif () |
216 |
endif () |
endif () |
217 |
|
|
233 |
endmacro () |
endmacro () |
234 |
|
|
235 |
|
|
236 |
message ("\n ${PACKAGE_NAME} ${PACKAGE_VERSION}") |
message ("\n ${PACKAGE_NAME} ${PACKAGE_VERSION} (Qt ${QT_VERSION})") |
237 |
message ("\n Build target . . . . . . . . . . . . . . . . . . .: ${CONFIG_BUILD_TYPE}\n") |
message ("\n Build target . . . . . . . . . . . . . . . . . . .: ${CONFIG_BUILD_TYPE}\n") |
238 |
show_option (" LSCP instrument name support . . . . . . . . . . ." CONFIG_INSTRUMENT_NAME) |
show_option (" LSCP instrument name support . . . . . . . . . . ." CONFIG_INSTRUMENT_NAME) |
239 |
show_option (" LSCP mute/solo support . . . . . . . . . . . . . ." CONFIG_MUTE_SOLO) |
show_option (" LSCP mute/solo support . . . . . . . . . . . . . ." CONFIG_MUTE_SOLO) |