/[svn]/qsampler/trunk/CMakeLists.txt
ViewVC logotype

Contents of /qsampler/trunk/CMakeLists.txt

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4038 - (show annotations) (download)
Sun May 15 18:43:41 2022 UTC (7 weeks, 1 day ago) by capela
File MIME type: text/plain
File size: 9273 byte(s)
- Sync to upstream git repo.
1 cmake_minimum_required (VERSION 3.13)
2
3 project (qsampler
4 VERSION 0.9.7
5 DESCRIPTION "A LinuxSampler Qt GUI Interface"
6 LANGUAGES C CXX)
7
8 set (CONFIG_VERSION ${PROJECT_VERSION})
9 execute_process (
10 COMMAND git describe --tags --dirty --abbrev=6
11 WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
12 OUTPUT_VARIABLE GIT_DESCRIBE_OUTPUT
13 RESULT_VARIABLE GIT_DESCRIBE_RESULT
14 OUTPUT_STRIP_TRAILING_WHITESPACE)
15 if (GIT_DESCRIBE_RESULT EQUAL 0)
16 set (VERSION "${GIT_DESCRIBE_OUTPUT}")
17 string (REGEX REPLACE "^[^0-9]+" "" VERSION "${VERSION}")
18 string (REGEX REPLACE "^1_" "" VERSION "${VERSION}")
19 string (REGEX REPLACE "^[_vV]+" "" VERSION "${VERSION}")
20 string (REGEX REPLACE "-g" "git." VERSION "${VERSION}")
21 string (REGEX REPLACE "[_|-]" "." VERSION "${VERSION}")
22 execute_process (
23 COMMAND git rev-parse --abbrev-ref HEAD
24 WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
25 OUTPUT_VARIABLE GIT_REVPARSE_OUTPUT
26 RESULT_VARIABLE GIT_REVPARSE_RESULT
27 OUTPUT_STRIP_TRAILING_WHITESPACE)
28 if (GIT_REVPARSE_RESULT EQUAL 0 AND NOT GIT_REVPARSE_OUTPUT STREQUAL "master")
29 set (VERSION "${VERSION} [${GIT_REVPARSE_OUTPUT}]")
30 endif ()
31 else ()
32 set (VERSION "${PROJECT_VERSION}")
33 endif ()
34
35 set (PACKAGE_NAME "Qsampler")
36 set (PACKAGE_VERSION "${VERSION}")
37 set (PACKAGE_BUGREPORT "rncbc@rncbc.org")
38 set (PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
39 set (PACKAGE_TARNAME "qsampler")
40
41 set (ac_version "${PROJECT_VERSION}")
42 set (ac_prefix "${CMAKE_INSTALL_PREFIX}")
43
44 set (CONFIG_BUILD_VERSION "${PACKAGE_VERSION}")
45
46 if (CONFIG_DEBUG)
47 set (CMAKE_BUILD_TYPE "Debug")
48 endif ()
49 if (CMAKE_BUILD_TYPE MATCHES "Debug")
50 set (CONFIG_DEBUG 1)
51 endif ()
52 if (CONFIG_DEBUG)
53 set (CONFIG_BUILD_TYPE "debug")
54 else ()
55 set (CONFIG_BUILD_TYPE "release")
56 endif ()
57
58 set (CONFIG_PREFIX "${CMAKE_INSTALL_PREFIX}")
59
60 include (GNUInstallDirs)
61 set (CONFIG_BINDIR "${CONFIG_PREFIX}/${CMAKE_INSTALL_BINDIR}")
62 set (CONFIG_LIBDIR "${CONFIG_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
63 set (CONFIG_DATADIR "${CONFIG_PREFIX}/${CMAKE_INSTALL_DATADIR}")
64 set (CONFIG_MANDIR "${CONFIG_PREFIX}/${CMAKE_INSTALL_MANDIR}")
65
66
67 # Enable libgig availability.
68 option (CONFIG_LIBGIG "Enable libgig interface (default=yes)" 1)
69
70 # Enable unique/single instance.
71 option (CONFIG_XUNIQUE "Enable unique/single instance (default=yes)" 1)
72
73 # Enable debugger stack-trace option (assumes --enable-debug).
74 option (CONFIG_STACKTRACE "Enable debugger stack-trace (default=no)" 0)
75
76 # Enable Wayland support option.
77 option (CONFIG_WAYLAND "Enable Wayland support (EXPERIMENTAL) (default=no)" 0)
78
79 # Enable Qt6 build preference.
80 option (CONFIG_QT6 "Enable Qt6 build (default=yes)" 1)
81
82
83 # Fix for new CMAKE_REQUIRED_LIBRARIES policy.
84 if (POLICY CMP0075)
85 cmake_policy (SET CMP0075 NEW)
86 endif ()
87
88 # Check for Qt...
89 if (CONFIG_QT6)
90 find_package (Qt6 QUIET)
91 if (NOT Qt6_FOUND)
92 set (CONFIG_QT6 0)
93 endif ()
94 endif ()
95
96 if (CONFIG_QT6)
97 find_package (QT QUIET NAMES Qt6)
98 else ()
99 find_package (QT QUIET NAMES Qt5)
100 endif ()
101
102 find_package (Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core Gui Widgets Svg)
103
104 if (CONFIG_XUNIQUE)
105 find_package (Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Network)
106 endif ()
107
108 find_package (Qt${QT_VERSION_MAJOR}LinguistTools)
109
110 include (CheckIncludeFile)
111 include (CheckIncludeFiles)
112 include (CheckIncludeFileCXX)
113 include (CheckFunctionExists)
114 include (CheckLibraryExists)
115
116 # Checks for libraries.
117 if (WIN32)
118 check_function_exists (lroundf CONFIG_ROUND)
119 else ()
120 find_library (MATH_LIBRARY m)
121 # Check for round math function.
122 if (MATH_LIBRARY)
123 set (CMAKE_REQUIRED_LIBRARIES "${MATH_LIBRARY};${CMAKE_REQUIRED_LIBRARIES}")
124 check_function_exists (lroundf CONFIG_ROUND)
125 else ()
126 message (FATAL_ERROR "*** math library not found.")
127 endif ()
128 endif ()
129
130 # Checks for header files.
131 if (UNIX AND NOT APPLE)
132 check_include_files ("fcntl.h;unistd.h;signal.h" HAVE_SIGNAL_H)
133 endif ()
134
135
136 # Find package modules
137 include (FindPkgConfig)
138
139 # Check for LSCP libraries.
140 pkg_check_modules (LSCP REQUIRED IMPORTED_TARGET lscp)
141 if (LSCP_FOUND)
142 find_library(LSCP_LIBRARY NAMES ${LSCP_LIBRARIES} HINTS ${LSCP_LIBDIR})
143 endif ()
144 if (LSCP_LIBRARY)
145 set (CONFIG_LIBLSCP 1)
146 set (CMAKE_REQUIRED_LIBRARIES "${LSCP_LIBRARY};${CMAKE_REQUIRED_LIBRARIES}")
147 # Check for for instrument_name in lscp_channel_info_t.
148 check_include_file (lscp/client.h HAVE_LSCP_CLIENT_H)
149 if (NOT HAVE_LSCP_CLIENT_H)
150 set (CONFIG_INSTRUMENT_NAME 0)
151 else ()
152 set (CONFIG_INSTRUMENT_NAME 1)
153 endif ()
154 # Check for mute/solo in lscp_channel_info_t.
155 if (NOT HAVE_LSCP_CLIENT_H)
156 set (CONFIG_MUTE_SOLO 0)
157 else ()
158 set (CONFIG_MUTE_SOLO 1)
159 endif ()
160 if (CONFIG_MUTE_SOLO)
161 check_function_exists (lscp_set_channel_mute CONFIG_MUTE_SOLO)
162 endif ()
163 if (CONFIG_MUTE_SOLO)
164 check_function_exists (lscp_set_channel_solo CONFIG_MUTE_SOLO)
165 endif ()
166 # Check if MIDI instrument mapping is available.
167 check_function_exists (lscp_map_midi_instrument CONFIG_MIDI_INSTRUMENT)
168 # Check if FX sends is available.
169 check_function_exists (lscp_create_fxsend CONFIG_FXSEND)
170 # Check for FX send level in lscp_fxsend_info_t
171 if (CONFIG_FXSEND)
172 if (NOT HAVE_LSCP_CLIENT_H)
173 set (CONFIG_FXSEND_LEVEL 0)
174 else ()
175 set (CONFIG_FXSEND_LEVEL 1)
176 endif ()
177 endif ()
178 # Check if FX send rename is available.
179 if (CONFIG_FXSEND)
180 check_function_exists (lscp_set_fxsend_name CONFIG_FXSEND_RENAME)
181 endif ()
182 # Check for audio_routing array type
183 if (NOT HAVE_LSCP_CLIENT_H)
184 set (CONFIG_AUDIO_ROUTING 0)
185 else ()
186 set (CONFIG_AUDIO_ROUTING 1)
187 endif ()
188 # Check if global volume is available.
189 check_function_exists (lscp_set_volume CONFIG_VOLUME)
190 # Check if instrument editing is available.
191 check_function_exists (lscp_edit_channel_instrument CONFIG_EDIT_INSTRUMENT)
192 # Check for CHANNEL_MIDI LSCP event support in liblscp],
193 check_include_file (lscp/event.h HAVE_LSCP_EVENT_H)
194 if (NOT HAVE_LSCP_EVENT_H)
195 set (CONFIG_EVENT_CHANNEL_MIDI 0)
196 else ()
197 set (CONFIG_EVENT_CHANNEL_MIDI 1)
198 endif ()
199 # Check for DEVICE_MIDI LSCP event support in liblscp],
200 if (NOT HAVE_LSCP_EVENT_H)
201 set (CONFIG_EVENT_DEVICE_MIDI 0)
202 else ()
203 set (CONFIG_EVENT_DEVICE_MIDI 1)
204 endif ()
205 # Check if max. voices / streams is available.
206 check_function_exists (lscp_get_voices CONFIG_MAX_VOICES)
207 else ()
208 message (FATAL_ERROR "*** LSCP library not found.")
209 set (CONFIG_LIBLSCP 0)
210 endif ()
211
212 # Check for GIG libraries.
213 if (CONFIG_LIBGIG)
214 pkg_check_modules (GIG IMPORTED_TARGET gig>=3.3.0)
215 if (GIG_FOUND)
216 find_library(GIG_LIBRARY NAMES ${GIG_LIBRARIES} HINTS ${GIG_LIBDIR})
217 endif ()
218 if (GIG_LIBRARY)
219 set (CONFIG_LIBGIG 1)
220 #set (CMAKE_REQUIRED_LIBRARIES "${GIG_LIBRARY};${CMAKE_REQUIRED_LIBRARIES}")
221 # liggig supports fast information retrieval.
222 set (CONFIG_LIBGIG_SETAUTOLOAD 1)
223 # Check if libgig/SF.h is available.
224 check_include_file_cxx (libgig/SF.h HAVE_LIBGIG_SF_H)
225 if (NOT HAVE_LIBGIG_SF_H)
226 set (CONFIG_LIBGIG_SF2 0)
227 else ()
228 set (CONFIG_LIBGIG_SF2 1)
229 endif ()
230 else ()
231 message (WARNING "*** GIG library not found.")
232 set (CONFIG_LIBGIG 0)
233 endif ()
234 endif ()
235
236
237 add_subdirectory (src)
238
239
240 if (UNIX AND NOT APPLE)
241 configure_file (${PROJECT_NAME}.spec.in ${PROJECT_NAME}.spec IMMEDIATE @ONLY)
242 endif ()
243
244
245 # Configuration status
246 macro (SHOW_OPTION text value)
247 if (${value})
248 message ("${text}: yes")
249 else ()
250 message ("${text}: no")
251 endif ()
252 endmacro ()
253
254
255 message ("\n ${PACKAGE_NAME} ${PACKAGE_VERSION} (Qt ${QT_VERSION})")
256 message ("\n Build target . . . . . . . . . . . . . . . . . . .: ${CONFIG_BUILD_TYPE}\n")
257 show_option (" LSCP instrument name support . . . . . . . . . . ." CONFIG_INSTRUMENT_NAME)
258 show_option (" LSCP mute/solo support . . . . . . . . . . . . . ." CONFIG_MUTE_SOLO)
259 show_option (" LSCP MIDI instrument support . . . . . . . . . . ." CONFIG_MIDI_INSTRUMENT)
260 show_option (" LSCP FX send support . . . . . . . . . . . . . . ." CONFIG_FXSEND)
261 show_option (" LSCP FX send level support . . . . . . . . . . . ." CONFIG_FXSEND_LEVEL)
262 show_option (" LSCP FX send rename support . . . . . . . . . . ." CONFIG_FXSEND_RENAME)
263 show_option (" LSCP audio routing support . . . . . . . . . . . ." CONFIG_AUDIO_ROUTING)
264 show_option (" LSCP volume support . . . . . . . . . . . . . . ." CONFIG_VOLUME)
265 show_option (" LSCP edit instrument support . . . . . . . . . . ." CONFIG_EDIT_INSTRUMENT)
266 show_option (" GigaSampler instrument file support (libgig) . . ." CONFIG_LIBGIG)
267 if (CONFIG_LIBGIG)
268 show_option (" libgig supports fast information retrieval . . . ." CONFIG_LIBGIG_SETAUTOLOAD)
269 show_option (" libgig supports SoundFont2 instruments files . . ." CONFIG_LIBGIG_SF2)
270 endif ()
271 show_option (" LSCP channel MIDI event support . . . . . . . . ." CONFIG_EVENT_CHANNEL_MIDI)
272 show_option (" LSCP device MIDI event support . . . . . . . . . ." CONFIG_EVENT_DEVICE_MIDI)
273 show_option (" LSCP runtime max. voices / disk streams support ." CONFIG_MAX_VOICES)
274 message ("")
275 show_option (" Unique/Single instance support . . . . . . . . . ." CONFIG_XUNIQUE)
276 show_option (" Debugger stack-trace (gdb) . . . . . . . . . . . ." CONFIG_STACKTRACE)
277 message ("\n Install prefix . . . . . . . . . . . . . . . . . .: ${CONFIG_PREFIX}\n")

  ViewVC Help
Powered by ViewVC