TurtleBrains  0.3.5
High quality, portable, C++ framework for rapid 2D game development.
tb_configuration.hpp
1 
9 #ifndef TurtleBrains_Configuration_hpp
10 #define TurtleBrains_Configuration_hpp
11 
12 //TODO: TurtleBrains: Remove the settings in the build script and set them up here, hopefully automatically.
13 // 2022-05-28: Perhaps this should not be setup here as it would make it near impossible to build for platform X while
14 // using a tool that would typically build for platform Y (consider building Web from Linux or similar).
15 
17 //#define tb_windows
18 //#define tb_macos
19 //#define tb_linux
20 //#define tb_web
21 //#define tb_ios
22 
23 #if defined(tb_macosx)
24  #warning The tb_macosx define is deprecated, use tb_macos
25  #if !defined(tb_macos)
26  #define tb_macos
27  #endif /* only define if needed, always give warning. */
28 #endif /* use newer tb_macos define */
29 
30 #if !defined(tb_windows) && !defined(tb_macos) && !defined(tb_linux) && !defined(tb_web) && !defined(tb_ios)
31  #error Unsupported or unknown platform configuration, make sure either: tb_windows, tb_macos, tb_linux, or tb_web is defined.
32 #endif /* tb_platform */
33 
36 //#define tb_without_threading ///< When deefined, TurtleBrains will stay on a single thread, otherwise Audio and other things may run on threads.
37 //#define tb_without_audio ///< When defined, TurtleBrains will NOT include the Audio API, which would require linking with OpenAL.
38 //#define tb_without_networking ///< When defined, TurtleBrains will NOT include the Networking API, which may require additional linked dependencies.
39 //#define tb_without_input_devices ///< When defined, TurtleBrains will NOT include the system input devices API, which could require additional linking.
40 //#define tb_without_development ///< When defined, TurtleBrains will NOT include the Development API, which is useful tools for development stuff.
41 //#define tb_without_math_operators ///< When defined, Vector/Matrix math objects will contain FEWER operators, does NOT disable ALL operators!
42 //#define tb_without_splash_screen ///< When defined, TurtleBrains will jump directly to set scene instead of displaying TurtleBrains splash screen.
43 //#define tb_without_legacy_gl ///< When defined, if TurtleBrains cannot create a 3.2 Core context, it will fail to create application window.
44 //#define tb_with_legacy_gl_context ///< When defined a legacy OpenGL context will be used instead of 3.2 Core, if possible. Not recommended.
45 //#define tb_without_internal_tests ///< When defined TurtleBrains will not build and include internal tests into the UnitTest RunAllTests().
46 //#define tb_righthanded_math ///< When defined, TurtleBrains math will use negative-Z as forward.
47 
52 //#define tb_with_debug_set ///< Can be used to keep the debug tools/logging active even in a release build.
53 //#define tb_without_debug_set ///< Takes precedence over anything else, if defined will shutoff debug_set completely.
54 //#define tb_without_diagnostics ///< Turn off TurtleBrains internal logging, automatically implied if tb_without_debug_set is defined.
55 
56 //Wide String support has been untested for so long that it probably does not work, and may be removed? 2022-05-28
57 //#define tb_with_wide_string ///< Allows an Opt-In for using std::wstring vs std::string implementation throughout framework.
58 
59 //If unspecified, setup the debug/release state based on DEBUG or _DEBUG being defined.
60 //Note: 2023-08-31: Before today tb_public_build was being since at least 2021, and didn't appear below. Which meant that
61 // tb_release_build was ALSO defined while tb_public_build was defined. Going forward only one _build config is defined
62 // in a given build. It seemed code (at least in TurtleBrains, ICE and TrackBuilder) was generally checking against
63 // tb_debug_build for special debug code and tb_public_build for special ship conditions, while release just remained
64 // in the middle. This should mean this change is acceptable and desired, but may find some projects with oddities.
65 #if !defined(tb_public_build) && !defined(tb_release_build) && !defined(tb_development_build) && !defined(tb_debug_build)
66  #if !defined(DEBUG) && !defined(_DEBUG)
67  #define tb_release_build
68  #else
69  #define tb_debug_build
70  #endif
71 #endif /* tb_debug_build or tb_development_build or tb_release_build or tb_public_build*/
72 
73 //Defines for the compiler being used, mainly to use specific 'features' of a compiler or, more likely, to avoid issues when building.
74 #if !defined(tb_visual_cpp) && !defined(tb_mingw)
75  #if defined(_MSC_VER)
76  #define tb_visual_cpp
77  #elif defined(__MINGW32__)
78  #define tb_mingw
79  #endif
80 #endif /* compiler checks */
81 
82 #if !defined(tb_with_debug_set) && !defined(tb_without_debug_set)
83  #if defined(tb_debug_build)
84  #define tb_with_debug_set
85  #else
86  #define tb_without_debug_set
87  #endif
88 #endif
89 
90 //Using the with/without options, enable the actual define used deeper in the framework.
91 #if !defined(tb_without_diagnostics) && !defined(tb_with_diagnostics)
92 #if !defined(tb_release_build) || defined(tb_with_debug_set)
93  #define tb_with_diagnostics
94 #else
95  #define tb_without_diagnostics
96 #endif
97 #endif
98 
99 #if defined(tb_with_diagnostics)
100 #if !defined(tb_diagnose_opengl)
101  #define tb_diagnose_opengl false
102 #endif
103 #else
104 #if !defined(tb_diagnose_opengl)
105  #define tb_diagnose_opengl false
106 #endif
107 #endif
108 
109 //--------------------------------------------------------------------------------------------------------------------//
110 //--------------------------------------------------------------------------------------------------------------------//
111 //--------------------------------------------------------------------------------------------------------------------//
112 
113 #if !defined(tb_without_threading) && !defined(tb_with_threading)
114  #define tb_with_threading
115 #elif defined(tb_without_threading) && defined(tb_with_threading)
116  #warning Both tb_with_threading and tb_without_threading are defined, No threading used.
117  #undef(tb_with_threading);
118 #endif
119 
120 #if !defined(tb_without_audio) && !defined(tb_with_audio)
121  #define tb_with_audio
122 #elif defined(tb_without_audio) && defined(tb_with_audio)
123  #warning Both tb_with_audio and tb_without_audio are defined, No audio used.
124  #undef(tb_with_audio)
125 #endif
126 
127 #if !defined(tb_without_networking) && !defined(tb_with_networking)
128  #define tb_with_networking
129 #elif defined(tb_without_networking) && defined(tb_with_networking)
130  #warning Both tb_with_networking and tb_without_networking are defined, No networking used.
131  #undef(tb_with_networking)
132 #endif
133 
134 #if !defined(tb_without_input_devices) && !defined(tb_with_input_devices)
135  #define tb_with_input_devices
136 #elif defined(tb_without_input_devices) && defined(tb_with_input_devices)
137  #warning Both tb_with_input_devices and tb_without_input_devices are defined, No input devices used.
138  #undef tb_with_input_devices
139 #endif
140 
142 // Uncaught emscripten_get_num_gamepads() can only be called after having first called
143 // emscripten_sample_gamepad_data() and that function has returned EMSCRIPTEN_RESULT_SUCCESS!
144 //
145 // 2022-08-15: I believe the above has been mostly or completely dealt with in r1752 which has an accidental bad
146 // commit message, so ignore that; I believe that code was running, and I know it was with this commented out,
147 // however I am not aware if there were any other side effects, or if it actually worked as intended. Since
148 // Rally of Rockets was cancelled the reason to support this vanished for now.
149 #if defined(tb_web) && defined(tb_with_input_devices)
150  #undef tb_with_input_devices
151  #if !defined(tb_without_input_devices)
152  #define tb_without_input_devices
153  #endif
154 #endif
155 
156 #if !defined(tb_righthanded_math) && !defined(tb_lefthanded_math)
157  // @note 2023-11-09: LeftHanded math isn't exactly supported but this begins to allow future support.
158  #define tb_righthanded_math
159 #endif
160 
161 //As of 2023-08-31 development_kit was deprecated and renamed to development_tools for consistency with other defines.
162 // Once this makes its way into the SVN repo and the nightly builds are still building, this comment and the following
163 // checks/warning can be removed. I don't believe any project has used any of these defines.
164 #if defined(tb_with_development_kit) || defined(tb_without_development_kit) || defined(tb_with_development) || defined(tb_without_development)
165  #warning Development Kit defines have changed (2023-08-31) and should be tb_with_development_tools or tb_without_development_tools
166 #endif
167 
168 #if !defined(tb_without_development_tools) && !defined(tb_with_development_tools)
169  #if defined(tb_debug_build) || defined(tb_development_build)
170  #define tb_with_development_tools
171  #else
172  #define tb_without_development_tools
173  #endif
174 #elif defined(tb_without_development_tools) && defined(tb_with_development_tools)
175  #warning Both tb_with_development_kit and tb_without_development_kit are defined, No development kit used.
176  #undef tb_with_development_tools
177 #endif
178 
179 #if !defined(tb_without_math_operators) && !defined(tb_with_math_operators)
180  #define tb_with_math_operators
181 #elif defined(tb_without_math_operators) && defined(tb_with_math_operators)
182  #warning Both tb_with_math_operators and tb_without_math_operators are defined, No math operators used.
183  #undef tb_with_math_operators
184 #endif
185 
186 #if !defined(tb_without_splash_screen) && !defined(tb_with_splash_screen)
187  #define tb_with_splash_screen
188 #elif defined(tb_without_splash_screen) && defined(tb_with_splash_screen)
189  #warning Both tb_with_splash_screen and tb_without_splash_screen are defined, No splash screen used.
190  #undef tb_with_splash_screen
191 #endif
192 
193 #if !defined(tb_without_legacy_gl) && !defined(tb_with_legacy_gl)
194  #define tb_with_legacy_gl
195 #elif defined(tb_without_legacy_gl) && defined(tb_with_legacy_gl)
196  #warning Both tb_with_legacy_gl and tb_without_legacy_gl are defined, No legacy OpenGL used.
197  #undef tb_with_legacy_gl
198 #endif
199 
200 #if !defined(tb_without_internal_tests) && !defined(tb_with_internal_tests)
201  #define tb_with_internal_tests
202 #elif defined(tb_without_internal_tests) && defined(tb_with_internal_tests)
203  #warning Both tb_with_internal_tests and tb_without_internal_tests are defined, No internal tests used.
204  #undef tb_with_internal_tests
205 #endif
206 
207 #endif /* TurtleBrains_Configuration_hpp */