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