Debian Codegraph @

common/BuildSettings.h

raw
1 /*
2 * BuildSettings.h
3 * ---------------
4 * Purpose: Global, user settable compile time flags (and some global system header configuration)
5 * Notes : (currently none)
6 * Authors: OpenMPT Devs
7 * The OpenMPT source code is released under the BSD license. Read LICENSE for more details.
8 */
9
10
11 #pragma once
12
13
14
15 #include "BuildSettingsCompiler.h"
16
17
18
19 #include "mpt/base/detect_arch.hpp"
20 #include "mpt/base/detect_compiler.hpp"
21 #include "mpt/base/detect_os.hpp"
22 #include "mpt/base/detect_quirks.hpp"
23
24
25
26 #if defined(MODPLUG_TRACKER) && defined(LIBOPENMPT_BUILD)
27 #error "either MODPLUG_TRACKER or LIBOPENMPT_BUILD has to be defined"
28 #elif defined(MODPLUG_TRACKER)
29 // nothing
30 #define MPT_INLINE_NS mptx
31 #elif defined(LIBOPENMPT_BUILD)
32 // nothing
33 #define MPT_INLINE_NS mpt_libopenmpt
34 #else
35 #error "either MODPLUG_TRACKER or LIBOPENMPT_BUILD has to be defined"
36 #endif // MODPLUG_TRACKER || LIBOPENMPT_BUILD
37
38
39
40 #if defined(MODPLUG_TRACKER)
41
42 #if defined(MPT_BUILD_RETRO)
43 #define OPENMPT_BUILD_VARIANT "Retro"
44 #define OPENMPT_BUILD_VARIANT_MONIKER " RETRO"
45 #else
46 #if MPT_OS_WINDOWS
47 #if MPT_WINNT_AT_LEAST(MPT_WIN_10)
48 #define OPENMPT_BUILD_VARIANT "Standard"
49 #define OPENMPT_BUILD_VARIANT_MONIKER ""
50 #else
51 #define OPENMPT_BUILD_VARIANT "Legacy"
52 #define OPENMPT_BUILD_VARIANT_MONIKER ""
53 #endif
54 #else
55 #define OPENMPT_BUILD_VARIANT "Unknown"
56 #define OPENMPT_BUILD_VARIANT_MONIKER ""
57 #endif
58 #endif
59
60 #define MPT_WITH_DMO
61
62 #define MPT_WITH_VST
63
64 #if MPT_OS_WINDOWS
65 #if MPT_WINNT_AT_LEAST(MPT_WIN_7)
66 #define MPT_WITH_MEDIAFOUNDATION
67 #endif
68 #endif
69
70 #if MPT_OS_WINDOWS
71 #if MPT_WINNT_AT_LEAST(MPT_WIN_10)
72 #define MPT_WITH_WINDOWS10
73 #endif
74 #endif
75
76 #endif // MODPLUG_TRACKER
77
78
79
80 #if defined(MODPLUG_TRACKER)
81
82 // Enable built-in test suite.
83 #if defined(MPT_BUILD_DEBUG) || defined(MPT_BUILD_CHECKED)
84 #define ENABLE_TESTS
85 #endif
86
87 // Enable generation and verification of playback traces
88 #define MPT_ENABLE_PLAYBACK_TRACE
89
90 // Disable any file saving functionality (not really useful except for the player library)
91 //#define MODPLUG_NO_FILESAVE
92
93 // Disable any debug logging
94 #if !defined(MPT_BUILD_DEBUG) && !defined(MPT_BUILD_CHECKED) && !defined(MPT_BUILD_WINESUPPORT)
95 #define MPT_LOG_GLOBAL_LEVEL_STATIC
96 #define MPT_LOG_GLOBAL_LEVEL 0
97 #endif
98
99 // Enable all individual logging macros and MPT_LOG calls
100 //#define MPT_ALL_LOGGING
101
102 // Disable all runtime asserts
103 #if !defined(MPT_BUILD_DEBUG) && !defined(MPT_BUILD_CHECKED) && !defined(MPT_BUILD_WINESUPPORT)
104 #define NO_ASSERTS
105 #endif
106
107 // Enable global ComponentManager
108 #define MPT_COMPONENT_MANAGER 1
109
110 // Support for externally linked samples e.g. in MPTM files
111 #define MPT_EXTERNAL_SAMPLES
112
113 // Support mpt::CharsetLocale
114 #define MPT_ENABLE_CHARSET_LOCALE
115
116 // Use architecture-specific intrinsics
117 #define MPT_ENABLE_ARCH_INTRINSICS
118
119 #define MPT_ENABLE_UPDATE
120
121 #if defined(MPT_BUILD_DEBUG)
122 #define MPT_ENABLE_PLAYBACK_TEST_MENU
123 #endif
124
125 // Disable unarchiving support
126 //#define NO_ARCHIVE_SUPPORT
127
128 // Disable the built-in reverb effect
129 //#define NO_REVERB
130
131 // Disable built-in miscellaneous DSP effects (surround, mega bass, noise reduction)
132 //#define NO_DSP
133
134 // Disable the built-in equalizer.
135 //#define NO_EQ
136
137 // Disable the built-in automatic gain control
138 //#define NO_AGC
139
140 // (HACK) Define to build without any plugin support
141 //#define NO_PLUGINS
142
143 #endif // MODPLUG_TRACKER
144
145
146
147 #if defined(LIBOPENMPT_BUILD)
148
149 #ifdef MPT_WITH_FLAC
150 #error "Building libopenmpt with FLAC is useless and not a supported configuration. Please fix your build system to not list libflac as a dependency for libopenmpt itself. It is only a dependency of openmpt123."
151 #endif
152
153 #ifndef LIBOPENMPT_NO_DEPRECATE
154 #define LIBOPENMPT_NO_DEPRECATE
155 #endif
156
157 #if (defined(_DEBUG) || defined(DEBUG)) && !defined(MPT_BUILD_DEBUG)
158 #define MPT_BUILD_DEBUG
159 #endif
160
161 #if defined(LIBOPENMPT_BUILD_TEST)
162 #define ENABLE_TESTS
163 #define MPT_ENABLE_PLAYBACK_TRACE
164 #else
165 #define MODPLUG_NO_FILESAVE
166 #endif
167 #if defined(MPT_BUILD_ANALZYED) || defined(MPT_BUILD_DEBUG) || defined(MPT_BUILD_CHECKED) || defined(ENABLE_TESTS)
168 // enable asserts
169 #else
170 #define NO_ASSERTS
171 #endif
172 //#define MPT_ALL_LOGGING
173 #define MPT_COMPONENT_MANAGER 0
174 //#define MPT_EXTERNAL_SAMPLES
175 #if defined(ENABLE_TESTS) || defined(MPT_BUILD_HACK_ARCHIVE_SUPPORT)
176 #define MPT_ENABLE_CHARSET_LOCALE
177 #else
178 //#define MPT_ENABLE_CHARSET_LOCALE
179 #endif
180 // Do not use architecture-specifid intrinsics in library builds. There is just about no codepath which would use it anyway.
181 //#define MPT_ENABLE_ARCH_INTRINSICS
182 #if defined(MPT_BUILD_HACK_ARCHIVE_SUPPORT)
183 //#define NO_ARCHIVE_SUPPORT
184 #else
185 #define NO_ARCHIVE_SUPPORT
186 #endif
187 //#define NO_REVERB
188 #define NO_DSP
189 #define NO_EQ
190 #define NO_AGC
191 //#define NO_PLUGINS
192
193 #endif // LIBOPENMPT_BUILD
194
195
196
197 #if MPT_OS_WINDOWS
198
199 #ifndef MPT_ENABLE_CHARSET_LOCALE
200 #define MPT_ENABLE_CHARSET_LOCALE
201 #endif
202
203 #elif MPT_OS_LINUX
204
205 #elif MPT_OS_ANDROID
206
207 #elif MPT_OS_EMSCRIPTEN
208
209 #elif MPT_OS_MACOSX_OR_IOS
210
211 #elif MPT_OS_DJGPP
212
213 #endif
214
215
216
217 #define MPT_TIME_UTC_ON_DISK 0
218 #define MPT_TIME_UTC_ON_DISK_VERSION MPT_V("1.31.00.13")
219
220
221
222 // fixing stuff up
223
224 #if defined(MPT_BUILD_ANALYZED) || defined(MPT_BUILD_CHECKED)
225 #ifdef NO_ASSERTS
226 #undef NO_ASSERTS // static or dynamic analyzers want assertions on
227 #endif
228 #endif
229
230 #if defined(MPT_BUILD_FUZZER)
231 #ifndef MPT_FUZZ_TRACKER
232 #define MPT_FUZZ_TRACKER
233 #endif
234 #endif
235
236 #if defined(MPT_ENABLE_ARCH_INTRINSICS)
237 #if MPT_ARCH_X86
238
239 #define MPT_ENABLE_ARCH_X86
240
241 #define MPT_WANT_ARCH_INTRINSICS_X86_SSE
242 #define MPT_WANT_ARCH_INTRINSICS_X86_SSE2
243
244 #elif MPT_ARCH_AMD64
245
246 #define MPT_ENABLE_ARCH_AMD64
247
248 #define MPT_WANT_ARCH_INTRINSICS_X86_SSE
249 #define MPT_WANT_ARCH_INTRINSICS_X86_SSE2
250
251 #endif // arch
252 #endif // MPT_ENABLE_ARCH_INTRINSICS
253
254 #if defined(ENABLE_TESTS) && defined(MODPLUG_NO_FILESAVE)
255 #undef MODPLUG_NO_FILESAVE // tests recommend file saving
256 #endif
257
258 #if defined(MPT_WITH_ZLIB) && defined(MPT_WITH_MINIZ)
259 // Only one deflate implementation should be used. Prefer zlib.
260 #undef MPT_WITH_MINIZ
261 #endif
262
263 #if !MPT_OS_WINDOWS && defined(MPT_WITH_MEDIAFOUNDATION)
264 #undef MPT_WITH_MEDIAFOUNDATION // MediaFoundation requires Windows
265 #endif
266
267 #if !MPT_COMPILER_MSVC && !MPT_COMPILER_CLANG && defined(MPT_WITH_MEDIAFOUNDATION)
268 #undef MPT_WITH_MEDIAFOUNDATION // MediaFoundation requires MSVC or Clang due to ATL (no MinGW support)
269 #endif
270
271 #if (defined(MPT_WITH_MPG123) || defined(MPT_WITH_MINIMP3)) && !defined(MPT_ENABLE_MP3_SAMPLES)
272 #define MPT_ENABLE_MP3_SAMPLES
273 #endif
274
275 #if defined(ENABLE_TESTS)
276 #define MPT_ENABLE_FILEIO // Test suite requires PathString for file loading.
277 #endif
278
279 #if defined(MODPLUG_TRACKER) && !defined(MPT_ENABLE_FILEIO)
280 #define MPT_ENABLE_FILEIO // Tracker requires disk file io
281 #endif
282
283 #if defined(MPT_EXTERNAL_SAMPLES) && !defined(MPT_ENABLE_FILEIO)
284 #define MPT_ENABLE_FILEIO // External samples require disk file io
285 #endif
286
287 #if defined(NO_PLUGINS)
288 // Any plugin type requires NO_PLUGINS to not be defined.
289 #if defined(MPT_WITH_VST)
290 #undef MPT_WITH_VST
291 #endif
292 #endif
293
294
295
296 #if defined(MODPLUG_TRACKER) && !defined(MPT_BUILD_WINESUPPORT) && !defined(MPT_BUILD_WINESUPPORT_WRAPPER)
297 #ifndef MPT_NO_NAMESPACE
298 #define MPT_NO_NAMESPACE
299 #endif
300 #endif
301
302 #if defined(MPT_NO_NAMESPACE)
303
304 #ifdef OPENMPT_NAMESPACE
305 #undef OPENMPT_NAMESPACE
306 #endif
307 #define OPENMPT_NAMESPACE
308
309 #ifdef OPENMPT_NAMESPACE_BEGIN
310 #undef OPENMPT_NAMESPACE_BEGIN
311 #endif
312 #define OPENMPT_NAMESPACE_BEGIN
313
314 #ifdef OPENMPT_NAMESPACE_END
315 #undef OPENMPT_NAMESPACE_END
316 #endif
317 #define OPENMPT_NAMESPACE_END
318
319 #else
320
321 #ifndef OPENMPT_NAMESPACE
322 #define OPENMPT_NAMESPACE OpenMPT
323 #endif
324
325 #ifndef OPENMPT_NAMESPACE_BEGIN
326 #define OPENMPT_NAMESPACE_BEGIN namespace OPENMPT_NAMESPACE {
327 #endif
328 #ifndef OPENMPT_NAMESPACE_END
329 #define OPENMPT_NAMESPACE_END }
330 #endif
331
332 #endif
333
334 #define MPT_CONFIGURATION_IO_READ_FILEDATA_NO_64BIT
335
336
337
338 // platform configuration
339
340 #if MPT_OS_WINDOWS
341
342 #define WIN32_LEAN_AND_MEAN
343
344 // windows.h excludes
345 #define NOMEMMGR // GMEM_*, LMEM_*, GHND, LHND, associated routines
346 #ifndef NOMINMAX
347 #define NOMINMAX // Macros min(a,b) and max(a,b)
348 #endif
349 #define NOSERVICE // All Service Controller routines, SERVICE_ equates, etc.
350 #define NOCOMM // COMM driver routines
351 #define NOKANJI // Kanji support stuff.
352 #define NOPROFILER // Profiler interface.
353 #define NOMCX // Modem Configuration Extensions
354
355 // mmsystem.h excludes
356 #define MMNODRV
357 //#define MMNOSOUND
358 //#define MMNOWAVE
359 //#define MMNOMIDI
360 #define MMNOAUX
361 #define MMNOMIXER
362 //#define MMNOTIMER
363 #define MMNOJOY
364 #define MMNOMCI
365 //#define MMNOMMIO
366 //#define MMNOMMSYSTEM
367
368 // mmreg.h excludes
369 #define NOMMIDS
370 //#define NONEWWAVE
371 #define NONEWRIFF
372 #define NOJPEGDIB
373 #define NONEWIC
374 #define NOBITMAP
375
376 #endif // MPT_OS_WINDOWS
377
378
379
380 // third-party library configuration
381
382 #ifdef MPT_WITH_STBVORBIS
383 #ifndef STB_VORBIS_HEADER_ONLY
384 #define STB_VORBIS_HEADER_ONLY
385 #endif
386 #endif
387
388 #ifdef MPT_WITH_VORBISFILE
389 #ifndef OV_EXCLUDE_STATIC_CALLBACKS
390 #define OV_EXCLUDE_STATIC_CALLBACKS
391 #endif
392 #endif
393
394
395
396 #ifdef __cplusplus
397
398 #include "mpt/base/namespace.hpp"
399
400 OPENMPT_NAMESPACE_BEGIN
401
402 namespace mpt {
403
404 #ifndef MPT_NO_NAMESPACE
405 using namespace ::mpt;
406 #endif
407
408 } // namespace mpt
409
410 OPENMPT_NAMESPACE_END
411
412 #endif