diff --git a/SConstruct b/SConstruct index e1f56514b..4eba7488b 100644 --- a/SConstruct +++ b/SConstruct @@ -1023,6 +1023,9 @@ print('INFO: Found Boost version {0}'.format(env['BOOST_LIB_VERSION'])) if not env['BOOST_LIB_VERSION']: config_error("Boost could not be found. Install Boost headers or set" " 'boost_inc_dir' to point to the boost headers.") +# demangle is availble in Boost 1.55 or newer +env['has_demangle'] = conf.CheckDeclaration("boost::core::demangle", + '#include ', 'C++') import SCons.Conftest, SCons.SConf context = SCons.SConf.CheckContext(conf) @@ -1480,6 +1483,7 @@ cdefine('CT_USE_LAPACK', 'use_lapack') cdefine('CT_USE_SYSTEM_EIGEN', 'system_eigen') cdefine('CT_USE_SYSTEM_FMT', 'system_fmt') cdefine('CT_USE_SYSTEM_YAMLCPP', 'system_yamlcpp') +cdefine('CT_USE_DEMANGLE', 'has_demangle') config_h_build = env.Command('build/src/config.h.build', 'include/cantera/base/config.h.in', diff --git a/include/cantera/base/config.h.in b/include/cantera/base/config.h.in index 75cf23227..799044073 100644 --- a/include/cantera/base/config.h.in +++ b/include/cantera/base/config.h.in @@ -45,6 +45,7 @@ typedef int ftnlen; // Fortran hidden string length type %(CT_USE_SYSTEM_EIGEN)s %(CT_USE_SYSTEM_FMT)s %(CT_USE_SYSTEM_YAMLCPP)s +%(CT_USE_DEMANGLE)s //--------- operating system -------------------------------------- diff --git a/src/base/AnyMap.cpp b/src/base/AnyMap.cpp index 0c1325979..5bf4f4018 100644 --- a/src/base/AnyMap.cpp +++ b/src/base/AnyMap.cpp @@ -6,6 +6,9 @@ #include "cantera/base/AnyMap.h" #include "cantera/base/yaml.h" #include "cantera/base/stringUtils.h" +#ifdef CT_USE_DEMANGLE + #include +#endif #include @@ -363,7 +366,11 @@ std::string AnyValue::demangle(const std::type_info& type) const if (s_typenames.find(type.name()) != s_typenames.end()) { return s_typenames[type.name()]; } else { - return type.name(); + #ifdef CT_USE_DEMANGLE + return boost::core::demangle(type.name()); + #else + return type.name(); + #endif } }