22#include "config/config-features.hpp"
23#include "config/config-features.impl.hpp"
24#include "config/version.hpp"
27#include <boost/algorithm/string/join.hpp>
32#include <unordered_set>
39 return std::vector<std::string>{ptr, ptr + len};
43 return std::unordered_set<std::string>(ptr, ptr + len);
47 if (
name ==
"features") {
50 if (
name ==
"all_features") {
54 if (
name ==
"build_type") {
55 return std::string(ESPRESSO_BUILD_TYPE);
57 if (
name ==
"scafacos_methods") {
58#ifdef ESPRESSO_SCAFACOS
64 if (
name ==
"has_fast_math") {
65#if defined(__FAST_MATH__) or defined(__ASSOCIATIVE_MATH__) or \
66 defined(__RECIPROCAL_MATH__)
72 if (
name ==
"toolchain") {
73#define ESPRESSO_REGISTER_METADATA(name) \
74 flat_map[#name] = serializer(ESPRESSO_##name);
76 auto const serializer = [](std::string
const value) {
78 if (not value.empty()) {
104 auto const compiled_features =
get_feature_set(FEATURES, NUM_FEATURES);
105 std::vector<std::string> missing_features{};
106 for (
auto const &feature : features) {
107 if (not allowed.contains(feature)) {
108 return "Unknown feature '" + feature +
"'";
110 if (not compiled_features.contains(feature)) {
111 missing_features.emplace_back(feature);
114 if (not missing_features.empty()) {
115 return "Missing features " + boost::algorithm::join(missing_features,
", ");
122 if (not error_msg.empty()) {
123 throw std::runtime_error(error_msg);
#define ESPRESSO_REGISTER_METADATA(name)
Variant do_call_method(std::string const &name, VariantMap const ¶meters) override
Type to indicate no value in Variant.
std::string_view name() const
static auto get_feature_set(char const *const ptr[], std::size_t len)
void check_features(std::vector< std::string > const &features)
Throw an exception when a feature is missing or not recognized.
std::string check_features_msg(std::vector< std::string > const &features)
Generate a message when a feature is missing or not recognized.
static auto get_feature_vector(char const *const ptr[], std::size_t len)
std::vector< std::string > available_methods()
Fetch list of methods compiled in ScaFaCoS.
make_recursive_variant< ObjectRef > Variant
Possible types for parameters.
auto make_vector_of_variants(std::vector< T > const &v)
std::unordered_map< std::string, Variant > VariantMap