EntryPoint.h 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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/Core/FPException.h>
  6. #if defined(JPH_PLATFORM_WINDOWS)
  7. #define ENTRY_POINT(AppName, RegisterAllocator) \
  8. \
  9. int WINAPI wWinMain(_In_ HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow) \
  10. { \
  11. RegisterAllocator(); \
  12. \
  13. JPH_PROFILE_START("Main"); \
  14. \
  15. FPExceptionsEnable enable_exceptions; \
  16. JPH_UNUSED(enable_exceptions); \
  17. \
  18. { \
  19. AppName app(GetCommandLineA()); \
  20. app.Run(); \
  21. } \
  22. \
  23. JPH_PROFILE_END(); \
  24. \
  25. return 0; \
  26. } \
  27. \
  28. int __cdecl main(int inArgC, char **inArgV) \
  29. { \
  30. RegisterAllocator(); \
  31. \
  32. JPH_PROFILE_START("Main"); \
  33. \
  34. FPExceptionsEnable enable_exceptions; \
  35. JPH_UNUSED(enable_exceptions); \
  36. \
  37. { \
  38. AppName app(Application::sCreateCommandLine(inArgC, inArgV)); \
  39. app.Run(); \
  40. } \
  41. \
  42. JPH_PROFILE_END(); \
  43. \
  44. return 0; \
  45. }
  46. #else
  47. #define ENTRY_POINT(AppName, RegisterAllocator) \
  48. \
  49. int main(int inArgC, char **inArgV) \
  50. { \
  51. RegisterAllocator(); \
  52. \
  53. JPH_PROFILE_START("Main"); \
  54. \
  55. FPExceptionsEnable enable_exceptions; \
  56. JPH_UNUSED(enable_exceptions); \
  57. \
  58. { \
  59. AppName app(Application::sCreateCommandLine(inArgC, inArgV)); \
  60. app.Run(); \
  61. } \
  62. \
  63. JPH_PROFILE_END(); \
  64. \
  65. return 0; \
  66. }
  67. #endif