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

Contents of /qsampler/trunk/CMakeLists.txt

Parent Directory Parent Directory | Revision Log Revision Log


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

  ViewVC Help
Powered by ViewVC