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

Contents of /qsampler/trunk/CMakeLists.txt

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3841 - (show annotations) (download)
Mon Dec 14 15:49:17 2020 UTC (4 months, 3 weeks ago) by capela
File MIME type: text/plain
File size: 8660 byte(s)
- French translation update for 0.9.0
1 project(qsampler)
2
3 cmake_minimum_required(VERSION 3.1)
4
5 set (VERSION "0.9.0")
6
7 set (CONFIG_VERSION ${VERSION})
8 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 string (REGEX REPLACE "^[^0-9]+" "" 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 0)
43 if (CONFIG_BUILD_TYPE MATCHES "debug")
44 set (CONFIG_DEBUG 1)
45 endif ()
46
47 set (CONFIG_PREFIX "${CMAKE_INSTALL_PREFIX}")
48
49 include (GNUInstallDirs)
50 set (CONFIG_BINDIR "${CONFIG_PREFIX}/${CMAKE_INSTALL_BINDIR}")
51 set (CONFIG_LIBDIR "${CONFIG_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
52 set (CONFIG_DATADIR "${CONFIG_PREFIX}/${CMAKE_INSTALL_DATADIR}")
53 set (CONFIG_MANDIR "${CONFIG_PREFIX}/${CMAKE_INSTALL_MANDIR}")
54
55
56 # Enable libgig availability.
57 option (CONFIG_LIBGIG "Enable libgig interface (default=yes)" 1)
58
59 # Enable unique/single instance.
60 option (CONFIG_XUNIQUE "Enable unique/single instance (default=yes)" 1)
61
62 # Enable debugger stack-trace option (assumes --enable-debug).
63 option (CONFIG_STACKTRACE "Enable debugger stack-trace (default=no)" 0)
64
65
66 # Fix for new CMAKE_REQUIRED_LIBRARIES policy.
67 if (POLICY CMP0075)
68 cmake_policy (SET CMP0075 NEW)
69 endif ()
70
71 # Check for Qt
72 find_package (QT NAMES Qt6 Qt5 COMPONENTS Core REQUIRED)
73 find_package (Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core Gui Widgets)
74
75 if (CONFIG_XUNIQUE)
76 find_package (Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Network)
77 endif ()
78
79 find_package (Qt${QT_VERSION_MAJOR}LinguistTools)
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 if (LSCP_FOUND)
113 set (CONFIG_LIBLSCP 1)
114 include_directories (${LSCP_INCLUDE_DIRS})
115 link_directories (${LSCP_LIBRARY_DIRS})
116 # link_libraries (${LSCP_LIBRARIES})
117 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 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.
126 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)
132 check_function_exists (lscp_set_channel_mute CONFIG_MUTE_SOLO)
133 endif ()
134 if (CONFIG_MUTE_SOLO)
135 check_function_exists (lscp_set_channel_solo CONFIG_MUTE_SOLO)
136 endif ()
137 # Check if MIDI instrument mapping is available.
138 check_function_exists (lscp_map_midi_instrument CONFIG_MIDI_INSTRUMENT)
139 # Check if FX sends is available.
140 check_function_exists (lscp_create_fxsend CONFIG_FXSEND)
141 # Check for FX send level in lscp_fxsend_info_t
142 if (CONFIG_FXSEND)
143 if (NOT HAVE_LSCP_CLIENT_H)
144 set (CONFIG_FXSEND_LEVEL 0)
145 else ()
146 set (CONFIG_FXSEND_LEVEL 1)
147 endif ()
148 endif ()
149 # Check if FX send rename is available.
150 if (CONFIG_FXSEND)
151 check_function_exists (lscp_set_fxsend_name CONFIG_FXSEND_RENAME)
152 endif ()
153 # Check for audio_routing array type
154 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.
160 check_function_exists (lscp_set_volume CONFIG_VOLUME)
161 # Check if instrument editing is available.
162 check_function_exists (lscp_edit_channel_instrument CONFIG_EDIT_INSTRUMENT)
163 # Check for CHANNEL_MIDI LSCP event support in liblscp],
164 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],
171 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.
177 check_function_exists (lscp_get_voices CONFIG_MAX_VOICES)
178 else ()
179 message (FATAL_ERROR "*** LSCP library not found.")
180 set (CONFIG_LIBLSCP 0)
181 endif ()
182
183 # Check for GIG libraries.
184 if (CONFIG_LIBGIG)
185 pkg_check_modules (GIG gig>=3.3.0)
186 if (GIG_FOUND)
187 include_directories (${GIG_INCLUDE_DIRS})
188 link_directories (${GIG_LIBRARY_DIRS})
189 link_libraries (${GIG_LIBRARIES})
190 # set (CMAKE_REQUIRED_LIBRARIES "${GIG_LIBRARIES};${CMAKE_REQUIRED_LIBRARIES}")
191 # liggig supports fast information retrieval.
192 set (CONFIG_LIBGIG_SETAUTOLOAD 1)
193 # Check if libgig/SF.h is available.
194 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 ()
201 message (WARNING "*** GIG library not found.")
202 set (CONFIG_LIBGIG 0)
203 endif ()
204 endif ()
205
206
207 add_subdirectory (src)
208
209 configure_file (qsampler.spec.in qsampler.spec IMMEDIATE @ONLY)
210
211 install (FILES qsampler.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
212 install (FILES qsampler.fr.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/fr/man1 RENAME qsampler.1)
213
214 # Configuration status
215 macro (SHOW_OPTION text value)
216 if (${value})
217 message ("${text}: yes")
218 else ()
219 message ("${text}: no")
220 endif ()
221 endmacro ()
222
223
224 message ("\n ${PACKAGE_NAME} ${PACKAGE_VERSION}")
225 message ("\n Build target . . . . . . . . . . . . . . . . . . .: ${CONFIG_BUILD_TYPE}\n")
226 show_option (" LSCP instrument name support . . . . . . . . . . ." CONFIG_INSTRUMENT_NAME)
227 show_option (" LSCP mute/solo support . . . . . . . . . . . . . ." CONFIG_MUTE_SOLO)
228 show_option (" LSCP MIDI instrument support . . . . . . . . . . ." CONFIG_MIDI_INSTRUMENT)
229 show_option (" LSCP FX send support . . . . . . . . . . . . . . ." CONFIG_FXSEND)
230 show_option (" LSCP FX send level support . . . . . . . . . . . ." CONFIG_FXSEND_LEVEL)
231 show_option (" LSCP FX send rename support . . . . . . . . . . ." CONFIG_FXSEND_RENAME)
232 show_option (" LSCP audio routing support . . . . . . . . . . . ." CONFIG_AUDIO_ROUTING)
233 show_option (" LSCP volume support . . . . . . . . . . . . . . ." CONFIG_VOLUME)
234 show_option (" LSCP edit instrument support . . . . . . . . . . ." CONFIG_EDIT_INSTRUMENT)
235 show_option (" GigaSampler instrument file support (libgig) . . ." CONFIG_LIBGIG)
236 if (CONFIG_LIBGIG)
237 show_option (" libgig supports fast information retrieval . . . ." CONFIG_LIBGIG_SETAUTOLOAD)
238 show_option (" libgig supports SoundFont2 instruments files . . ." CONFIG_LIBGIG_SF2)
239 endif ()
240 show_option (" LSCP channel MIDI event support . . . . . . . . ." CONFIG_EVENT_CHANNEL_MIDI)
241 show_option (" LSCP device MIDI event support . . . . . . . . . ." CONFIG_EVENT_DEVICE_MIDI)
242 show_option (" LSCP runtime max. voices / disk streams support ." CONFIG_MAX_VOICES)
243 message ("")
244 show_option (" Unique/Single instance support . . . . . . . . . ." CONFIG_XUNIQUE)
245 show_option (" Debugger stack-trace (gdb) . . . . . . . . . . . ." CONFIG_STACKTRACE)
246 message ("\n Install prefix . . . . . . . . . . . . . . . . . .: ${CMAKE_INSTALL_PREFIX}")
247 message ("\nNow type 'make', followed by 'make install' as root.\n")

  ViewVC Help
Powered by ViewVC