TestFramework.h 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. // Jolt Physics Library (https://github.com/jrouwe/JoltPhysics)
  2. // SPDX-FileCopyrightText: 2021 Jorrit Rouwe
  3. // SPDX-License-Identifier: MIT
  4. #pragma once
  5. #include <Jolt/Jolt.h>
  6. // Disable common warnings
  7. JPH_SUPPRESS_WARNINGS
  8. JPH_CLANG_SUPPRESS_WARNING("-Wheader-hygiene")
  9. #ifdef JPH_DOUBLE_PRECISION
  10. JPH_CLANG_SUPPRESS_WARNING("-Wdouble-promotion")
  11. #endif // JPH_DOUBLE_PRECISION
  12. JPH_CLANG_SUPPRESS_WARNING("-Wswitch-enum")
  13. JPH_CLANG_SUPPRESS_WARNING("-Wswitch")
  14. JPH_MSVC_SUPPRESS_WARNING(4061) // enumerator 'X' in switch of enum 'X' is not explicitly handled by a case label
  15. JPH_MSVC_SUPPRESS_WARNING(4062) // enumerator 'X' in switch of enum 'X' is not handled
  16. #ifdef JPH_PLATFORM_WINDOWS
  17. // Targeting Windows 10 and above
  18. #define WINVER 0x0A00
  19. #define _WIN32_WINNT 0x0A00
  20. JPH_SUPPRESS_WARNING_PUSH
  21. JPH_MSVC_SUPPRESS_WARNING(5039) // winbase.h(13179): warning C5039: 'TpSetCallbackCleanupGroup': pointer or reference to potentially throwing function passed to 'extern "C"' function under -EHc. Undefined behavior may occur if this function throws an exception.
  22. JPH_MSVC_SUPPRESS_WARNING(5204) // implements.h(65): warning C5204: 'Microsoft::WRL::CloakedIid<IMarshal>': class has virtual functions, but its trivial destructor is not virtual; instances of objects derived from this class may not be destructed correctly
  23. JPH_MSVC_SUPPRESS_WARNING(4265) // implements.h(1449): warning C4265: 'Microsoft::WRL::FtmBase': class has virtual functions, but its non-trivial destructor is not virtual; instances of this class may not be destructed correctly
  24. JPH_MSVC_SUPPRESS_WARNING(5220) // implements.h(1648): warning C5220: 'Microsoft::WRL::Details::RuntimeClassImpl<Microsoft::WRL::RuntimeClassFlags<2>,true,false,true,IWeakReference>::refcount_': a non-static data member with a volatile qualified type no longer implies
  25. JPH_MSVC_SUPPRESS_WARNING(4986) // implements.h(2343): warning C4986: 'Microsoft::WRL::Details::RuntimeClassImpl<RuntimeClassFlagsT,true,true,false,I0,TInterfaces...>::GetWeakReference': exception specification does not match previous declaration
  26. JPH_MSVC2026_PLUS_SUPPRESS_WARNING(4865) // wingdi.h(2806,1): '<unnamed-enum-DISPLAYCONFIG_OUTPUT_TECHNOLOGY_OTHER>': the underlying type will change from 'int' to '__int64' when '/Zc:enumTypes' is specified on the command line
  27. #define WIN32_LEAN_AND_MEAN
  28. #define Ellipse DrawEllipse // Windows.h defines a name that we would like to use
  29. #include <windows.h>
  30. #undef Ellipse
  31. #undef min // We'd like to use std::min and max instead of the ones defined in windows.h
  32. #undef max
  33. #undef DrawText // We don't want this to map to DrawTextW
  34. #include <d3d12.h>
  35. #include <dxgi1_6.h>
  36. #include <wrl.h> // for ComPtr
  37. JPH_SUPPRESS_WARNING_POP
  38. using Microsoft::WRL::ComPtr;
  39. #elif defined(JPH_PLATFORM_LINUX)
  40. #define Font X11Font
  41. #include <X11/Xlib.h>
  42. #include <X11/Xutil.h>
  43. #include <X11/XKBlib.h>
  44. #undef Font
  45. #undef Success
  46. #undef None
  47. #undef Convex
  48. #endif
  49. using namespace JPH;
  50. using namespace JPH::literals;
  51. using namespace std;