export.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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. #define PK_EXPORT __declspec(dllexport)
  5. #ifdef PK_USE_DYLIB
  6. #define PK_SUPPORT_DYLIB 1
  7. #else
  8. #define PK_SUPPORT_DYLIB 0
  9. #endif
  10. #define PK_SYS_PLATFORM "win32"
  11. #elif __EMSCRIPTEN__
  12. #include <emscripten.h>
  13. #define PK_EXPORT EMSCRIPTEN_KEEPALIVE
  14. #define PK_SUPPORT_DYLIB 0
  15. #define PK_SYS_PLATFORM "emscripten"
  16. #elif __APPLE__
  17. #include <TargetConditionals.h>
  18. #if TARGET_IPHONE_SIMULATOR
  19. // iOS, tvOS, or watchOS Simulator
  20. #define PK_SYS_PLATFORM "ios"
  21. #define PK_SUPPORT_DYLIB 4
  22. #elif TARGET_OS_IPHONE
  23. // iOS, tvOS, or watchOS device
  24. #define PK_SYS_PLATFORM "ios"
  25. #define PK_SUPPORT_DYLIB 4
  26. #elif TARGET_OS_MAC
  27. #define PK_SYS_PLATFORM "darwin"
  28. #ifdef PK_USE_DYLIB
  29. #include <dlfcn.h>
  30. #define PK_SUPPORT_DYLIB 2
  31. #else
  32. #define PK_SUPPORT_DYLIB 0
  33. #endif
  34. #else
  35. # error "Unknown Apple platform"
  36. #endif
  37. #define PK_EXPORT __attribute__((visibility("default")))
  38. #elif __ANDROID__
  39. #ifdef PK_USE_DYLIB
  40. #include <dlfcn.h>
  41. #define PK_SUPPORT_DYLIB 3
  42. #else
  43. #define PK_SUPPORT_DYLIB 0
  44. #endif
  45. #define PK_EXPORT __attribute__((visibility("default")))
  46. #define PK_SYS_PLATFORM "android"
  47. #elif __linux__
  48. #ifdef PK_USE_DYLIB
  49. #include <dlfcn.h>
  50. #define PK_SUPPORT_DYLIB 2
  51. #else
  52. #define PK_SUPPORT_DYLIB 0
  53. #endif
  54. #define PK_EXPORT __attribute__((visibility("default")))
  55. #define PK_SYS_PLATFORM "linux"
  56. #else
  57. #define PK_EXPORT
  58. #define PK_SUPPORT_DYLIB 0
  59. #define PK_SYS_PLATFORM "unknown"
  60. #endif