GLSL Struct 1.4.0
glslstruct
Loading...
Searching...
No Matches
config.hpp
1/*
2 * glslstruct - a C++ library designed to easily represent GLSL's Uniform Buffer Objects (UBOs) and Shader Storage Buffer Objects (SSBOs) in C++.
3 *
4 * Licensed under the BSD 3-Clause License with Attribution Requirement.
5 * See the LICENSE file for details: https://github.com/MAIPA01/glslstruct/blob/main/LICENSE
6 *
7 * Copyright (c) 2025, Patryk Antosik (MAIPA01)
8 */
9
10#pragma once
11#ifndef _GLSL_STRUCT_CONFIG_HPP_
12 #define _GLSL_STRUCT_CONFIG_HPP_
13
14/**
15 * @defgroup glslstruct GLSLStruct
16 * @brief Main group
17 */
18
19/**
20 * @defgroup utils Utilities
21 * @brief group with utilities (not for end user to use)
22 * @ingroup glslstruct
23 */
24
25/**
26 * @namespace glslstruct
27 * @brief Main namespace of glslstruct library
28 */
29
30/**
31 * @namespace glslstruct::uitls
32 * @brief Utility namespace of glslstruct library
33 */
34
35 #pragma region VERSION
36 /**
37 * @brief glslstruct version major number
38 * @ingroup glslstruct
39 */
40 #define GLSL_STRUCT_VERSION_MAJOR 1
41 /**
42 * @brief glslstruct version minor number
43 * @ingroup glslstruct
44 */
45 #define GLSL_STRUCT_VERSION_MINOR 4
46 /**
47 * @brief glslstruct version patch number
48 * @ingroup glslstruct
49 */
50 #define GLSL_STRUCT_VERSION_PATCH 0
51
52 /**
53 * @brief stringify helper
54 * @ingroup utils
55 */
56 #define _GLSL_STRUCT_STRINGIFY_HELPER(x) #x
57
58 /**
59 * @brief converts version numbers to string
60 * @ingroup utils
61 */
62 #define _GLSL_STRUCT_VERSION_TO_STRING(major, minor, patch)
64 /**
65 * @brief converts version number to int
66 * @ingroup utils
67 */
68 #define _GLSL_STRUCT_VERSION_TO_INT(major, minor, patch) (major * 100 + minor * 10 + patch)
69
70 /**
71 * @brief glslstruct version string
72 * @ingroup glslstruct
73 */
76 /**
77 * @brief glslstruct version int
78 * @ingroup glslstruct
79 */
82 /**
83 * @brief glslstruct version string
84 * @ingroup glslstruct
85 */
86 #define GLSL_STRUCT_VERSION GLSL_STRUCT_VERSION_STRING
87 #pragma endregion
88
89 #pragma region LAST_UPDATE
90 /**
91 * @brief glslstruct last update day
92 * @ingroup glslstruct
93 */
94 #define GLSL_STRUCT_LAST_UPDATE_DAY 13
95 /**
96 * @brief glslstruct last update month
97 * @ingroup glslstruct
98 */
99 #define GLSL_STRUCT_LAST_UPDATE_MONTH 04
100 /**
101 * @brief glslstruct last update year
102 * @ingroup glslstruct
103 */
104 #define GLSL_STRUCT_LAST_UPDATE_YEAR 2026
105
106 /**
107 * @brief converts last update date to string
108 * @ingroup utils
109 */
110 #define _GLSL_STRUCT_LAST_UPDATE_DATE_HELPER(day, month, year)
112
113 /**
114 * @brief glslstruct last update date string
115 * @ingroup glslstruct
116 */
120 #pragma endregion
121
122 #pragma region CXX_VERSIONS
123/**
124 * @def _GLSL_STRUCT_HAS_CXX17
125 * @brief check if compiler has c++ version greater or equal to c++17
126 * @ingroup utils
127 */
128 #ifndef _HAS_CXX17
129 // clang-format off
130 #define _GLSL_STRUCT_HAS_CXX17 __cplusplus >= 201703l
131 // clang-format on
132 #else
133 #define _GLSL_STRUCT_HAS_CXX17 _HAS_CXX17
134 #endif
135
136 /**
137 * @def _GLSL_STRUCT_HAS_CXX20
138 * @brief check if compiler has c++ version greater or equal to c++20 and if user enabled c++20 features using GLSL_STRUCT_ENABLE_CXX20
139 * @ingroup utils
140 */
141 #ifndef GLSL_STRUCT_ENABLE_CXX20
142 #define _GLSL_STRUCT_HAS_CXX20 0
143 #elif !defined(_HAS_CXX20)
144 // clang-format off
145 #define _GLSL_STRUCT_HAS_CXX20 __cplusplus >= 202002l && GLSL_STRUCT_ENABLE_CXX20
146 // clang-format on
147 #else
148 #define _GLSL_STRUCT_HAS_CXX20 _HAS_CXX20&& GLSL_STRUCT_ENABLE_CXX20
149 #endif
150 #pragma endregion
151
152 #pragma region TYPES
153/**
154 * @def _GLSL_STRUCT_HAS_TYPES
155 * @brief check if user not disabled type containers using GLSL_STRUCT_DISABLE_TYPES
156 * @ingroup utils
157 */
158
159 #ifdef GLSL_STRUCT_DISABLE_TYPES
160 #define _GLSL_STRUCT_HAS_TYPES 0
161 #else
162 #define _GLSL_STRUCT_HAS_TYPES _GLSL_STRUCT_HAS_CXX17
163 #endif
164
165/**
166 * @def _GLSL_STRUCT_HAS_TYPE_CHECKS
167 * @brief check if user enabled type checks for struct getters using GLSL_STRUCT_ENABLE_TYPE_CHECKS (remember it only works if GLSL_STRUCT_DISABLE_TYPES was not set)
168 * @ingroup utils
169 */
170 #if defined(GLSL_STRUCT_ENABLE_TYPE_CHECKS) && !defined(GLSL_STRUCT_DISABLE_TYPES)
171 #define _GLSL_STRUCT_HAS_TYPE_CHECKS 1
172 #else
173 #define _GLSL_STRUCT_HAS_TYPE_CHECKS 0
174 #endif
175 #pragma endregion
176
177/**
178 * @def _GLSL_STRUCT_HAS_PARSER
179 * @brief check if user want to include parser functionality
180 * @ingroup utils
181 */
182
183 #ifdef GLSL_STRUCT_DISABLE_PARSER
184 #define _GLSL_STRUCT_HAS_PARSER 0
185 #else
186 #define _GLSL_STRUCT_HAS_PARSER _GLSL_STRUCT_HAS_CXX17
187 #endif
188
189 #pragma region VERSION_SPECIFIC_VALUES
190/**
191 * @def _GLSL_STRUCT_CONSTEXPR17
192 * @brief constexpr for c++17 and higher
193 * @ingroup utils
194 */
196 #define _GLSL_STRUCT_CONSTEXPR17 constexpr
197 #else
198 #define _GLSL_STRUCT_CONSTEXPR17
199 #endif
200
201/**
202 * @def _GLSL_STRUCT_CONSTEXPR20
203 * @brief constexpr keyword for c++20 and higher
204 * @ingroup utils
205 */
206
207/**
208 * @def _GLSL_STRUCT_REQUIRES(condition)
209 * @brief requires keyword for c++20 and higher
210 * @ingroup utils
211 */
213 #define _GLSL_STRUCT_CONSTEXPR20 constexpr
214 #define _GLSL_STRUCT_REQUIRES(condition) requires (condition)
215 #define _GLSL_STRUCT_INLINE17
216 #define _GLSL_STRUCT_TYPENAME17
217 #else
218 #define _GLSL_STRUCT_CONSTEXPR20
219 #define _GLSL_STRUCT_REQUIRES(condition)
221 #define _GLSL_STRUCT_INLINE17 inline
222 #define _GLSL_STRUCT_TYPENAME17 typename
223 #else
224 #define _GLSL_STRUCT_INLINE17
225 #define _GLSL_STRUCT_TYPENAME17
226 #endif
227 #endif
228 #pragma endregion
229
230 #include <mstd/mstd.hpp>
231
232 /**
233 * @brief compiler message
234 * @ingroup utils
235 */
236 #define _GLSL_STRUCT_MESSAGE(MESSAGE) _MSTD_MESSAGE(MESSAGE)
237 /**
238 * @brief compiler warning
239 * @ingroup utils
240 */
241 #define _GLSL_STRUCT_WARNING(MESSAGE) _MSTD_WARNING(MESSAGE)
242 /**
243 * @brief compiler error
244 * @ingroup utils
245 */
246 #define _GLSL_STRUCT_ERROR(MESSAGE) _MSTD_ERROR(MESSAGE)
247#endif
#define GLSL_STRUCT_VERSION_STRING
glslstruct version string
Definition config.hpp:74
#define GLSL_STRUCT_VERSION_MINOR
glslstruct version minor number
Definition config.hpp:45
#define GLSL_STRUCT_LAST_UPDATE_DAY
glslstruct last update day
Definition config.hpp:94
#define GLSL_STRUCT_VERSION_MAJOR
glslstruct version major number
Definition config.hpp:40
#define GLSL_STRUCT_LAST_UPDATE_YEAR
glslstruct last update year
Definition config.hpp:104
#define GLSL_STRUCT_VERSION_PATCH
glslstruct version patch number
Definition config.hpp:50
#define GLSL_STRUCT_LAST_UPDATE_MONTH
glslstruct last update month
Definition config.hpp:99
#define _GLSL_STRUCT_VERSION_TO_STRING(major, minor, patch)
converts version numbers to string
Definition config.hpp:62
#define _GLSL_STRUCT_HAS_CXX20
check if compiler has c++ version greater or equal to c++20 and if user enabled c++20 features using ...
Definition config.hpp:142
#define _GLSL_STRUCT_HAS_CXX17
check if compiler has c++ version greater or equal to c++17
Definition config.hpp:130
#define _GLSL_STRUCT_LAST_UPDATE_DATE_HELPER(day, month, year)
converts last update date to string
Definition config.hpp:110
#define _GLSL_STRUCT_VERSION_TO_INT(major, minor, patch)
converts version number to int
Definition config.hpp:68
#define _GLSL_STRUCT_STRINGIFY_HELPER(x)
stringify helper
Definition config.hpp:56