1 |
capela |
3567 |
project(QSAMPLER) |
2 |
|
|
|
3 |
capela |
3570 |
cmake_minimum_required(VERSION 3.1) |
4 |
capela |
3567 |
|
5 |
capela |
3633 |
set (VERSION "0.6.0") |
6 |
capela |
3567 |
|
7 |
capela |
3570 |
set (CONFIG_VERSION ${VERSION}) |
8 |
capela |
3567 |
execute_process ( |
9 |
|
|
COMMAND git describe --tags --dirty --abbrev=6 |
10 |
|
|
OUTPUT_VARIABLE GIT_DESCRIBE_OUTPUT |
11 |
|
|
RESULT_VARIABLE GIT_DESCRIBE_RESULT |
12 |
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE) |
13 |
|
|
if (GIT_DESCRIBE_RESULT EQUAL 0) |
14 |
|
|
set (VERSION "${GIT_DESCRIBE_OUTPUT}") |
15 |
capela |
3589 |
string (REGEX REPLACE "^[^_]+" "" VERSION "${VERSION}") |
16 |
capela |
3567 |
string (REGEX REPLACE "^[_vV]+" "" VERSION "${VERSION}") |
17 |
|
|
string (REGEX REPLACE "-g" "git." VERSION "${VERSION}") |
18 |
|
|
string (REGEX REPLACE "[_|-]+" "." VERSION "${VERSION}") |
19 |
|
|
execute_process ( |
20 |
|
|
COMMAND git rev-parse --abbrev-ref HEAD |
21 |
|
|
OUTPUT_VARIABLE GIT_REVPARSE_OUTPUT |
22 |
|
|
RESULT_VARIABLE GIT_REVPARSE_RESULT |
23 |
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE) |
24 |
|
|
if (GIT_REVPARSE_RESULT EQUAL 0 AND NOT GIT_REVPARSE_OUTPUT STREQUAL "master") |
25 |
|
|
set (VERSION "${VERSION} [${GIT_REVPARSE_OUTPUT}]") |
26 |
capela |
3571 |
endif () |
27 |
capela |
3567 |
endif () |
28 |
|
|
|
29 |
|
|
set (PACKAGE_NAME "Qsampler") |
30 |
|
|
set (PACKAGE_VERSION "${VERSION}") |
31 |
|
|
set (PACKAGE_BUGREPORT "rncbc@rncbc.org") |
32 |
|
|
set (PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}") |
33 |
|
|
set (PACKAGE_TARNAME "qsampler") |
34 |
|
|
|
35 |
|
|
set (CONFIG_BUILD_VERSION "${PACKAGE_VERSION}") |
36 |
|
|
|
37 |
|
|
if (CMAKE_BUILD_TYPE) |
38 |
capela |
3571 |
set (CONFIG_BUILD_TYPE ${CMAKE_BUILD_TYPE}) |
39 |
capela |
3567 |
else () |
40 |
|
|
set (CONFIG_BUILD_TYPE "release") |
41 |
|
|
endif () |
42 |
|
|
|
43 |
capela |
3571 |
set (CONFIG_DEBUG 0) |
44 |
capela |
3567 |
if (CONFIG_BUILD_TYPE MATCHES "debug") |
45 |
capela |
3571 |
set (CONFIG_DEBUG 1) |
46 |
capela |
3567 |
endif () |
47 |
capela |
3570 |
|
48 |
capela |
3567 |
set (CONFIG_PREFIX "${CMAKE_INSTALL_PREFIX}") |
49 |
|
|
|
50 |
capela |
3570 |
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 |
capela |
3567 |
|
56 |
capela |
3570 |
|
57 |
capela |
3567 |
# Enable libgig availability. |
58 |
|
|
option (CONFIG_LIBGIG "Enable libgig interface (default=yes)" 1) |
59 |
|
|
|
60 |
|
|
# Enable unique/single instance. |
61 |
|
|
option (CONFIG_XUNIQUE "Enable unique/single instance (default=yes)" 1) |
62 |
|
|
|
63 |
|
|
# Enable debugger stack-trace option (assumes --enable-debug). |
64 |
|
|
option (CONFIG_STACKTRACE "Enable debugger stack-trace (default=no)" 0) |
65 |
|
|
|
66 |
capela |
3571 |
|
67 |
capela |
3567 |
# Fix for new CMAKE_REQUIRED_LIBRARIES policy. |
68 |
|
|
if (POLICY CMP0075) |
69 |
|
|
cmake_policy (SET CMP0075 NEW) |
70 |
|
|
endif () |
71 |
|
|
|
72 |
|
|
# Check for Qt |
73 |
capela |
3589 |
find_package (Qt5 REQUIRED COMPONENTS Core Gui Widgets) |
74 |
capela |
3569 |
|
75 |
|
|
if (CONFIG_XUNIQUE) |
76 |
capela |
3589 |
find_package (Qt5 REQUIRED COMPONENTS Network) |
77 |
capela |
3569 |
endif () |
78 |
|
|
|
79 |
capela |
3567 |
find_package (Qt5LinguistTools) |
80 |
|
|
|
81 |
|
|
include (CheckIncludeFile) |
82 |
|
|
include (CheckIncludeFiles) |
83 |
|
|
include (CheckIncludeFileCXX) |
84 |
|
|
include (CheckFunctionExists) |
85 |
|
|
include (CheckLibraryExists) |
86 |
|
|
|
87 |
|
|
# Checks for libraries. |
88 |
|
|
if (WIN32) |
89 |
|
|
check_function_exists (lroundf CONFIG_ROUND) |
90 |
|
|
else () |
91 |
|
|
find_library (MATH_LIBRARY m) |
92 |
|
|
# Check for round math function. |
93 |
|
|
if (MATH_LIBRARY) |
94 |
|
|
set (CMAKE_REQUIRED_LIBRARIES "${MATH_LIBRARY};${CMAKE_REQUIRED_LIBRARIES}") |
95 |
|
|
check_function_exists (lroundf CONFIG_ROUND) |
96 |
|
|
else () |
97 |
|
|
message (FATAL_ERROR "*** math library not found.") |
98 |
|
|
endif () |
99 |
|
|
endif () |
100 |
|
|
|
101 |
|
|
# Checks for header files. |
102 |
|
|
if (UNIX AND NOT APPLE) |
103 |
|
|
check_include_files ("fcntl.h;unistd.h;signal.h" HAVE_SIGNAL_H) |
104 |
|
|
endif () |
105 |
|
|
|
106 |
|
|
|
107 |
|
|
# Find package modules |
108 |
|
|
find_package (PkgConfig REQUIRED) |
109 |
|
|
|
110 |
|
|
# Check for LSCP libraries. |
111 |
|
|
pkg_check_modules (LSCP REQUIRED lscp) |
112 |
|
|
set (CONFIG_LIBLSCP ${LSCP_FOUND}) |
113 |
|
|
if (CONFIG_LIBLSCP) |
114 |
|
|
include_directories (${LSCP_INCLUDE_DIRS}) |
115 |
|
|
link_directories (${LSCP_LIBRARY_DIRS}) |
116 |
capela |
3571 |
# link_libraries (${LSCP_LIBRARIES}) |
117 |
capela |
3567 |
set (CMAKE_REQUIRED_LIBRARIES "${LSCP_LIBRARIES};${CMAKE_REQUIRED_LIBRARIES}") |
118 |
|
|
# Check for for instrument_name in lscp_channel_info_t. |
119 |
|
|
check_include_file (lscp/client.h CONFIG_INSTRUMENT_NAME) |
120 |
|
|
# Check for mute/solo in lscp_channel_info_t. |
121 |
|
|
check_include_file (lscp/client.h CONFIG_MUTE_SOLO) |
122 |
|
|
if (CONFIG_MUTE_SOLO) |
123 |
|
|
check_function_exists (lscp_set_channel_mute CONFIG_MUTE_SOLO) |
124 |
|
|
endif () |
125 |
|
|
if (CONFIG_MUTE_SOLO) |
126 |
|
|
check_function_exists (lscp_set_channel_solo CONFIG_MUTE_SOLO) |
127 |
|
|
endif () |
128 |
|
|
# Check if MIDI instrument mapping is available. |
129 |
|
|
check_function_exists (lscp_map_midi_instrument CONFIG_MIDI_INSTRUMENT) |
130 |
|
|
# Check if FX sends is available. |
131 |
|
|
check_function_exists (lscp_create_fxsend CONFIG_FXSEND) |
132 |
|
|
# Check for FX send level in lscp_fxsend_info_t |
133 |
|
|
if (CONFIG_FXSEND) |
134 |
|
|
check_include_file (lscp/client.h CONFIG_FXSEND_LEVEL) |
135 |
|
|
endif () |
136 |
|
|
# Check if FX send rename is available. |
137 |
|
|
if (CONFIG_FXSEND) |
138 |
|
|
check_function_exists (lscp_set_fxsend_name CONFIG_FXSEND_RENAME) |
139 |
|
|
endif () |
140 |
|
|
# Check for audio_routing array type |
141 |
|
|
check_include_file (lscp/client.h CONFIG_AUDIO_ROUTING) |
142 |
|
|
# Check if global volume is available. |
143 |
|
|
check_function_exists (lscp_set_volume CONFIG_VOLUME) |
144 |
|
|
# Check if instrument editing is available. |
145 |
|
|
check_function_exists (lscp_edit_channel_instrument CONFIG_EDIT_INSTRUMENT) |
146 |
|
|
# Check for CHANNEL_MIDI LSCP event support in liblscp], |
147 |
|
|
check_include_file (lscp/event.h CONFIG_EVENT_CHANNEL_MIDI) |
148 |
|
|
# Check for DEVICE_MIDI LSCP event support in liblscp], |
149 |
|
|
check_include_file (lscp/event.h CONFIG_EVENT_DEVICE_MIDI) |
150 |
|
|
# Check if max. voices / streams is available. |
151 |
|
|
check_function_exists (lscp_get_voices CONFIG_MAX_VOICES) |
152 |
|
|
else () |
153 |
|
|
message (FATAL_ERROR "*** LSCP library not found.") |
154 |
|
|
endif () |
155 |
|
|
|
156 |
|
|
# Check for GIG libraries. |
157 |
|
|
if (CONFIG_LIBGIG) |
158 |
|
|
pkg_check_modules (GIG gig>=3.3.0) |
159 |
|
|
set (CONFIG_LIBGIG ${GIG_FOUND}) |
160 |
|
|
if (CONFIG_LIBGIG) |
161 |
|
|
include_directories (${GIG_INCLUDE_DIRS}) |
162 |
|
|
link_directories (${GIG_LIBRARY_DIRS}) |
163 |
|
|
link_libraries (${GIG_LIBRARIES}) |
164 |
|
|
# set (CMAKE_REQUIRED_LIBRARIES "${GIG_LIBRARIES};${CMAKE_REQUIRED_LIBRARIES}") |
165 |
|
|
# liggig supports fast information retrieval. |
166 |
|
|
set (CONFIG_LIBGIG_SETAUTOLOAD 1) |
167 |
|
|
# Check if libgig/SF.h is available. |
168 |
|
|
check_include_file_cxx (libgig/SF.h CONFIG_LIBGIG_SF2) |
169 |
|
|
else () |
170 |
|
|
message (WARNING "*** GIG library not found.") |
171 |
|
|
endif () |
172 |
|
|
endif () |
173 |
|
|
|
174 |
|
|
|
175 |
|
|
add_subdirectory (src) |
176 |
|
|
|
177 |
|
|
configure_file (qsampler.spec.in qsampler.spec IMMEDIATE @ONLY) |
178 |
|
|
|
179 |
|
|
install (FILES qsampler.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1) |
180 |
|
|
install (FILES qsampler.fr.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/fr/man1 RENAME qsampler.1) |
181 |
|
|
|
182 |
|
|
# Configuration status |
183 |
|
|
macro (SHOW_OPTION text value) |
184 |
|
|
if (${value}) |
185 |
capela |
3571 |
message ("${text}: yes") |
186 |
capela |
3567 |
else () |
187 |
capela |
3571 |
message ("${text}: no") |
188 |
capela |
3567 |
endif () |
189 |
|
|
endmacro () |
190 |
|
|
|
191 |
capela |
3569 |
|
192 |
|
|
message ("\n ${PACKAGE_NAME} ${PACKAGE_VERSION}") |
193 |
|
|
message ("\n Build target . . . . . . . . . . . . . . . . . . .: ${CONFIG_BUILD_TYPE}\n") |
194 |
capela |
3567 |
show_option (" LSCP instrument name support . . . . . . . . . . ." CONFIG_INSTRUMENT_NAME) |
195 |
|
|
show_option (" LSCP mute/solo support . . . . . . . . . . . . . ." CONFIG_MUTE_SOLO) |
196 |
|
|
show_option (" LSCP MIDI instrument support . . . . . . . . . . ." CONFIG_MIDI_INSTRUMENT) |
197 |
|
|
show_option (" LSCP FX send support . . . . . . . . . . . . . . ." CONFIG_FXSEND) |
198 |
|
|
show_option (" LSCP FX send level support . . . . . . . . . . . ." CONFIG_FXSEND_LEVEL) |
199 |
|
|
show_option (" LSCP FX send rename support . . . . . . . . . . ." CONFIG_FXSEND_RENAME) |
200 |
|
|
show_option (" LSCP audio routing support . . . . . . . . . . . ." CONFIG_AUDIO_ROUTING) |
201 |
|
|
show_option (" LSCP volume support . . . . . . . . . . . . . . ." CONFIG_VOLUME) |
202 |
|
|
show_option (" LSCP edit instrument support . . . . . . . . . . ." CONFIG_EDIT_INSTRUMENT) |
203 |
|
|
show_option (" GigaSampler instrument file support (libgig) . . ." CONFIG_LIBGIG) |
204 |
|
|
if (CONFIG_LIBGIG) |
205 |
|
|
show_option (" libgig supports fast information retrieval . . . ." CONFIG_LIBGIG_SETAUTOLOAD) |
206 |
|
|
show_option (" libgig supports SoundFont2 instruments files . . ." CONFIG_LIBGIG_SF2) |
207 |
|
|
endif () |
208 |
|
|
show_option (" LSCP channel MIDI event support . . . . . . . . ." CONFIG_EVENT_CHANNEL_MIDI) |
209 |
|
|
show_option (" LSCP device MIDI event support . . . . . . . . . ." CONFIG_EVENT_DEVICE_MIDI) |
210 |
|
|
show_option (" LSCP runtime max. voices / disk streams support ." CONFIG_MAX_VOICES) |
211 |
capela |
3569 |
message ("") |
212 |
capela |
3567 |
show_option (" Unique/Single instance support . . . . . . . . . ." CONFIG_XUNIQUE) |
213 |
|
|
show_option (" Debugger stack-trace (gdb) . . . . . . . . . . . ." CONFIG_STACKTRACE) |
214 |
capela |
3569 |
message ("\n Install prefix . . . . . . . . . . . . . . . . . .: ${CMAKE_INSTALL_PREFIX}") |
215 |
|
|
message ("\nNow type 'make', followed by 'make install' as root.\n") |