Common System 0.2.0
Common interfaces and patterns for system integration
Loading...
Searching...
No Matches
feature_flags.h
Go to the documentation of this file.
1// BSD 3-Clause License
2// Copyright (c) 2025, 🍀☀🌕🌥 🌊
3// See the LICENSE file in the project root for full license information.
4
42#pragma once
43
44// Include all feature detection headers
45#include "feature_flags_core.h"
46#include "feature_detection.h"
47#include "feature_system_deps.h"
48
49//==============================================================================
50// Legacy Aliases
51//==============================================================================
52
67#if KCENON_ENABLE_LEGACY_ALIASES
68
69//------------------------------------------------------------------------------
70// source_location aliases
71//------------------------------------------------------------------------------
72
73// COMMON_HAS_SOURCE_LOCATION -> KCENON_HAS_SOURCE_LOCATION
74#ifndef COMMON_HAS_SOURCE_LOCATION
75 #define COMMON_HAS_SOURCE_LOCATION KCENON_HAS_SOURCE_LOCATION
76#endif
77
78// KCENON_HAS_STD_SOURCE_LOCATION -> KCENON_HAS_SOURCE_LOCATION
79// (This was the original name in source_location.h)
80#ifndef KCENON_HAS_STD_SOURCE_LOCATION
81 #define KCENON_HAS_STD_SOURCE_LOCATION KCENON_HAS_SOURCE_LOCATION
82#endif
83
84//------------------------------------------------------------------------------
85// System integration aliases
86//------------------------------------------------------------------------------
87
88// USE_THREAD_SYSTEM -> KCENON_WITH_THREAD_SYSTEM
89#ifndef USE_THREAD_SYSTEM
90 #if KCENON_WITH_THREAD_SYSTEM
91 #define USE_THREAD_SYSTEM 1
92 #endif
93#endif
94
95// BUILD_WITH_THREAD_SYSTEM -> KCENON_WITH_THREAD_SYSTEM
96#ifndef BUILD_WITH_THREAD_SYSTEM
97 #if KCENON_WITH_THREAD_SYSTEM
98 #define BUILD_WITH_THREAD_SYSTEM 1
99 #endif
100#endif
101
102// USE_LOGGER_SYSTEM -> KCENON_WITH_LOGGER_SYSTEM
103#ifndef USE_LOGGER_SYSTEM
104 #if KCENON_WITH_LOGGER_SYSTEM
105 #define USE_LOGGER_SYSTEM 1
106 #endif
107#endif
108
109// BUILD_WITH_LOGGER -> KCENON_WITH_LOGGER_SYSTEM
110#ifndef BUILD_WITH_LOGGER
111 #if KCENON_WITH_LOGGER_SYSTEM
112 #define BUILD_WITH_LOGGER 1
113 #endif
114#endif
115
116// USE_MONITORING_SYSTEM -> KCENON_WITH_MONITORING_SYSTEM
117#ifndef USE_MONITORING_SYSTEM
118 #if KCENON_WITH_MONITORING_SYSTEM
119 #define USE_MONITORING_SYSTEM 1
120 #endif
121#endif
122
123// BUILD_WITH_MONITORING -> KCENON_WITH_MONITORING_SYSTEM
124#ifndef BUILD_WITH_MONITORING
125 #if KCENON_WITH_MONITORING_SYSTEM
126 #define BUILD_WITH_MONITORING 1
127 #endif
128#endif
129
130// USE_CONTAINER_SYSTEM -> KCENON_WITH_CONTAINER_SYSTEM
131#ifndef USE_CONTAINER_SYSTEM
132 #if KCENON_WITH_CONTAINER_SYSTEM
133 #define USE_CONTAINER_SYSTEM 1
134 #endif
135#endif
136
137// BUILD_WITH_CONTAINER -> KCENON_WITH_CONTAINER_SYSTEM
138#ifndef BUILD_WITH_CONTAINER
139 #if KCENON_WITH_CONTAINER_SYSTEM
140 #define BUILD_WITH_CONTAINER 1
141 #endif
142#endif
143
144//------------------------------------------------------------------------------
145// WITH_*_SYSTEM aliases (CMake-generated)
146//------------------------------------------------------------------------------
147
148// These may be set by CMake's configure_module_integration macro
149#ifndef WITH_THREAD_SYSTEM
150 #if KCENON_WITH_THREAD_SYSTEM
151 #define WITH_THREAD_SYSTEM 1
152 #endif
153#endif
154
155#ifndef WITH_LOGGER_SYSTEM
156 #if KCENON_WITH_LOGGER_SYSTEM
157 #define WITH_LOGGER_SYSTEM 1
158 #endif
159#endif
160
161#ifndef WITH_MONITORING_SYSTEM
162 #if KCENON_WITH_MONITORING_SYSTEM
163 #define WITH_MONITORING_SYSTEM 1
164 #endif
165#endif
166
167#ifndef WITH_CONTAINER_SYSTEM
168 #if KCENON_WITH_CONTAINER_SYSTEM
169 #define WITH_CONTAINER_SYSTEM 1
170 #endif
171#endif
172
173#endif // KCENON_ENABLE_LEGACY_ALIASES
174
175//==============================================================================
176// Feature Summary (for debugging)
177//==============================================================================
178
185#ifdef KCENON_PRINT_FEATURE_SUMMARY
186
187#pragma message("=== KCENON Feature Detection Summary ===")
188
189// Compiler
190#if KCENON_COMPILER_MSVC
191 #pragma message("Compiler: MSVC")
192#elif KCENON_COMPILER_CLANG
193 #pragma message("Compiler: Clang")
194#elif KCENON_COMPILER_GCC
195 #pragma message("Compiler: GCC")
196#else
197 #pragma message("Compiler: Unknown")
198#endif
199
200// C++ Standard
201#if KCENON_HAS_CPP23
202 #pragma message("C++ Standard: C++23")
203#elif KCENON_HAS_CPP20
204 #pragma message("C++ Standard: C++20")
205#elif KCENON_HAS_CPP17
206 #pragma message("C++ Standard: C++17")
207#else
208 #pragma message("C++ Standard: Pre-C++17")
209#endif
210
211// Features
212#if KCENON_HAS_SOURCE_LOCATION
213 #pragma message("source_location: Available")
214#else
215 #pragma message("source_location: Unavailable (using fallback)")
216#endif
217
218#if KCENON_HAS_JTHREAD
219 #pragma message("jthread: Available")
220#else
221 #pragma message("jthread: Unavailable")
222#endif
223
224#if KCENON_HAS_FORMAT
225 #pragma message("std::format: Available")
226#else
227 #pragma message("std::format: Unavailable")
228#endif
229
230#if KCENON_HAS_CONCEPTS
231 #pragma message("Concepts: Available")
232#else
233 #pragma message("Concepts: Unavailable")
234#endif
235
236#if KCENON_HAS_RANGES
237 #pragma message("Ranges: Available")
238#else
239 #pragma message("Ranges: Unavailable")
240#endif
241
242#pragma message("=========================================")
243
244#endif // KCENON_PRINT_FEATURE_SUMMARY
245
246//==============================================================================
247// Static Assertions for Minimum Requirements
248//==============================================================================
249
250// Ensure C++20 minimum (required since v0.2.0 for concepts support)
251static_assert(KCENON_HAS_CPP20,
252 "common_system requires C++20 or later. "
253 "Please compile with -std=c++20 or higher. "
254 "Minimum compilers: GCC 11+, Clang 14+, MSVC 2022+, Apple Clang 14+.");
Compiler and standard library feature detection.
Core KCENON_* macro definitions for feature detection.
#define KCENON_HAS_CPP20
System module integration flags.