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

Annotation of /qsampler/trunk/CMakeLists.txt

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3997 - (hide annotations) (download)
Mon Sep 27 09:45:24 2021 UTC (3 months, 4 weeks ago) by capela
File MIME type: text/plain
File size: 9336 byte(s)
- Bumped dot version into the next develop cycle.
1 capela 3910 cmake_minimum_required (VERSION 3.13)
2 capela 3851
3 capela 3910 project (qsampler
4 capela 3997 VERSION 0.9.5
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 capela 3871 WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
12 capela 3567 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 capela 3824 string (REGEX REPLACE "^[^0-9]+" "" VERSION "${VERSION}")
18 capela 3873 string (REGEX REPLACE "^1_" "" VERSION "${VERSION}")
19     string (REGEX REPLACE "^[_vV]+" "" VERSION "${VERSION}")
20 capela 3567 string (REGEX REPLACE "-g" "git." VERSION "${VERSION}")
21 capela 3873 string (REGEX REPLACE "[_|-]" "." VERSION "${VERSION}")
22 capela 3567 execute_process (
23     COMMAND git rev-parse --abbrev-ref HEAD
24 capela 3871 WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
25 capela 3567 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 capela 3571 endif ()
31 capela 3852 else ()
32     set (VERSION "${PROJECT_VERSION}")
33 capela 3567 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 capela 3867 set (ac_version "${PROJECT_VERSION}")
42     set (ac_prefix "${CMAKE_INSTALL_PREFIX}")
43    
44 capela 3567 set (CONFIG_BUILD_VERSION "${PACKAGE_VERSION}")
45    
46 capela 3907 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 capela 3567 else ()
55     set (CONFIG_BUILD_TYPE "release")
56     endif ()
57    
58     set (CONFIG_PREFIX "${CMAKE_INSTALL_PREFIX}")
59    
60 capela 3570 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 capela 3567
66 capela 3570
67 capela 3567 # 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 capela 3571
77 capela 3869 # Enable Qt6 build preference.
78 capela 3907 option (CONFIG_QT6 "Enable Qt6 build (default=yes)" 1)
79 capela 3869
80    
81 capela 3567 # Fix for new CMAKE_REQUIRED_LIBRARIES policy.
82     if (POLICY CMP0075)
83     cmake_policy (SET CMP0075 NEW)
84     endif ()
85    
86 capela 3868 # Check for Qt...
87 capela 3869 if (CONFIG_QT6)
88     find_package (Qt6 QUIET)
89     if (NOT Qt6_FOUND)
90     set (CONFIG_QT6 0)
91     endif ()
92     endif ()
93    
94     if (CONFIG_QT6)
95 capela 3868 find_package (QT QUIET NAMES Qt6)
96     else ()
97     find_package (QT QUIET NAMES Qt5)
98     endif ()
99    
100 capela 3841 find_package (Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core Gui Widgets)
101 capela 3569
102     if (CONFIG_XUNIQUE)
103 capela 3841 find_package (Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Network)
104 capela 3569 endif ()
105    
106 capela 3841 find_package (Qt${QT_VERSION_MAJOR}LinguistTools)
107 capela 3567
108     include (CheckIncludeFile)
109     include (CheckIncludeFiles)
110     include (CheckIncludeFileCXX)
111     include (CheckFunctionExists)
112     include (CheckLibraryExists)
113    
114     # Checks for libraries.
115     if (WIN32)
116     check_function_exists (lroundf CONFIG_ROUND)
117     else ()
118     find_library (MATH_LIBRARY m)
119     # Check for round math function.
120     if (MATH_LIBRARY)
121     set (CMAKE_REQUIRED_LIBRARIES "${MATH_LIBRARY};${CMAKE_REQUIRED_LIBRARIES}")
122     check_function_exists (lroundf CONFIG_ROUND)
123     else ()
124     message (FATAL_ERROR "*** math library not found.")
125     endif ()
126     endif ()
127    
128     # Checks for header files.
129     if (UNIX AND NOT APPLE)
130     check_include_files ("fcntl.h;unistd.h;signal.h" HAVE_SIGNAL_H)
131     endif ()
132    
133    
134     # Find package modules
135 capela 3968 include (FindPkgConfig)
136 capela 3567
137     # Check for LSCP libraries.
138 capela 3851 pkg_check_modules (LSCP REQUIRED IMPORTED_TARGET lscp)
139 capela 3641 if (LSCP_FOUND)
140 capela 3907 find_library(LSCP_LIBRARY NAMES ${LSCP_LIBRARIES} HINTS ${LSCP_LIBDIR})
141     endif ()
142     if (LSCP_LIBRARY)
143 capela 3641 set (CONFIG_LIBLSCP 1)
144 capela 3907 set (CMAKE_REQUIRED_LIBRARIES "${LSCP_LIBRARY};${CMAKE_REQUIRED_LIBRARIES}")
145 capela 3567 # Check for for instrument_name in lscp_channel_info_t.
146 capela 3640 check_include_file (lscp/client.h HAVE_LSCP_CLIENT_H)
147     if (NOT HAVE_LSCP_CLIENT_H)
148     set (CONFIG_INSTRUMENT_NAME 0)
149     else ()
150     set (CONFIG_INSTRUMENT_NAME 1)
151     endif ()
152 capela 3567 # Check for mute/solo in lscp_channel_info_t.
153 capela 3640 if (NOT HAVE_LSCP_CLIENT_H)
154     set (CONFIG_MUTE_SOLO 0)
155     else ()
156     set (CONFIG_MUTE_SOLO 1)
157     endif ()
158 capela 3567 if (CONFIG_MUTE_SOLO)
159     check_function_exists (lscp_set_channel_mute CONFIG_MUTE_SOLO)
160     endif ()
161     if (CONFIG_MUTE_SOLO)
162     check_function_exists (lscp_set_channel_solo CONFIG_MUTE_SOLO)
163     endif ()
164     # Check if MIDI instrument mapping is available.
165     check_function_exists (lscp_map_midi_instrument CONFIG_MIDI_INSTRUMENT)
166     # Check if FX sends is available.
167     check_function_exists (lscp_create_fxsend CONFIG_FXSEND)
168     # Check for FX send level in lscp_fxsend_info_t
169     if (CONFIG_FXSEND)
170 capela 3640 if (NOT HAVE_LSCP_CLIENT_H)
171     set (CONFIG_FXSEND_LEVEL 0)
172     else ()
173     set (CONFIG_FXSEND_LEVEL 1)
174     endif ()
175 capela 3567 endif ()
176     # Check if FX send rename is available.
177     if (CONFIG_FXSEND)
178     check_function_exists (lscp_set_fxsend_name CONFIG_FXSEND_RENAME)
179     endif ()
180     # Check for audio_routing array type
181 capela 3640 if (NOT HAVE_LSCP_CLIENT_H)
182     set (CONFIG_AUDIO_ROUTING 0)
183     else ()
184     set (CONFIG_AUDIO_ROUTING 1)
185     endif ()
186 capela 3567 # Check if global volume is available.
187     check_function_exists (lscp_set_volume CONFIG_VOLUME)
188     # Check if instrument editing is available.
189     check_function_exists (lscp_edit_channel_instrument CONFIG_EDIT_INSTRUMENT)
190     # Check for CHANNEL_MIDI LSCP event support in liblscp],
191 capela 3640 check_include_file (lscp/event.h HAVE_LSCP_EVENT_H)
192     if (NOT HAVE_LSCP_EVENT_H)
193     set (CONFIG_EVENT_CHANNEL_MIDI 0)
194     else ()
195     set (CONFIG_EVENT_CHANNEL_MIDI 1)
196     endif ()
197 capela 3567 # Check for DEVICE_MIDI LSCP event support in liblscp],
198 capela 3640 if (NOT HAVE_LSCP_EVENT_H)
199     set (CONFIG_EVENT_DEVICE_MIDI 0)
200     else ()
201     set (CONFIG_EVENT_DEVICE_MIDI 1)
202     endif ()
203 capela 3567 # Check if max. voices / streams is available.
204     check_function_exists (lscp_get_voices CONFIG_MAX_VOICES)
205     else ()
206     message (FATAL_ERROR "*** LSCP library not found.")
207 capela 3641 set (CONFIG_LIBLSCP 0)
208 capela 3567 endif ()
209    
210     # Check for GIG libraries.
211     if (CONFIG_LIBGIG)
212 capela 3851 pkg_check_modules (GIG IMPORTED_TARGET gig>=3.3.0)
213 capela 3641 if (GIG_FOUND)
214 capela 3907 find_library(GIG_LIBRARY NAMES ${GIG_LIBRARIES} HINTS ${GIG_LIBDIR})
215     endif ()
216     if (GIG_LIBRARY)
217     set (CONFIG_LIBGIG 1)
218     #set (CMAKE_REQUIRED_LIBRARIES "${GIG_LIBRARY};${CMAKE_REQUIRED_LIBRARIES}")
219 capela 3567 # liggig supports fast information retrieval.
220     set (CONFIG_LIBGIG_SETAUTOLOAD 1)
221     # Check if libgig/SF.h is available.
222 capela 3640 check_include_file_cxx (libgig/SF.h HAVE_LIBGIG_SF_H)
223     if (NOT HAVE_LIBGIG_SF_H)
224     set (CONFIG_LIBGIG_SF2 0)
225     else ()
226     set (CONFIG_LIBGIG_SF2 1)
227     endif ()
228 capela 3567 else ()
229     message (WARNING "*** GIG library not found.")
230 capela 3641 set (CONFIG_LIBGIG 0)
231 capela 3567 endif ()
232     endif ()
233    
234    
235     add_subdirectory (src)
236    
237     configure_file (qsampler.spec.in qsampler.spec IMMEDIATE @ONLY)
238    
239     install (FILES qsampler.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
240     install (FILES qsampler.fr.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/fr/man1 RENAME qsampler.1)
241    
242     # Configuration status
243     macro (SHOW_OPTION text value)
244     if (${value})
245 capela 3571 message ("${text}: yes")
246 capela 3567 else ()
247 capela 3571 message ("${text}: no")
248 capela 3567 endif ()
249     endmacro ()
250    
251 capela 3569
252 capela 3868 message ("\n ${PACKAGE_NAME} ${PACKAGE_VERSION} (Qt ${QT_VERSION})")
253 capela 3569 message ("\n Build target . . . . . . . . . . . . . . . . . . .: ${CONFIG_BUILD_TYPE}\n")
254 capela 3567 show_option (" LSCP instrument name support . . . . . . . . . . ." CONFIG_INSTRUMENT_NAME)
255     show_option (" LSCP mute/solo support . . . . . . . . . . . . . ." CONFIG_MUTE_SOLO)
256     show_option (" LSCP MIDI instrument support . . . . . . . . . . ." CONFIG_MIDI_INSTRUMENT)
257     show_option (" LSCP FX send support . . . . . . . . . . . . . . ." CONFIG_FXSEND)
258     show_option (" LSCP FX send level support . . . . . . . . . . . ." CONFIG_FXSEND_LEVEL)
259     show_option (" LSCP FX send rename support . . . . . . . . . . ." CONFIG_FXSEND_RENAME)
260     show_option (" LSCP audio routing support . . . . . . . . . . . ." CONFIG_AUDIO_ROUTING)
261     show_option (" LSCP volume support . . . . . . . . . . . . . . ." CONFIG_VOLUME)
262     show_option (" LSCP edit instrument support . . . . . . . . . . ." CONFIG_EDIT_INSTRUMENT)
263     show_option (" GigaSampler instrument file support (libgig) . . ." CONFIG_LIBGIG)
264     if (CONFIG_LIBGIG)
265     show_option (" libgig supports fast information retrieval . . . ." CONFIG_LIBGIG_SETAUTOLOAD)
266     show_option (" libgig supports SoundFont2 instruments files . . ." CONFIG_LIBGIG_SF2)
267     endif ()
268     show_option (" LSCP channel MIDI event support . . . . . . . . ." CONFIG_EVENT_CHANNEL_MIDI)
269     show_option (" LSCP device MIDI event support . . . . . . . . . ." CONFIG_EVENT_DEVICE_MIDI)
270     show_option (" LSCP runtime max. voices / disk streams support ." CONFIG_MAX_VOICES)
271 capela 3569 message ("")
272 capela 3567 show_option (" Unique/Single instance support . . . . . . . . . ." CONFIG_XUNIQUE)
273     show_option (" Debugger stack-trace (gdb) . . . . . . . . . . . ." CONFIG_STACKTRACE)
274 capela 3907 message ("\n Install prefix . . . . . . . . . . . . . . . . . .: ${CONFIG_PREFIX}")
275 capela 3569 message ("\nNow type 'make', followed by 'make install' as root.\n")

  ViewVC Help
Powered by ViewVC