TestFramework.h 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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. #define WIN32_LEAN_AND_MEAN
  27. #define Ellipse DrawEllipse // Windows.h defines a name that we would like to use
  28. #include <windows.h>
  29. #undef Ellipse
  30. #undef min // We'd like to use std::min and max instead of the ones defined in windows.h
  31. #undef max
  32. #undef DrawText // We don't want this to map to DrawTextW
  33. #include <d3d12.h>
  34. #include <dxgi1_6.h>
  35. #include <wrl.h> // for ComPtr
  36. JPH_SUPPRESS_WARNING_POP
  37. using Microsoft::WRL::ComPtr;
  38. #elif defined(JPH_PLATFORM_LINUX)
  39. #define Font X11Font
  40. #include <X11/Xlib.h>
  41. #include <X11/Xutil.h>
  42. #include <X11/XKBlib.h>
  43. #undef Font
  44. #undef Success
  45. #undef None
  46. #undef Convex
  47. #endif
  48. using namespace JPH;
  49. using namespace JPH::literals;
  50. using namespace std;