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

Contents of /qsampler/trunk/CMakeLists.txt

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3839 - (show annotations) (download)
Tue Dec 8 17:13:49 2020 UTC (5 months ago) by capela
File MIME type: text/plain
File size: 8549 byte(s)
- Fixed CMake configuration listings to general practice (eg. qtcreator).
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 (Qt5 REQUIRED COMPONENTS Core Gui Widgets)
73
74 if (CONFIG_XUNIQUE)
75 find_package (Qt5 REQUIRED COMPONENTS Network)
76 endif ()
77
78 find_package (Qt5LinguistTools)
79
80 include (CheckIncludeFile)
81 include (CheckIncludeFiles)
82 include (CheckIncludeFileCXX)
83 include (CheckFunctionExists)
84 include (CheckLibraryExists)
85
86 # Checks for libraries.
87 if (WIN32)
88 check_function_exists (lroundf CONFIG_ROUND)
89 else ()
90 find_library (MATH_LIBRARY m)
91 # Check for round math function.
92 if (MATH_LIBRARY)
93 set (CMAKE_REQUIRED_LIBRARIES "${MATH_LIBRARY};${CMAKE_REQUIRED_LIBRARIES}")
94 check_function_exists (lroundf CONFIG_ROUND)
95 else ()
96 message (FATAL_ERROR "*** math library not found.")
97 endif ()
98 endif ()
99
100 # Checks for header files.
101 if (UNIX AND NOT APPLE)
102 check_include_files ("fcntl.h;unistd.h;signal.h" HAVE_SIGNAL_H)
103 endif ()
104
105
106 # Find package modules
107 find_package (PkgConfig REQUIRED)
108
109 # Check for LSCP libraries.
110 pkg_check_modules (LSCP REQUIRED lscp)
111 if (LSCP_FOUND)
112 set (CONFIG_LIBLSCP 1)
113 include_directories (${LSCP_INCLUDE_DIRS})
114 link_directories (${LSCP_LIBRARY_DIRS})
115 # link_libraries (${LSCP_LIBRARIES})
116 set (CMAKE_REQUIRED_LIBRARIES "${LSCP_LIBRARIES};${CMAKE_REQUIRED_LIBRARIES}")
117 # Check for for instrument_name in lscp_channel_info_t.
118 check_include_file (lscp/client.h HAVE_LSCP_CLIENT_H)
119 if (NOT HAVE_LSCP_CLIENT_H)
120 set (CONFIG_INSTRUMENT_NAME 0)
121 else ()
122 set (CONFIG_INSTRUMENT_NAME 1)
123 endif ()
124 # Check for mute/solo in lscp_channel_info_t.
125 if (NOT HAVE_LSCP_CLIENT_H)
126 set (CONFIG_MUTE_SOLO 0)
127 else ()
128 set (CONFIG_MUTE_SOLO 1)
129 endif ()
130 if (CONFIG_MUTE_SOLO)
131 check_function_exists (lscp_set_channel_mute CONFIG_MUTE_SOLO)
132 endif ()
133 if (CONFIG_MUTE_SOLO)
134 check_function_exists (lscp_set_channel_solo CONFIG_MUTE_SOLO)
135 endif ()
136 # Check if MIDI instrument mapping is available.
137 check_function_exists (lscp_map_midi_instrument CONFIG_MIDI_INSTRUMENT)
138 # Check if FX sends is available.
139 check_function_exists (lscp_create_fxsend CONFIG_FXSEND)
140 # Check for FX send level in lscp_fxsend_info_t
141 if (CONFIG_FXSEND)
142 if (NOT HAVE_LSCP_CLIENT_H)
143 set (CONFIG_FXSEND_LEVEL 0)
144 else ()
145 set (CONFIG_FXSEND_LEVEL 1)
146 endif ()
147 endif ()
148 # Check if FX send rename is available.
149 if (CONFIG_FXSEND)
150 check_function_exists (lscp_set_fxsend_name CONFIG_FXSEND_RENAME)
151 endif ()
152 # Check for audio_routing array type
153 if (NOT HAVE_LSCP_CLIENT_H)
154 set (CONFIG_AUDIO_ROUTING 0)
155 else ()
156 set (CONFIG_AUDIO_ROUTING 1)
157 endif ()
158 # Check if global volume is available.
159 check_function_exists (lscp_set_volume CONFIG_VOLUME)
160 # Check if instrument editing is available.
161 check_function_exists (lscp_edit_channel_instrument CONFIG_EDIT_INSTRUMENT)
162 # Check for CHANNEL_MIDI LSCP event support in liblscp],
163 check_include_file (lscp/event.h HAVE_LSCP_EVENT_H)
164 if (NOT HAVE_LSCP_EVENT_H)
165 set (CONFIG_EVENT_CHANNEL_MIDI 0)
166 else ()
167 set (CONFIG_EVENT_CHANNEL_MIDI 1)
168 endif ()
169 # Check for DEVICE_MIDI LSCP event support in liblscp],
170 if (NOT HAVE_LSCP_EVENT_H)
171 set (CONFIG_EVENT_DEVICE_MIDI 0)
172 else ()
173 set (CONFIG_EVENT_DEVICE_MIDI 1)
174 endif ()
175 # Check if max. voices / streams is available.
176 check_function_exists (lscp_get_voices CONFIG_MAX_VOICES)
177 else ()
178 message (FATAL_ERROR "*** LSCP library not found.")
179 set (CONFIG_LIBLSCP 0)
180 endif ()
181
182 # Check for GIG libraries.
183 if (CONFIG_LIBGIG)
184 pkg_check_modules (GIG gig>=3.3.0)
185 if (GIG_FOUND)
186 include_directories (${GIG_INCLUDE_DIRS})
187 link_directories (${GIG_LIBRARY_DIRS})
188 link_libraries (${GIG_LIBRARIES})
189 # set (CMAKE_REQUIRED_LIBRARIES "${GIG_LIBRARIES};${CMAKE_REQUIRED_LIBRARIES}")
190 # liggig supports fast information retrieval.
191 set (CONFIG_LIBGIG_SETAUTOLOAD 1)
192 # Check if libgig/SF.h is available.
193 check_include_file_cxx (libgig/SF.h HAVE_LIBGIG_SF_H)
194 if (NOT HAVE_LIBGIG_SF_H)
195 set (CONFIG_LIBGIG_SF2 0)
196 else ()
197 set (CONFIG_LIBGIG_SF2 1)
198 endif ()
199 else ()
200 message (WARNING "*** GIG library not found.")
201 set (CONFIG_LIBGIG 0)
202 endif ()
203 endif ()
204
205
206 add_subdirectory (src)
207
208 configure_file (qsampler.spec.in qsampler.spec IMMEDIATE @ONLY)
209
210 install (FILES qsampler.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
211 install (FILES qsampler.fr.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/fr/man1 RENAME qsampler.1)
212
213 # Configuration status
214 macro (SHOW_OPTION text value)
215 if (${value})
216 message ("${text}: yes")
217 else ()
218 message ("${text}: no")
219 endif ()
220 endmacro ()
221
222
223 message ("\n ${PACKAGE_NAME} ${PACKAGE_VERSION}")
224 message ("\n Build target . . . . . . . . . . . . . . . . . . .: ${CONFIG_BUILD_TYPE}\n")
225 show_option (" LSCP instrument name support . . . . . . . . . . ." CONFIG_INSTRUMENT_NAME)
226 show_option (" LSCP mute/solo support . . . . . . . . . . . . . ." CONFIG_MUTE_SOLO)
227 show_option (" LSCP MIDI instrument support . . . . . . . . . . ." CONFIG_MIDI_INSTRUMENT)
228 show_option (" LSCP FX send support . . . . . . . . . . . . . . ." CONFIG_FXSEND)
229 show_option (" LSCP FX send level support . . . . . . . . . . . ." CONFIG_FXSEND_LEVEL)
230 show_option (" LSCP FX send rename support . . . . . . . . . . ." CONFIG_FXSEND_RENAME)
231 show_option (" LSCP audio routing support . . . . . . . . . . . ." CONFIG_AUDIO_ROUTING)
232 show_option (" LSCP volume support . . . . . . . . . . . . . . ." CONFIG_VOLUME)
233 show_option (" LSCP edit instrument support . . . . . . . . . . ." CONFIG_EDIT_INSTRUMENT)
234 show_option (" GigaSampler instrument file support (libgig) . . ." CONFIG_LIBGIG)
235 if (CONFIG_LIBGIG)
236 show_option (" libgig supports fast information retrieval . . . ." CONFIG_LIBGIG_SETAUTOLOAD)
237 show_option (" libgig supports SoundFont2 instruments files . . ." CONFIG_LIBGIG_SF2)
238 endif ()
239 show_option (" LSCP channel MIDI event support . . . . . . . . ." CONFIG_EVENT_CHANNEL_MIDI)
240 show_option (" LSCP device MIDI event support . . . . . . . . . ." CONFIG_EVENT_DEVICE_MIDI)
241 show_option (" LSCP runtime max. voices / disk streams support ." CONFIG_MAX_VOICES)
242 message ("")
243 show_option (" Unique/Single instance support . . . . . . . . . ." CONFIG_XUNIQUE)
244 show_option (" Debugger stack-trace (gdb) . . . . . . . . . . . ." CONFIG_STACKTRACE)
245 message ("\n Install prefix . . . . . . . . . . . . . . . . . .: ${CMAKE_INSTALL_PREFIX}")
246 message ("\nNow type 'make', followed by 'make install' as root.\n")

  ViewVC Help
Powered by ViewVC