|
|
@@ -1,34 +1,44 @@
|
|
|
#pragma once
|
|
|
|
|
|
+inline const char* kPlatformStrings[] = {
|
|
|
+ "win32", // 0
|
|
|
+ "emscripten", // 1
|
|
|
+ "ios", // 2
|
|
|
+ "darwin", // 3
|
|
|
+ "android", // 4
|
|
|
+ "linux", // 5
|
|
|
+ "unknown" // 6
|
|
|
+};
|
|
|
+
|
|
|
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__)
|
|
|
//define something for Windows (32-bit and 64-bit, this part is common)
|
|
|
#define PK_EXPORT __declspec(dllexport)
|
|
|
- #define PK_SYS_PLATFORM "win32"
|
|
|
+ #define PK_SYS_PLATFORM 0
|
|
|
#elif __EMSCRIPTEN__
|
|
|
#include <emscripten.h>
|
|
|
#define PK_EXPORT EMSCRIPTEN_KEEPALIVE
|
|
|
- #define PK_SYS_PLATFORM "emscripten"
|
|
|
+ #define PK_SYS_PLATFORM 1
|
|
|
#elif __APPLE__
|
|
|
#include <TargetConditionals.h>
|
|
|
#if TARGET_IPHONE_SIMULATOR
|
|
|
// iOS, tvOS, or watchOS Simulator
|
|
|
- #define PK_SYS_PLATFORM "ios"
|
|
|
+ #define PK_SYS_PLATFORM 2
|
|
|
#elif TARGET_OS_IPHONE
|
|
|
// iOS, tvOS, or watchOS device
|
|
|
- #define PK_SYS_PLATFORM "ios"
|
|
|
+ #define PK_SYS_PLATFORM 2
|
|
|
#elif TARGET_OS_MAC
|
|
|
- #define PK_SYS_PLATFORM "darwin"
|
|
|
+ #define PK_SYS_PLATFORM 3
|
|
|
#else
|
|
|
# error "Unknown Apple platform"
|
|
|
#endif
|
|
|
#define PK_EXPORT __attribute__((visibility("default")))
|
|
|
#elif __ANDROID__
|
|
|
#define PK_EXPORT __attribute__((visibility("default")))
|
|
|
- #define PK_SYS_PLATFORM "android"
|
|
|
+ #define PK_SYS_PLATFORM 4
|
|
|
#elif __linux__
|
|
|
#define PK_EXPORT __attribute__((visibility("default")))
|
|
|
- #define PK_SYS_PLATFORM "linux"
|
|
|
+ #define PK_SYS_PLATFORM 5
|
|
|
#else
|
|
|
#define PK_EXPORT
|
|
|
- #define PK_SYS_PLATFORM "unknown"
|
|
|
+ #define PK_SYS_PLATFORM 6
|
|
|
#endif
|