geode/loader/include/Geode/platform/cplatform.h

78 lines
2.2 KiB
C
Raw Normal View History

2022-07-30 12:24:03 -04:00
#pragma once
#define GEODE_C_DLL
#define GEODE_C_API
#ifdef _MSC_VER
2022-10-30 14:59:20 -04:00
#pragma warning(disable : 4099) // type first seen as class
#pragma warning(default : 4067)
#pragma warning(disable : 4251) // dll-interface
#pragma warning(disable : 4244) // narrowing conversion
2022-07-30 12:24:03 -04:00
#endif
// Set dllexport/dllimport to geode classes & functions
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
2022-10-30 14:59:20 -04:00
#define GEODE_WINDOWS(...) __VA_ARGS__
#define GEODE_IS_WINDOWS
#define GEODE_IS_DESKTOP
#define GEODE_PLATFORM_NAME "Windows"
#define GEODE_CALL __stdcall
#define GEODE_PLATFORM_EXTENSION ".dll"
#define GEODE_PLATFORM_SHORT_IDENTIFIER "win"
#ifdef GEODE_EXPORTING
#undef GEODE_C_DLL
#define GEODE_C_DLL __declspec(dllexport)
#else
#undef GEODE_C_DLL
#define GEODE_C_DLL __declspec(dllimport)
#endif
#undef GEODE_C_API
#define GEODE_C_API __declspec(dllexport) __stdcall
2022-07-30 12:24:03 -04:00
#else
2022-10-30 14:59:20 -04:00
#define GEODE_WINDOWS(...)
2022-07-30 12:24:03 -04:00
#endif
#if defined(__APPLE__)
2022-10-30 14:59:20 -04:00
#include <TargetConditionals.h>
#if TARGET_OS_IPHONE
#define GEODE_MACOS(...)
#define GEODE_IOS(...) __VA_ARGS__
#define GEODE_IS_IOS
#define GEODE_IS_MOBILE
#define GEODE_PLATFORM_NAME "iOS"
#define GEODE_PLATFORM_EXTENSION ".ios.dylib"
#define GEODE_PLATFORM_SHORT_IDENTIFIER "ios"
2022-10-30 14:59:20 -04:00
#else
#define GEODE_IOS(...)
#define GEODE_MACOS(...) __VA_ARGS__
#define GEODE_IS_MACOS
#define GEODE_IS_DESKTOP
#define GEODE_PLATFORM_NAME "MacOS"
#define GEODE_PLATFORM_EXTENSION ".dylib"
#define GEODE_PLATFORM_SHORT_IDENTIFIER "mac"
2022-10-30 14:59:20 -04:00
#endif
#define GEODE_CALL
2022-07-30 12:24:03 -04:00
#else
2022-10-30 14:59:20 -04:00
#define GEODE_MACOS(...)
#define GEODE_IOS(...)
2022-07-30 12:24:03 -04:00
#endif
// Android
#if defined(__ANDROID__)
2022-10-30 14:59:20 -04:00
#define GEODE_ANDROID(...) __VA_ARGS__
#define GEODE_IS_ANDROID
#define GEODE_IS_MOBILE
#define GEODE_PLATFORM_NAME "Android"
#define GEODE_CALL
#define GEODE_PLATFORM_EXTENSION ".so"
#define GEODE_PLATFORM_SHORT_IDENTIFIER "android"
2022-07-30 12:24:03 -04:00
#else
2022-10-30 14:59:20 -04:00
#define GEODE_ANDROID(...)
2022-07-30 12:24:03 -04:00
#endif
#ifndef GEODE_PLATFORM_NAME
2022-10-30 14:59:20 -04:00
#error "Unsupported PlatformID!"
2022-07-30 12:24:03 -04:00
#endif