nomlib
Toggle main menu visibility
Loading...
Searching...
No Matches
include
nomlib
config.hpp
1
/******************************************************************************
2
3
nomlib - C++11 cross-platform game engine
4
5
Copyright (c) 2013, 2014 Jeffrey Carpenter <i8degrees@gmail.com>
6
All rights reserved.
7
8
Redistribution and use in source and binary forms, with or without
9
modification, are permitted provided that the following conditions are met:
10
11
1. Redistributions of source code must retain the above copyright notice, this
12
list of conditions and the following disclaimer.
13
2. Redistributions in binary form must reproduce the above copyright notice,
14
this list of conditions and the following disclaimer in the documentation
15
and/or other materials provided with the distribution.
16
17
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
21
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
28
******************************************************************************/
29
30
// This file is auto-generated by CMake at build time; modifications to this
31
// file *MUST* be done to config.hpp.in, located in the project's cmake
32
// templates directory.
33
//
34
// Any modifications made to this file will be replaced upon a project
35
// rebuild -- anytime CMake re-generates our project files.
36
37
#ifndef NOMLIB_CORE_CONFIG_HPP
38
#define NOMLIB_CORE_CONFIG_HPP
39
40
// Debugging
41
#include <iostream>
42
#include <string.h>
// __FILE__ macro post-processing
43
44
// Shortened __FILE__ utility macro
45
//
46
// TODO: I'd like to see this integrated into the SDL2Logger interface!
47
#define NOM_FILE \
48
( strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__ )
49
51
#define NOM_USE_SDL2 TRUE
52
54
/* #undef NOM_USE_SDL2_ASSERT */
55
56
// Include SDL2's enhanced assert facility if enabled, otherwise fall-back to
57
// standard C assert facility.
58
#if defined( NOM_USE_SDL2_ASSERT )
// See cmake/platform.cmake
59
#include <SDL_assert.h>
60
#else
61
#include <cassert>
62
#endif
63
64
// nomlib's platform detection
65
#include "nomlib/platforms.hpp"
66
67
// nomlib's standard integer types
68
#include "nomlib/types.hpp"
69
70
#include "nomlib/core/SDL2Logger.hpp"
71
72
// nomlib's general-purpose macros
73
#include "nomlib/macros.hpp"
74
88
#define NOM_LOG_MESSAGE( cat, prio, ... ) \
89
{ nom::SDL2Logger( cat, prio ).write( __VA_ARGS__ ); }
90
97
#if defined( NOM_DEBUG )
98
#define NOM_LOG_VERBOSE( cat, ... ) \
99
NOM_LOG_MESSAGE( cat, nom::LogPriority::NOM_LOG_PRIORITY_VERBOSE, "[", NOM_FILE, ":", __LINE__, "]", __VA_ARGS__ );
100
#else
101
#define NOM_LOG_VERBOSE( cat, ... ) \
102
NOM_LOG_MESSAGE( cat, nom::LogPriority::NOM_LOG_PRIORITY_VERBOSE, __VA_ARGS__ );
103
#endif
104
111
#if defined( NOM_DEBUG )
112
#define NOM_LOG_DEBUG( cat, ... ) \
113
NOM_LOG_MESSAGE( cat, nom::LogPriority::NOM_LOG_PRIORITY_DEBUG, "[", NOM_FILE, ":", __LINE__, "]", __VA_ARGS__ );
114
#else
115
#define NOM_LOG_DEBUG( cat, ... ) \
116
NOM_LOG_MESSAGE( cat, nom::LogPriority::NOM_LOG_PRIORITY_DEBUG, __VA_ARGS__ );
117
#endif
118
125
#define NOM_LOG_INFO( cat, ... ) \
126
NOM_LOG_MESSAGE( cat, nom::LogPriority::NOM_LOG_PRIORITY_INFO, __VA_ARGS__ );
127
134
#if defined( NOM_DEBUG )
135
#define NOM_LOG_WARN( cat, ... ) \
136
NOM_LOG_MESSAGE( cat, nom::LogPriority::NOM_LOG_PRIORITY_WARN, "[", NOM_FILE, ":", __LINE__, "]", __VA_ARGS__ );
137
#else
138
#define NOM_LOG_WARN( cat, ... ) \
139
NOM_LOG_MESSAGE( cat, nom::LogPriority::NOM_LOG_PRIORITY_WARN, __VA_ARGS__ );
140
#endif
141
148
#if defined( NOM_DEBUG )
149
#define NOM_LOG_ERR( cat, ... ) \
150
NOM_LOG_MESSAGE( cat, nom::LogPriority::NOM_LOG_PRIORITY_ERROR, "[", NOM_FILE, ":", __LINE__, "]", __VA_ARGS__ );
151
#else
152
#define NOM_LOG_ERR( cat, ... ) \
153
NOM_LOG_MESSAGE( cat, nom::LogPriority::NOM_LOG_PRIORITY_ERROR, __VA_ARGS__ );
154
#endif
155
162
#if defined( NOM_DEBUG )
163
#define NOM_LOG_CRIT( cat, ... ) \
164
NOM_LOG_MESSAGE( cat, nom::LogPriority::NOM_LOG_PRIORITY_CRITICAL, "[", NOM_FILE, ":", __LINE__, "]", __VA_ARGS__ );
165
#else
166
#define NOM_LOG_CRIT( cat, ... ) \
167
NOM_LOG_MESSAGE( cat, nom::LogPriority::NOM_LOG_PRIORITY_CRITICAL, __VA_ARGS__ );
168
#endif
169
176
#define NOM_DUMP( var ) \
177
NOM_LOG_MESSAGE( NOM, nom::LogPriority::NOM_LOG_PRIORITY_DEBUG, "[", NOM_FILE, ":", __LINE__, "]", #var, ":", var );
178
187
#define NOM_DUMP_VAR( cat, ... ) \
188
NOM_LOG_MESSAGE( cat, nom::LogPriority::NOM_LOG_PRIORITY_DEBUG, "[", NOM_FILE, ":", __LINE__, "]", __VA_ARGS__ );
189
194
#define NOM_LOG_TRACE( cat ) \
195
NOM_LOG_MESSAGE( cat, nom::LogPriority::NOM_LOG_PRIORITY_DEBUG, NOM_FUNC );
196
204
#define NOM_LOG_TRACE_PRIO( cat, prio ) \
205
NOM_LOG_MESSAGE( cat, prio, NOM_FUNC );
206
207
#define NOM_STUBBED( cat ) \
208
NOM_LOG_MESSAGE( cat, nom::LogPriority::NOM_LOG_PRIORITY_INFO, "Stubbed function", NOM_FUNC, "was called" );
209
210
#ifdef NOM_DEBUG_ASSERT
// -D NOM_DEBUG_ASSERT=on
211
212
// Use SDL2's enhanced assert macro if available, otherwise fall-back to
213
// standard C assert.
214
#if defined( NOM_USE_SDL2_ASSERT )
215
#define NOM_ASSERT(expression) SDL_assert(expression)
216
#else
217
#define NOM_ASSERT(expression) \
218
( assert (expression) )
219
#endif
// defined( NOM_USE_SDL2_ASSERT )
220
#elif defined(NDEBUG)
// -DNDEBUG or DEBUG_ASSERT=off
221
#define NOM_ASSERT(expr)
// NO-OP
222
#endif
223
224
// "!! Invalid execution path assertion triggered !!"
225
#define NOM_ASSERT_INVALID_PATH(expr) \
226
( assert(0 == 1 && "!! Invalid execution path triggered !!") )
227
228
#if defined(NOM_COMPILER_CLANG)
229
// SOURCE: http://clang.llvm.org/docs/UsersManual.html#controlling-diagnostics-via-pragmas
230
#define NOM_PRAGMA_STR(msg) #msg
231
#define NOM_PRAGMA_DEFER(arg, ...) arg(__VA_ARGS__)
232
#define NOM_PRAGMA_ERROR(msg) \
233
_Pragma(NOM_PRAGMA_STR(GCC error(msg " in " \
234
NOM_PRAGMA_DEFER(NOM_PRAGMA_STR, __FILE__) \
235
":" NOM_PRAGMA_DEFER(NOM_PRAGMA_STR,__LINE__) )))
236
#else
237
// NO OPCODE defined
238
#define NOM_PRAGMA_STR(msg)
239
#define NOM_PRAGMA_DEFER(arg, ...)
240
#define NOM_PRAGMA_ERROR(msg)
241
#endif
242
243
#ifndef __cplusplus
244
NOM_PRAGMA_ERROR(
"nomlib requires a C++11 capable compiler."
)
245
#endif
246
252
#if defined(NOM_COMPILER_CLANG)
253
263
#define NOM_IGNORED_VARS(expr) \
264
_Pragma("clang diagnostic push") \
265
_Pragma("clang diagnostic ignored \"-Wunused\"" )
266
268
#define NOM_IGNORED_VARS_ENDL(expr) \
269
_Pragma("clang diagnostic pop")
270
272
#define NOM_IGNORED_ENDL(expr) NOM_IGNORED_VARS_ENDL(expr)
273
274
#else
// Ignoring of compiler generated warning messages is not supported
275
// (unknown compiler)
276
277
#define NOM_IGNORED_VARS(expr)
278
#define NOM_IGNORED_VARS_ENDL(expr)
279
#define NOM_IGNORED_ENDL(expr) NOM_IGNORED_VARS_ENDL(expr)
280
281
#endif
// defined(NOM_COMPILER_CLANG)
282
283
// NOTE(jeff): See src/CMakeLists.txt for declarations
284
285
// Image loader
286
#define NOM_USE_SDL2_IMAGE TRUE
287
288
// Font loader
289
// Rename var to NOM_USE_SDL_TTF?
290
#define NOM_USE_SDL2_TTF TRUE
291
#define NOM_USE_SDL_TTF_MAJOR_VERSION 2
292
#define NOM_USE_SDL_TTF_MINOR_VERSION 23
293
/* #undef NOM_USE_SDL_TTF_PATCH_VERSION */
294
295
// Audio
296
/* #undef NOM_USE_CREATIVE_OPENAL */
297
/* #undef NOM_USE_APPLE_OPENAL */
298
#define NOM_USE_OPENAL_SOFT TRUE
299
300
#if defined(NOM_USE_CREATIVE_OPENAL) || defined(NOM_USE_APPLE_OPENAL) || \
301
defined(NOM_USE_OPENAL_SOFT)
302
#define NOM_USE_OPENAL
303
#endif
304
305
#if defined NOM_BUILD_AUDIO_UNIT
306
#ifndef NOM_USE_OPENAL
307
// One of the above variables must be set in src/CMakeLists.txt
308
NOM_PRAGMA_ERROR(
"Audio Unit: One of the OpenAL audio engines must be selected"
)
309
#endif
310
#endif
311
312
#define NOM_USE_LIBSNDFILE TRUE
313
314
// High-quality rescaling algorithms for low-resolution sprites
315
// (i.e.: pixel art)
316
#define NOM_USE_SCALEX TRUE
317
#define NOM_USE_HQX TRUE
318
319
#define NOM_USE_LIBROCKET TRUE
320
/* #undef NOM_USE_LIBROCKET_LUA */
321
322
#endif
// include guard defined
Generated on
for nomlib by
1.18.0