diff options
author | Balazs Kovacsics <kovab93@gmail.com> | 2022-02-09 20:25:04 +0300 |
---|---|---|
committer | Balazs Kovacsics <kovab93@gmail.com> | 2022-02-09 20:25:04 +0300 |
commit | 10b3d7ad82c766ae0fae6e8fa26f674f4ec7fc39 (patch) | |
tree | 878384da63e12e51aae08697dbc1ab092c692e31 /common | |
parent | 92b182d47e51e59064778819db08aba0d7017c1e (diff) |
Fix compiling TracyClient.cpp on UWP with undefined TRACY_ENABLE
Diffstat (limited to 'common')
-rw-r--r-- | common/TracySystem.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/common/TracySystem.cpp b/common/TracySystem.cpp index 38ccc6e7..63b88691 100644 --- a/common/TracySystem.cpp +++ b/common/TracySystem.cpp @@ -10,6 +10,11 @@ # endif # include <windows.h> # include <malloc.h> + +# if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) && \ + !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) +# define TRACY_ON_UWP +# endif #else # include <pthread.h> # include <string.h> @@ -127,7 +132,11 @@ void ThreadNameMsvcMagic( const THREADNAME_INFO& info ) TRACY_API void SetThreadName( const char* name ) { #if defined _WIN32 +# if defined TRACY_ON_UWP + static auto _SetThreadDescription = &::SetThreadDescription; +# else static auto _SetThreadDescription = (t_SetThreadDescription)GetProcAddress( GetModuleHandleA( "kernel32.dll" ), "SetThreadDescription" ); +# endif if( _SetThreadDescription ) { wchar_t buf[256]; @@ -191,7 +200,11 @@ TRACY_API const char* GetThreadName( uint32_t id ) } #else # if defined _WIN32 +# if defined TRACY_ON_UWP + static auto _GetThreadDescription = &::GetThreadDescription; +# else static auto _GetThreadDescription = (t_GetThreadDescription)GetProcAddress( GetModuleHandleA( "kernel32.dll" ), "GetThreadDescription" ); +# endif if( _GetThreadDescription ) { auto hnd = OpenThread( THREAD_QUERY_LIMITED_INFORMATION, FALSE, (DWORD)id ); |