Open C++ Libraries.org develop
Loading...
Searching...
No Matches
config.hpp
1// SPDX-License-Identifier: BSL-1.0
2// Copyright 2025-2026, Amlal El Mahrouss (amlal@nekernel.org)
3// Distributed under the Boost Software License, Version 1.0. (See accompanying
4// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5// Official repository: https://github.com/open-cpp-libraries/core
6
7#ifndef OCL_CORE_CONFIG
8#define OCL_CORE_CONFIG
9
10#ifndef OCL_FREESTANDING
11#include <boost/config.hpp>
12#include <boost/core/addressof.hpp>
13#include <boost/core/nvp.hpp>
14#include <boost/core/demangle.hpp>
15#include <boost/core/null_deleter.hpp>
16#include <boost/container/allocator.hpp>
17#include <boost/assert/source_location.hpp>
18#include <boost/assert.hpp>
19#include <boost/utility/string_view.hpp>
20#include <boost/config.hpp>
21#endif
22
23#ifndef __attribute_packed__
24#define __attribute_packed__ __attribute__((packed))
25#endif
26
27#ifndef __ocl_packed__
28#define __ocl_packed__ __attribute_packed__
29#endif
30
31#include <ocl/compat/core/ant_os.hpp>
32#include <ocl/compat/core/ne_system.hpp>
33#include <ocl/compat/core/win_nt.hpp>
34#include <ocl/compat/core/posix.hpp>
35
36#define OCL_DEPRECATED() [[deprecated]]
37#define OCL_DEPRECATED_MSG(MSG) [[deprecated(MSG)]]
38
39#if 202002L > __cplusplus
40#error !! OCL.Core works with C++20 and greater !!
41#endif
42
43#ifdef __cplusplus
44#define OCL_DECL extern "C"
46#ifdef __GNUC__
47#define OCL_EXPORT_DECL OCL_DECL __attribute__((visibility("default")))
48#else
49#define OCL_EXPORT_DECL OCL_DECL declspec(dllexport)
50#endif
51#else
52#define OCL_DECL
53#ifdef __GNUC__
54#define OCL_EXPORT_DECL
55#else
56#define OCL_EXPORT_DECL OCL_DECL declspec(dllimport)
57#endif
58#endif
59
60#ifdef _WIN32
61#define OCL_USE_CRLF_ENDINGS 1
62#define OCL_WINDOWS 1
63#endif
64
65#if OCL_WANTS_PRAGMA_ONCE
66#define OCL_HAS_PRAGMA_ONCE 1
67#endif
68
69#define OCL_CORE_MODULE (202606)
70
71#define OCL_PLACEHOLDER_PREFIX "${"
72#define OCL_PLACEHOLDER_SUFFIX "}"
73
74namespace ocl
75{
76
77 namespace detail
78 {
79
80 inline void throw_runtime_error(::boost::source_location const& loc = BOOST_CURRENT_LOCATION)
81 {
82 ::boost::throw_exception(std::runtime_error(""), loc);
83 }
84
85 } // namespace detail
86
87 namespace placeholders
88 {
89
90 inline std::string find_and_replace(const std::string& input,
91 const std::string& new_val,
92 const std::string& name)
93 {
94 if (input.find(OCL_PLACEHOLDER_PREFIX + name + OCL_PLACEHOLDER_SUFFIX) == std::string::npos)
95 return {};
96
97 std::string replacement = input;
98 replacement.replace(input.find(OCL_PLACEHOLDER_PREFIX + name + OCL_PLACEHOLDER_SUFFIX),
99 std::string(OCL_PLACEHOLDER_PREFIX + name + OCL_PLACEHOLDER_SUFFIX).size(),
100 new_val);
101
102 return replacement;
103 }
104
105 } // namespace placeholders
106
107} // namespace ocl
108
109#endif
Memory allocator for OCL support.
Definition allocator_fwd.hpp:16