diff --git a/TracyC.h b/TracyC.h index d4e34053..786e72af 100644 --- a/TracyC.h +++ b/TracyC.h @@ -4,6 +4,8 @@ #include #include +#include "client/TracyCallstack.h" + #ifdef __cplusplus extern "C" { #endif diff --git a/client/TracyCallstack.h b/client/TracyCallstack.h new file mode 100644 index 00000000..8b84e7f3 --- /dev/null +++ b/client/TracyCallstack.h @@ -0,0 +1,16 @@ +#ifndef __TRACYCALLSTACK_H__ +#define __TRACYCALLSTACK_H__ + +#if defined _WIN32 || defined __CYGWIN__ +# define TRACY_HAS_CALLSTACK 1 +#elif defined __ANDROID__ +# define TRACY_HAS_CALLSTACK 2 +#elif defined __linux +# if defined _GNU_SOURCE && defined __GLIBC__ +# define TRACY_HAS_CALLSTACK 3 +# else +# define TRACY_HAS_CALLSTACK 2 +# endif +#endif + +#endif diff --git a/client/TracyCallstack.hpp b/client/TracyCallstack.hpp index 8b61c5ec..b4b2c017 100644 --- a/client/TracyCallstack.hpp +++ b/client/TracyCallstack.hpp @@ -1,24 +1,18 @@ #ifndef __TRACYCALLSTACK_HPP__ #define __TRACYCALLSTACK_HPP__ -#if defined _WIN32 || defined __CYGWIN__ -# define TRACY_HAS_CALLSTACK 1 +#include "TracyCallstack.h" + +#if TRACY_HAS_CALLSTACK == 1 extern "C" { typedef unsigned long (__stdcall *t_RtlWalkFrameChain)( void**, unsigned long, unsigned long ); extern t_RtlWalkFrameChain RtlWalkFrameChain; } -#elif defined __ANDROID__ -# define TRACY_HAS_CALLSTACK 2 +#elif TRACY_HAS_CALLSTACK == 2 # include -#elif defined __linux -# if defined _GNU_SOURCE && defined __GLIBC__ -# define TRACY_HAS_CALLSTACK 3 -# include -# else -# define TRACY_HAS_CALLSTACK 2 -# include -# endif +#elif TRACY_HAS_CALLSTACK == 3 +# include #endif