1 |
project(QSAMPLER) |
project(QSAMPLER) |
2 |
|
|
3 |
cmake_minimum_required(VERSION 2.6) |
cmake_minimum_required(VERSION 3.1) |
4 |
|
|
5 |
set (VERSION "0.5.7") |
set (VERSION "0.6.3") |
6 |
|
|
7 |
|
set (CONFIG_VERSION ${VERSION}) |
8 |
execute_process ( |
execute_process ( |
9 |
COMMAND git describe --tags --dirty --abbrev=6 |
COMMAND git describe --tags --dirty --abbrev=6 |
10 |
OUTPUT_VARIABLE GIT_DESCRIBE_OUTPUT |
OUTPUT_VARIABLE GIT_DESCRIBE_OUTPUT |
12 |
OUTPUT_STRIP_TRAILING_WHITESPACE) |
OUTPUT_STRIP_TRAILING_WHITESPACE) |
13 |
if (GIT_DESCRIBE_RESULT EQUAL 0) |
if (GIT_DESCRIBE_RESULT EQUAL 0) |
14 |
set (VERSION "${GIT_DESCRIBE_OUTPUT}") |
set (VERSION "${GIT_DESCRIBE_OUTPUT}") |
15 |
string (REGEX REPLACE "^[^_vV]+" "" VERSION "${VERSION}") |
string (REGEX REPLACE "^[^_]+" "" VERSION "${VERSION}") |
16 |
string (REGEX REPLACE "^[_vV]+" "" 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}") |
23 |
OUTPUT_STRIP_TRAILING_WHITESPACE) |
OUTPUT_STRIP_TRAILING_WHITESPACE) |
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 |
endif () |
endif () |
28 |
|
|
29 |
set (PACKAGE_NAME "Qsampler") |
set (PACKAGE_NAME "Qsampler") |
35 |
set (CONFIG_BUILD_VERSION "${PACKAGE_VERSION}") |
set (CONFIG_BUILD_VERSION "${PACKAGE_VERSION}") |
36 |
|
|
37 |
if (CMAKE_BUILD_TYPE) |
if (CMAKE_BUILD_TYPE) |
38 |
set (CONFIG_BUILD_TYPE CMAKE_BUILD_TYPE) |
set (CONFIG_BUILD_TYPE ${CMAKE_BUILD_TYPE}) |
39 |
else () |
else () |
40 |
set (CONFIG_BUILD_TYPE "release") |
set (CONFIG_BUILD_TYPE "release") |
41 |
endif () |
endif () |
42 |
|
|
43 |
set (CONFIG_DEBUG) |
set (CONFIG_DEBUG 0) |
44 |
if (CONFIG_BUILD_TYPE MATCHES "debug") |
if (CONFIG_BUILD_TYPE MATCHES "debug") |
45 |
set(CONFIG_DEBUG 1) |
set (CONFIG_DEBUG 1) |
46 |
endif () |
endif () |
47 |
|
|
48 |
set (CONFIG_PREFIX "${CMAKE_INSTALL_PREFIX}") |
set (CONFIG_PREFIX "${CMAKE_INSTALL_PREFIX}") |
49 |
|
|
50 |
|
include (GNUInstallDirs) |
51 |
|
set (CONFIG_BINDIR "${CONFIG_PREFIX}/${CMAKE_INSTALL_BINDIR}") |
52 |
|
set (CONFIG_LIBDIR "${CONFIG_PREFIX}/${CMAKE_INSTALL_LIBDIR}") |
53 |
|
set (CONFIG_DATADIR "${CONFIG_PREFIX}/${CMAKE_INSTALL_DATADIR}") |
54 |
|
set (CONFIG_MANDIR "${CONFIG_PREFIX}/${CMAKE_INSTALL_MANDIR}") |
55 |
|
|
56 |
|
|
57 |
# Enable libgig availability. |
# Enable libgig availability. |
58 |
option (CONFIG_LIBGIG "Enable libgig interface (default=yes)" 1) |
option (CONFIG_LIBGIG "Enable libgig interface (default=yes)" 1) |
63 |
# Enable debugger stack-trace option (assumes --enable-debug). |
# Enable debugger stack-trace option (assumes --enable-debug). |
64 |
option (CONFIG_STACKTRACE "Enable debugger stack-trace (default=no)" 0) |
option (CONFIG_STACKTRACE "Enable debugger stack-trace (default=no)" 0) |
65 |
|
|
66 |
|
|
67 |
# Fix for new CMAKE_REQUIRED_LIBRARIES policy. |
# Fix for new CMAKE_REQUIRED_LIBRARIES policy. |
68 |
if (POLICY CMP0075) |
if (POLICY CMP0075) |
69 |
cmake_policy (SET CMP0075 NEW) |
cmake_policy (SET CMP0075 NEW) |
70 |
endif () |
endif () |
71 |
|
|
72 |
# Check for Qt |
# Check for Qt |
73 |
find_package (Qt5 REQUIRED NO_MODULE COMPONENTS Core Gui Widgets) |
find_package (Qt5 REQUIRED COMPONENTS Core Gui Widgets) |
74 |
|
|
75 |
if (CONFIG_XUNIQUE) |
if (CONFIG_XUNIQUE) |
76 |
find_package (Qt5 REQUIRED NO_MODULE COMPONENTS Network) |
find_package (Qt5 REQUIRED COMPONENTS Network) |
77 |
endif () |
endif () |
78 |
|
|
79 |
find_package (Qt5LinguistTools) |
find_package (Qt5LinguistTools) |
80 |
|
|
|
include (GNUInstallDirs) |
|
81 |
include (CheckIncludeFile) |
include (CheckIncludeFile) |
82 |
include (CheckIncludeFiles) |
include (CheckIncludeFiles) |
83 |
include (CheckIncludeFileCXX) |
include (CheckIncludeFileCXX) |
109 |
|
|
110 |
# Check for LSCP libraries. |
# Check for LSCP libraries. |
111 |
pkg_check_modules (LSCP REQUIRED lscp) |
pkg_check_modules (LSCP REQUIRED lscp) |
112 |
set (CONFIG_LIBLSCP ${LSCP_FOUND}) |
if (LSCP_FOUND) |
113 |
if (CONFIG_LIBLSCP) |
set (CONFIG_LIBLSCP 1) |
114 |
include_directories (${LSCP_INCLUDE_DIRS}) |
include_directories (${LSCP_INCLUDE_DIRS}) |
115 |
link_directories (${LSCP_LIBRARY_DIRS}) |
link_directories (${LSCP_LIBRARY_DIRS}) |
116 |
|
# link_libraries (${LSCP_LIBRARIES}) |
117 |
set (CMAKE_REQUIRED_LIBRARIES "${LSCP_LIBRARIES};${CMAKE_REQUIRED_LIBRARIES}") |
set (CMAKE_REQUIRED_LIBRARIES "${LSCP_LIBRARIES};${CMAKE_REQUIRED_LIBRARIES}") |
118 |
# Check for for instrument_name in lscp_channel_info_t. |
# Check for for instrument_name in lscp_channel_info_t. |
119 |
check_include_file (lscp/client.h CONFIG_INSTRUMENT_NAME) |
check_include_file (lscp/client.h HAVE_LSCP_CLIENT_H) |
120 |
|
if (NOT HAVE_LSCP_CLIENT_H) |
121 |
|
set (CONFIG_INSTRUMENT_NAME 0) |
122 |
|
else () |
123 |
|
set (CONFIG_INSTRUMENT_NAME 1) |
124 |
|
endif () |
125 |
# Check for mute/solo in lscp_channel_info_t. |
# Check for mute/solo in lscp_channel_info_t. |
126 |
check_include_file (lscp/client.h CONFIG_MUTE_SOLO) |
if (NOT HAVE_LSCP_CLIENT_H) |
127 |
|
set (CONFIG_MUTE_SOLO 0) |
128 |
|
else () |
129 |
|
set (CONFIG_MUTE_SOLO 1) |
130 |
|
endif () |
131 |
if (CONFIG_MUTE_SOLO) |
if (CONFIG_MUTE_SOLO) |
132 |
check_function_exists (lscp_set_channel_mute CONFIG_MUTE_SOLO) |
check_function_exists (lscp_set_channel_mute CONFIG_MUTE_SOLO) |
133 |
endif () |
endif () |
140 |
check_function_exists (lscp_create_fxsend CONFIG_FXSEND) |
check_function_exists (lscp_create_fxsend CONFIG_FXSEND) |
141 |
# Check for FX send level in lscp_fxsend_info_t |
# Check for FX send level in lscp_fxsend_info_t |
142 |
if (CONFIG_FXSEND) |
if (CONFIG_FXSEND) |
143 |
check_include_file (lscp/client.h CONFIG_FXSEND_LEVEL) |
if (NOT HAVE_LSCP_CLIENT_H) |
144 |
|
set (CONFIG_FXSEND_LEVEL 0) |
145 |
|
else () |
146 |
|
set (CONFIG_FXSEND_LEVEL 1) |
147 |
|
endif () |
148 |
endif () |
endif () |
149 |
# Check if FX send rename is available. |
# Check if FX send rename is available. |
150 |
if (CONFIG_FXSEND) |
if (CONFIG_FXSEND) |
151 |
check_function_exists (lscp_set_fxsend_name CONFIG_FXSEND_RENAME) |
check_function_exists (lscp_set_fxsend_name CONFIG_FXSEND_RENAME) |
152 |
endif () |
endif () |
153 |
# Check for audio_routing array type |
# Check for audio_routing array type |
154 |
check_include_file (lscp/client.h CONFIG_AUDIO_ROUTING) |
if (NOT HAVE_LSCP_CLIENT_H) |
155 |
|
set (CONFIG_AUDIO_ROUTING 0) |
156 |
|
else () |
157 |
|
set (CONFIG_AUDIO_ROUTING 1) |
158 |
|
endif () |
159 |
# Check if global volume is available. |
# Check if global volume is available. |
160 |
check_function_exists (lscp_set_volume CONFIG_VOLUME) |
check_function_exists (lscp_set_volume CONFIG_VOLUME) |
161 |
# Check if instrument editing is available. |
# Check if instrument editing is available. |
162 |
check_function_exists (lscp_edit_channel_instrument CONFIG_EDIT_INSTRUMENT) |
check_function_exists (lscp_edit_channel_instrument CONFIG_EDIT_INSTRUMENT) |
163 |
# Check for CHANNEL_MIDI LSCP event support in liblscp], |
# Check for CHANNEL_MIDI LSCP event support in liblscp], |
164 |
check_include_file (lscp/event.h CONFIG_EVENT_CHANNEL_MIDI) |
check_include_file (lscp/event.h HAVE_LSCP_EVENT_H) |
165 |
|
if (NOT HAVE_LSCP_EVENT_H) |
166 |
|
set (CONFIG_EVENT_CHANNEL_MIDI 0) |
167 |
|
else () |
168 |
|
set (CONFIG_EVENT_CHANNEL_MIDI 1) |
169 |
|
endif () |
170 |
# Check for DEVICE_MIDI LSCP event support in liblscp], |
# Check for DEVICE_MIDI LSCP event support in liblscp], |
171 |
check_include_file (lscp/event.h CONFIG_EVENT_DEVICE_MIDI) |
if (NOT HAVE_LSCP_EVENT_H) |
172 |
|
set (CONFIG_EVENT_DEVICE_MIDI 0) |
173 |
|
else () |
174 |
|
set (CONFIG_EVENT_DEVICE_MIDI 1) |
175 |
|
endif () |
176 |
# Check if max. voices / streams is available. |
# Check if max. voices / streams is available. |
177 |
check_function_exists (lscp_get_voices CONFIG_MAX_VOICES) |
check_function_exists (lscp_get_voices CONFIG_MAX_VOICES) |
178 |
else () |
else () |
179 |
message (FATAL_ERROR "*** LSCP library not found.") |
message (FATAL_ERROR "*** LSCP library not found.") |
180 |
|
set (CONFIG_LIBLSCP 0) |
181 |
endif () |
endif () |
182 |
|
|
183 |
# Check for GIG libraries. |
# Check for GIG libraries. |
184 |
if (CONFIG_LIBGIG) |
if (CONFIG_LIBGIG) |
185 |
pkg_check_modules (GIG gig>=3.3.0) |
pkg_check_modules (GIG gig>=3.3.0) |
186 |
set (CONFIG_LIBGIG ${GIG_FOUND}) |
if (GIG_FOUND) |
|
if (CONFIG_LIBGIG) |
|
187 |
include_directories (${GIG_INCLUDE_DIRS}) |
include_directories (${GIG_INCLUDE_DIRS}) |
188 |
link_directories (${GIG_LIBRARY_DIRS}) |
link_directories (${GIG_LIBRARY_DIRS}) |
189 |
link_libraries (${GIG_LIBRARIES}) |
link_libraries (${GIG_LIBRARIES}) |
191 |
# liggig supports fast information retrieval. |
# liggig supports fast information retrieval. |
192 |
set (CONFIG_LIBGIG_SETAUTOLOAD 1) |
set (CONFIG_LIBGIG_SETAUTOLOAD 1) |
193 |
# Check if libgig/SF.h is available. |
# Check if libgig/SF.h is available. |
194 |
check_include_file_cxx (libgig/SF.h CONFIG_LIBGIG_SF2) |
check_include_file_cxx (libgig/SF.h HAVE_LIBGIG_SF_H) |
195 |
|
if (NOT HAVE_LIBGIG_SF_H) |
196 |
|
set (CONFIG_LIBGIG_SF2 0) |
197 |
|
else () |
198 |
|
set (CONFIG_LIBGIG_SF2 1) |
199 |
|
endif () |
200 |
else () |
else () |
201 |
message (WARNING "*** GIG library not found.") |
message (WARNING "*** GIG library not found.") |
202 |
|
set (CONFIG_LIBGIG 0) |
203 |
endif () |
endif () |
204 |
endif () |
endif () |
205 |
|
|
214 |
# Configuration status |
# Configuration status |
215 |
macro (SHOW_OPTION text value) |
macro (SHOW_OPTION text value) |
216 |
if (${value}) |
if (${value}) |
217 |
message("${text}: yes") |
message ("${text}: yes") |
218 |
else () |
else () |
219 |
message("${text}: no") |
message ("${text}: no") |
220 |
endif () |
endif () |
221 |
endmacro () |
endmacro () |
222 |
|
|