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

Contents of /qsampler/trunk/CMakeLists.txt

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3569 - (show annotations) (download)
Sun Aug 25 21:47:56 2019 UTC (9 months ago) by capela
File MIME type: text/plain
File size: 7672 byte(s)
- Retouched the CMake build configuration files (twice again).
1 project(QSAMPLER)
2
3 cmake_minimum_required(VERSION 2.6)
4
5 set (VERSION "0.5.7")
6
7 execute_process (
8 COMMAND git describe --tags --dirty --abbrev=6
9 OUTPUT_VARIABLE GIT_DESCRIBE_OUTPUT
10 RESULT_VARIABLE GIT_DESCRIBE_RESULT
11 OUTPUT_STRIP_TRAILING_WHITESPACE)
12 if (GIT_DESCRIBE_RESULT EQUAL 0)
13 set (VERSION "${GIT_DESCRIBE_OUTPUT}")
14 string (REGEX REPLACE "^[^_vV]+" "" VERSION "${VERSION}")
15 string (REGEX REPLACE "^[_vV]+" "" 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)
43 if (CONFIG_BUILD_TYPE MATCHES "debug")
44 set(CONFIG_DEBUG 1)
45 endif ()
46 set (CONFIG_PREFIX "${CMAKE_INSTALL_PREFIX}")
47
48
49 # Enable libgig availability.
50 option (CONFIG_LIBGIG "Enable libgig interface (default=yes)" 1)
51
52 # Enable unique/single instance.
53 option (CONFIG_XUNIQUE "Enable unique/single instance (default=yes)" 1)
54
55 # Enable debugger stack-trace option (assumes --enable-debug).
56 option (CONFIG_STACKTRACE "Enable debugger stack-trace (default=no)" 0)
57
58 # Fix for new CMAKE_REQUIRED_LIBRARIES policy.
59 if (POLICY CMP0075)
60 cmake_policy (SET CMP0075 NEW)
61 endif ()
62
63 # Check for Qt
64 find_package (Qt5 REQUIRED NO_MODULE COMPONENTS Core Gui Widgets)
65
66 if (CONFIG_XUNIQUE)
67 find_package (Qt5 REQUIRED NO_MODULE COMPONENTS Network)
68 endif ()
69
70 find_package (Qt5LinguistTools)
71
72 include (GNUInstallDirs)
73 include (CheckIncludeFile)
74 include (CheckIncludeFiles)
75 include (CheckIncludeFileCXX)
76 include (CheckFunctionExists)
77 include (CheckLibraryExists)
78
79 # Checks for libraries.
80 if (WIN32)
81 check_function_exists (lroundf CONFIG_ROUND)
82 else ()
83 find_library (MATH_LIBRARY m)
84 # Check for round math function.
85 if (MATH_LIBRARY)
86 set (CMAKE_REQUIRED_LIBRARIES "${MATH_LIBRARY};${CMAKE_REQUIRED_LIBRARIES}")
87 check_function_exists (lroundf CONFIG_ROUND)
88 else ()
89 message (FATAL_ERROR "*** math library not found.")
90 endif ()
91 endif ()
92
93 # Checks for header files.
94 if (UNIX AND NOT APPLE)
95 check_include_files ("fcntl.h;unistd.h;signal.h" HAVE_SIGNAL_H)
96 endif ()
97
98
99 # Find package modules
100 find_package (PkgConfig REQUIRED)
101
102 # Check for LSCP libraries.
103 pkg_check_modules (LSCP REQUIRED lscp)
104 set (CONFIG_LIBLSCP ${LSCP_FOUND})
105 if (CONFIG_LIBLSCP)
106 include_directories (${LSCP_INCLUDE_DIRS})
107 link_directories (${LSCP_LIBRARY_DIRS})
108 set (CMAKE_REQUIRED_LIBRARIES "${LSCP_LIBRARIES};${CMAKE_REQUIRED_LIBRARIES}")
109 # Check for for instrument_name in lscp_channel_info_t.
110 check_include_file (lscp/client.h CONFIG_INSTRUMENT_NAME)
111 # Check for mute/solo in lscp_channel_info_t.
112 check_include_file (lscp/client.h CONFIG_MUTE_SOLO)
113 if (CONFIG_MUTE_SOLO)
114 check_function_exists (lscp_set_channel_mute CONFIG_MUTE_SOLO)
115 endif ()
116 if (CONFIG_MUTE_SOLO)
117 check_function_exists (lscp_set_channel_solo CONFIG_MUTE_SOLO)
118 endif ()
119 # Check if MIDI instrument mapping is available.
120 check_function_exists (lscp_map_midi_instrument CONFIG_MIDI_INSTRUMENT)
121 # Check if FX sends is available.
122 check_function_exists (lscp_create_fxsend CONFIG_FXSEND)
123 # Check for FX send level in lscp_fxsend_info_t
124 if (CONFIG_FXSEND)
125 check_include_file (lscp/client.h CONFIG_FXSEND_LEVEL)
126 endif ()
127 # Check if FX send rename is available.
128 if (CONFIG_FXSEND)
129 check_function_exists (lscp_set_fxsend_name CONFIG_FXSEND_RENAME)
130 endif ()
131 # Check for audio_routing array type
132 check_include_file (lscp/client.h CONFIG_AUDIO_ROUTING)
133 # Check if global volume is available.
134 check_function_exists (lscp_set_volume CONFIG_VOLUME)
135 # Check if instrument editing is available.
136 check_function_exists (lscp_edit_channel_instrument CONFIG_EDIT_INSTRUMENT)
137 # Check for CHANNEL_MIDI LSCP event support in liblscp],
138 check_include_file (lscp/event.h CONFIG_EVENT_CHANNEL_MIDI)
139 # Check for DEVICE_MIDI LSCP event support in liblscp],
140 check_include_file (lscp/event.h CONFIG_EVENT_DEVICE_MIDI)
141 # Check if max. voices / streams is available.
142 check_function_exists (lscp_get_voices CONFIG_MAX_VOICES)
143 else ()
144 message (FATAL_ERROR "*** LSCP library not found.")
145 endif ()
146
147 # Check for GIG libraries.
148 if (CONFIG_LIBGIG)
149 pkg_check_modules (GIG gig>=3.3.0)
150 set (CONFIG_LIBGIG ${GIG_FOUND})
151 if (CONFIG_LIBGIG)
152 include_directories (${GIG_INCLUDE_DIRS})
153 link_directories (${GIG_LIBRARY_DIRS})
154 link_libraries (${GIG_LIBRARIES})
155 # set (CMAKE_REQUIRED_LIBRARIES "${GIG_LIBRARIES};${CMAKE_REQUIRED_LIBRARIES}")
156 # liggig supports fast information retrieval.
157 set (CONFIG_LIBGIG_SETAUTOLOAD 1)
158 # Check if libgig/SF.h is available.
159 check_include_file_cxx (libgig/SF.h CONFIG_LIBGIG_SF2)
160 else ()
161 message (WARNING "*** GIG library not found.")
162 endif ()
163 endif ()
164
165
166 add_subdirectory (src)
167
168 configure_file (qsampler.spec.in qsampler.spec IMMEDIATE @ONLY)
169
170 install (FILES qsampler.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
171 install (FILES qsampler.fr.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/fr/man1 RENAME qsampler.1)
172
173 # Configuration status
174 macro (SHOW_OPTION text value)
175 if (${value})
176 message("${text}: yes")
177 else ()
178 message("${text}: no")
179 endif ()
180 endmacro ()
181
182
183 message ("\n ${PACKAGE_NAME} ${PACKAGE_VERSION}")
184 message ("\n Build target . . . . . . . . . . . . . . . . . . .: ${CONFIG_BUILD_TYPE}\n")
185 show_option (" LSCP instrument name support . . . . . . . . . . ." CONFIG_INSTRUMENT_NAME)
186 show_option (" LSCP mute/solo support . . . . . . . . . . . . . ." CONFIG_MUTE_SOLO)
187 show_option (" LSCP MIDI instrument support . . . . . . . . . . ." CONFIG_MIDI_INSTRUMENT)
188 show_option (" LSCP FX send support . . . . . . . . . . . . . . ." CONFIG_FXSEND)
189 show_option (" LSCP FX send level support . . . . . . . . . . . ." CONFIG_FXSEND_LEVEL)
190 show_option (" LSCP FX send rename support . . . . . . . . . . ." CONFIG_FXSEND_RENAME)
191 show_option (" LSCP audio routing support . . . . . . . . . . . ." CONFIG_AUDIO_ROUTING)
192 show_option (" LSCP volume support . . . . . . . . . . . . . . ." CONFIG_VOLUME)
193 show_option (" LSCP edit instrument support . . . . . . . . . . ." CONFIG_EDIT_INSTRUMENT)
194 show_option (" GigaSampler instrument file support (libgig) . . ." CONFIG_LIBGIG)
195 if (CONFIG_LIBGIG)
196 show_option (" libgig supports fast information retrieval . . . ." CONFIG_LIBGIG_SETAUTOLOAD)
197 show_option (" libgig supports SoundFont2 instruments files . . ." CONFIG_LIBGIG_SF2)
198 endif ()
199 show_option (" LSCP channel MIDI event support . . . . . . . . ." CONFIG_EVENT_CHANNEL_MIDI)
200 show_option (" LSCP device MIDI event support . . . . . . . . . ." CONFIG_EVENT_DEVICE_MIDI)
201 show_option (" LSCP runtime max. voices / disk streams support ." CONFIG_MAX_VOICES)
202 message ("")
203 show_option (" Unique/Single instance support . . . . . . . . . ." CONFIG_XUNIQUE)
204 show_option (" Debugger stack-trace (gdb) . . . . . . . . . . . ." CONFIG_STACKTRACE)
205 message ("\n Install prefix . . . . . . . . . . . . . . . . . .: ${CMAKE_INSTALL_PREFIX}")
206 message ("\nNow type 'make', followed by 'make install' as root.\n")

  ViewVC Help
Powered by ViewVC