From 3451d36de1464419890c23d7c838f01be070495d Mon Sep 17 00:00:00 2001 From: sean Date: Sun, 5 Nov 2023 14:53:36 +0100 Subject: [PATCH] Fix: Support 'old' GCC ABI The old ABI didn't support custom allocators for standard containers. So we'll disable the use of polymorphic allocators in that case. --- include/fastgltf/types.hpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/include/fastgltf/types.hpp b/include/fastgltf/types.hpp index 18f88b868..30353545d 100644 --- a/include/fastgltf/types.hpp +++ b/include/fastgltf/types.hpp @@ -39,6 +39,13 @@ // Utils header already includes some headers, which we'll try and avoid including twice. #include "util.hpp" +#if defined(_GLIBCXX_USE_CXX11_ABI) && !_GLIBCXX_USE_CXX11_ABI +// polymorphic allocators are only supported with the 'new' GCC ABI. +// Older compilers (older than GCC 5.1) default to the old ABI and sometimes the old ABI is +// explicitly selected on even the newest compilers, which we want to support. +#define FASTGLTF_DISABLE_CUSTOM_MEMORY_POOL 1 +#endif + #ifndef FASTGLTF_DISABLE_CUSTOM_MEMORY_POOL #define FASTGLTF_DISABLE_CUSTOM_MEMORY_POOL 0 #endif