export.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #pragma once
  2. #if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__)
  3. //define something for Windows (32-bit and 64-bit, this part is common)
  4. #ifndef WIN32_LEAN_AND_MEAN
  5. #define WIN32_LEAN_AND_MEAN
  6. #endif
  7. #ifndef NOMINMAX
  8. #define NOMINMAX
  9. #endif
  10. #include <Windows.h>
  11. #define PK_EXPORT __declspec(dllexport)
  12. #define PK_SUPPORT_DYLIB 1
  13. #define PK_SYS_PLATFORM "win32"
  14. #elif __EMSCRIPTEN__
  15. #include <emscripten.h>
  16. #define PK_EXPORT EMSCRIPTEN_KEEPALIVE
  17. #define PK_SUPPORT_DYLIB 0
  18. #define PK_SYS_PLATFORM "emscripten"
  19. #elif __APPLE__
  20. #include <TargetConditionals.h>
  21. #if TARGET_IPHONE_SIMULATOR
  22. // iOS, tvOS, or watchOS Simulator
  23. #define PK_SYS_PLATFORM "ios"
  24. #define PK_SUPPORT_DYLIB 4
  25. #elif TARGET_OS_IPHONE
  26. // iOS, tvOS, or watchOS device
  27. #define PK_SYS_PLATFORM "ios"
  28. #define PK_SUPPORT_DYLIB 4
  29. #elif TARGET_OS_MAC
  30. #define PK_SYS_PLATFORM "darwin"
  31. #include <dlfcn.h>
  32. #define PK_SUPPORT_DYLIB 2
  33. #else
  34. # error "Unknown Apple platform"
  35. #endif
  36. #define PK_EXPORT __attribute__((visibility("default")))
  37. #elif __ANDROID__
  38. #include <dlfcn.h>
  39. #define PK_SUPPORT_DYLIB 3
  40. #define PK_EXPORT __attribute__((visibility("default")))
  41. #define PK_SYS_PLATFORM "android"
  42. #elif __linux__
  43. #include <dlfcn.h>
  44. #define PK_SUPPORT_DYLIB 2
  45. #define PK_EXPORT __attribute__((visibility("default")))
  46. #define PK_SYS_PLATFORM "linux"
  47. #else
  48. #define PK_EXPORT
  49. #define PK_SUPPORT_DYLIB 0
  50. #define PK_SYS_PLATFORM "unknown"
  51. #endif