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

Annotation of /qsampler/trunk/CMakeLists.txt

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3869 - (hide annotations) (download)
Thu Apr 1 21:49:01 2021 UTC (6 weeks, 3 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 capela 3851 cmake_minimum_required(VERSION 3.10)
2    
3 capela 3852 project(qsampler
4 capela 3867 VERSION 0.9.3
5 capela 3852 DESCRIPTION "A LinuxSampler Qt GUI Interface"
6     LANGUAGES C CXX)
7 capela 3567
8 capela 3852 set (CONFIG_VERSION ${PROJECT_VERSION})
9 capela 3567 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 capela 3824 string (REGEX REPLACE "^[^0-9]+" "" VERSION "${VERSION}")
17 capela 3567 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 capela 3571 endif ()
27 capela 3852 else ()
28     set (VERSION "${PROJECT_VERSION}")
29 capela 3567 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 capela 3867 set (ac_version "${PROJECT_VERSION}")
38     set (ac_prefix "${CMAKE_INSTALL_PREFIX}")
39    
40 capela 3567 set (CONFIG_BUILD_VERSION "${PACKAGE_VERSION}")
41    
42     if (CMAKE_BUILD_TYPE)
43 capela 3571 set (CONFIG_BUILD_TYPE ${CMAKE_BUILD_TYPE})
44 capela 3567 else ()
45     set (CONFIG_BUILD_TYPE "release")
46     endif ()
47    
48 capela 3571 set (CONFIG_DEBUG 0)
49 capela 3567 if (CONFIG_BUILD_TYPE MATCHES "debug")
50 capela 3571 set (CONFIG_DEBUG 1)
51 capela 3567 endif ()
52 capela 3570
53 capela 3567 set (CONFIG_PREFIX "${CMAKE_INSTALL_PREFIX}")
54    
55 capela 3570 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 capela 3567
61 capela 3570
62 capela 3567 # 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 capela 3571
72 capela 3869 # Enable Qt6 build preference.
73     option (CONFIG_QT6 "Enable Qt6 build (default=no)" 0)
74    
75    
76 capela 3567 # Fix for new CMAKE_REQUIRED_LIBRARIES policy.
77     if (POLICY CMP0075)
78     cmake_policy (SET CMP0075 NEW)
79     endif ()
80    
81 capela 3868 # Check for Qt...
82 capela 3869 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 capela 3868 find_package (QT QUIET NAMES Qt6)
91     else ()
92     find_package (QT QUIET NAMES Qt5)
93     endif ()
94    
95 capela 3841 find_package (Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core Gui Widgets)
96 capela 3569
97     if (CONFIG_XUNIQUE)
98 capela 3841 find_package (Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Network)
99 capela 3569 endif ()
100    
101 capela 3841 find_package (Qt${QT_VERSION_MAJOR}LinguistTools)
102 capela 3567
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 capela 3851 pkg_check_modules (LSCP REQUIRED IMPORTED_TARGET lscp)
134 capela 3641 if (LSCP_FOUND)
135     set (CONFIG_LIBLSCP 1)
136 capela 3567 include_directories (${LSCP_INCLUDE_DIRS})
137     link_directories (${LSCP_LIBRARY_DIRS})
138 capela 3571 # link_libraries (${LSCP_LIBRARIES})
139 capela 3567 set (CMAKE_REQUIRED_LIBRARIES "${LSCP_LIBRARIES};${CMAKE_REQUIRED_LIBRARIES}")
140     # Check for for instrument_name in lscp_channel_info_t.
141 capela 3640 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 capela 3567 # Check for mute/solo in lscp_channel_info_t.
148 capela 3640 if (NOT HAVE_LSCP_CLIENT_H)
149     set (CONFIG_MUTE_SOLO 0)
150     else ()
151     set (CONFIG_MUTE_SOLO 1)
152     endif ()
153 capela 3567 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 capela 3640 if (NOT HAVE_LSCP_CLIENT_H)
166     set (CONFIG_FXSEND_LEVEL 0)
167     else ()
168     set (CONFIG_FXSEND_LEVEL 1)
169     endif ()
170 capela 3567 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 capela 3640 if (NOT HAVE_LSCP_CLIENT_H)
177     set (CONFIG_AUDIO_ROUTING 0)
178     else ()
179     set (CONFIG_AUDIO_ROUTING 1)
180     endif ()
181 capela 3567 # 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 capela 3640 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 capela 3567 # Check for DEVICE_MIDI LSCP event support in liblscp],
193 capela 3640 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 capela 3567 # 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 capela 3641 set (CONFIG_LIBLSCP 0)
203 capela 3567 endif ()
204    
205     # Check for GIG libraries.
206     if (CONFIG_LIBGIG)
207 capela 3851 pkg_check_modules (GIG IMPORTED_TARGET gig>=3.3.0)
208 capela 3641 if (GIG_FOUND)
209 capela 3567 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 capela 3640 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 capela 3567 else ()
223     message (WARNING "*** GIG library not found.")
224 capela 3641 set (CONFIG_LIBGIG 0)
225 capela 3567 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 capela 3571 message ("${text}: yes")
240 capela 3567 else ()
241 capela 3571 message ("${text}: no")
242 capela 3567 endif ()
243     endmacro ()
244    
245 capela 3569
246 capela 3868 message ("\n ${PACKAGE_NAME} ${PACKAGE_VERSION} (Qt ${QT_VERSION})")
247 capela 3569 message ("\n Build target . . . . . . . . . . . . . . . . . . .: ${CONFIG_BUILD_TYPE}\n")
248 capela 3567 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 capela 3569 message ("")
266 capela 3567 show_option (" Unique/Single instance support . . . . . . . . . ." CONFIG_XUNIQUE)
267     show_option (" Debugger stack-trace (gdb) . . . . . . . . . . . ." CONFIG_STACKTRACE)
268 capela 3569 message ("\n Install prefix . . . . . . . . . . . . . . . . . .: ${CMAKE_INSTALL_PREFIX}")
269     message ("\nNow type 'make', followed by 'make install' as root.\n")

  ViewVC Help
Powered by ViewVC