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

Contents of /qsampler/trunk/CMakeLists.txt

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3570 - (show annotations) (download)
Mon Aug 26 13:49:09 2019 UTC (2 years, 10 months ago) by capela
File MIME type: text/plain
File size: 7963 byte(s)
- Updated/added README.cmake to present new CMake build instructions.
1 project(QSAMPLER)
2
3 cmake_minimum_required(VERSION 3.1)
4
5 set (VERSION "0.5.7")
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 "^[^_vV]+" "" VERSION "${VERSION}")
16 string (REGEX REPLACE "^[_vV]+" "" 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 endif ()
28
29 set (PACKAGE_NAME "Qsampler")
30 set (PACKAGE_VERSION "${VERSION}")
31 set (PACKAGE_BUGREPORT "rncbc@rncbc.org")
32 set (PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
33 set (PACKAGE_TARNAME "qsampler")
34
35 set (CONFIG_BUILD_VERSION "${PACKAGE_VERSION}")
36
37 if (CMAKE_BUILD_TYPE)
38 set (CONFIG_BUILD_TYPE CMAKE_BUILD_TYPE)
39 else ()
40 set (CONFIG_BUILD_TYPE "release")
41 endif ()
42
43 set (CONFIG_DEBUG)
44 if (CONFIG_BUILD_TYPE MATCHES "debug")
45 set(CONFIG_DEBUG 1)
46 endif ()
47
48 set (CONFIG_PREFIX "${CMAKE_INSTALL_PREFIX}")
49
50 include (GNUInstallDirs)
51 set (CONFIG_BINDIR "${CONFIG_PREFIX}/${CMAKE_INSTALL_BINDIR}")
52 set (CONFIG_LIBDIR "${CONFIG_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
53 set (CONFIG_DATADIR "${CONFIG_PREFIX}/${CMAKE_INSTALL_DATADIR}")
54 set (CONFIG_MANDIR "${CONFIG_PREFIX}/${CMAKE_INSTALL_MANDIR}")
55
56
57 # Enable libgig availability.
58 option (CONFIG_LIBGIG "Enable libgig interface (default=yes)" 1)
59
60 # Enable unique/single instance.
61 option (CONFIG_XUNIQUE "Enable unique/single instance (default=yes)" 1)
62
63 # Enable debugger stack-trace option (assumes --enable-debug).
64 option (CONFIG_STACKTRACE "Enable debugger stack-trace (default=no)" 0)
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 NO_MODULE COMPONENTS Core Gui Widgets)
73
74 if (CONFIG_XUNIQUE)
75 find_package (Qt5 REQUIRED NO_MODULE 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 set (CONFIG_LIBLSCP ${LSCP_FOUND})
112 if (CONFIG_LIBLSCP)
113 include_directories (${LSCP_INCLUDE_DIRS})
114 link_directories (${LSCP_LIBRARY_DIRS})
115 set (CMAKE_REQUIRED_LIBRARIES "${LSCP_LIBRARIES};${CMAKE_REQUIRED_LIBRARIES}")
116 # Check for for instrument_name in lscp_channel_info_t.
117 check_include_file (lscp/client.h CONFIG_INSTRUMENT_NAME)
118 # Check for mute/solo in lscp_channel_info_t.
119 check_include_file (lscp/client.h CONFIG_MUTE_SOLO)
120 if (CONFIG_MUTE_SOLO)
121 check_function_exists (lscp_set_channel_mute CONFIG_MUTE_SOLO)
122 endif ()
123 if (CONFIG_MUTE_SOLO)
124 check_function_exists (lscp_set_channel_solo CONFIG_MUTE_SOLO)
125 endif ()
126 # Check if MIDI instrument mapping is available.
127 check_function_exists (lscp_map_midi_instrument CONFIG_MIDI_INSTRUMENT)
128 # Check if FX sends is available.
129 check_function_exists (lscp_create_fxsend CONFIG_FXSEND)
130 # Check for FX send level in lscp_fxsend_info_t
131 if (CONFIG_FXSEND)
132 check_include_file (lscp/client.h CONFIG_FXSEND_LEVEL)
133 endif ()
134 # Check if FX send rename is available.
135 if (CONFIG_FXSEND)
136 check_function_exists (lscp_set_fxsend_name CONFIG_FXSEND_RENAME)
137 endif ()
138 # Check for audio_routing array type
139 check_include_file (lscp/client.h CONFIG_AUDIO_ROUTING)
140 # Check if global volume is available.
141 check_function_exists (lscp_set_volume CONFIG_VOLUME)
142 # Check if instrument editing is available.
143 check_function_exists (lscp_edit_channel_instrument CONFIG_EDIT_INSTRUMENT)
144 # Check for CHANNEL_MIDI LSCP event support in liblscp],
145 check_include_file (lscp/event.h CONFIG_EVENT_CHANNEL_MIDI)
146 # Check for DEVICE_MIDI LSCP event support in liblscp],
147 check_include_file (lscp/event.h CONFIG_EVENT_DEVICE_MIDI)
148 # Check if max. voices / streams is available.
149 check_function_exists (lscp_get_voices CONFIG_MAX_VOICES)
150 else ()
151 message (FATAL_ERROR "*** LSCP library not found.")
152 endif ()
153
154 # Check for GIG libraries.
155 if (CONFIG_LIBGIG)
156 pkg_check_modules (GIG gig>=3.3.0)
157 set (CONFIG_LIBGIG ${GIG_FOUND})
158 if (CONFIG_LIBGIG)
159 include_directories (${GIG_INCLUDE_DIRS})
160 link_directories (${GIG_LIBRARY_DIRS})
161 link_libraries (${GIG_LIBRARIES})
162 # set (CMAKE_REQUIRED_LIBRARIES "${GIG_LIBRARIES};${CMAKE_REQUIRED_LIBRARIES}")
163 # liggig supports fast information retrieval.
164 set (CONFIG_LIBGIG_SETAUTOLOAD 1)
165 # Check if libgig/SF.h is available.
166 check_include_file_cxx (libgig/SF.h CONFIG_LIBGIG_SF2)
167 else ()
168 message (WARNING "*** GIG library not found.")
169 endif ()
170 endif ()
171
172
173 add_subdirectory (src)
174
175 configure_file (qsampler.spec.in qsampler.spec IMMEDIATE @ONLY)
176
177 install (FILES qsampler.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
178 install (FILES qsampler.fr.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/fr/man1 RENAME qsampler.1)
179
180 # Configuration status
181 macro (SHOW_OPTION text value)
182 if (${value})
183 message("${text}: yes")
184 else ()
185 message("${text}: no")
186 endif ()
187 endmacro ()
188
189
190 message ("\n ${PACKAGE_NAME} ${PACKAGE_VERSION}")
191 message ("\n Build target . . . . . . . . . . . . . . . . . . .: ${CONFIG_BUILD_TYPE}\n")
192 show_option (" LSCP instrument name support . . . . . . . . . . ." CONFIG_INSTRUMENT_NAME)
193 show_option (" LSCP mute/solo support . . . . . . . . . . . . . ." CONFIG_MUTE_SOLO)
194 show_option (" LSCP MIDI instrument support . . . . . . . . . . ." CONFIG_MIDI_INSTRUMENT)
195 show_option (" LSCP FX send support . . . . . . . . . . . . . . ." CONFIG_FXSEND)
196 show_option (" LSCP FX send level support . . . . . . . . . . . ." CONFIG_FXSEND_LEVEL)
197 show_option (" LSCP FX send rename support . . . . . . . . . . ." CONFIG_FXSEND_RENAME)
198 show_option (" LSCP audio routing support . . . . . . . . . . . ." CONFIG_AUDIO_ROUTING)
199 show_option (" LSCP volume support . . . . . . . . . . . . . . ." CONFIG_VOLUME)
200 show_option (" LSCP edit instrument support . . . . . . . . . . ." CONFIG_EDIT_INSTRUMENT)
201 show_option (" GigaSampler instrument file support (libgig) . . ." CONFIG_LIBGIG)
202 if (CONFIG_LIBGIG)
203 show_option (" libgig supports fast information retrieval . . . ." CONFIG_LIBGIG_SETAUTOLOAD)
204 show_option (" libgig supports SoundFont2 instruments files . . ." CONFIG_LIBGIG_SF2)
205 endif ()
206 show_option (" LSCP channel MIDI event support . . . . . . . . ." CONFIG_EVENT_CHANNEL_MIDI)
207 show_option (" LSCP device MIDI event support . . . . . . . . . ." CONFIG_EVENT_DEVICE_MIDI)
208 show_option (" LSCP runtime max. voices / disk streams support ." CONFIG_MAX_VOICES)
209 message ("")
210 show_option (" Unique/Single instance support . . . . . . . . . ." CONFIG_XUNIQUE)
211 show_option (" Debugger stack-trace (gdb) . . . . . . . . . . . ." CONFIG_STACKTRACE)
212 message ("\n Install prefix . . . . . . . . . . . . . . . . . .: ${CMAKE_INSTALL_PREFIX}")
213 message ("\nNow type 'make', followed by 'make install' as root.\n")

  ViewVC Help
Powered by ViewVC