-
-
Save while0pass/570892c26fa126cb5544378054c80ecc to your computer and use it in GitHub Desktop.
Detect reliably Mac OS X, iOS, Linux, Windows in C preprocessor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifdef _WIN64 | |
//define something for Windows (64-bit) | |
#elif _WIN32 | |
//define something for Windows (32-bit) | |
#elif __APPLE__ | |
#include "TargetConditionals.h" | |
#if TARGET_OS_IPHONE && TARGET_IPHONE_SIMULATOR | |
// define something for simulator | |
#elif TARGET_OS_IPHONE | |
// define something for iphone | |
#else | |
#define TARGET_OS_OSX 1 | |
// define something for OSX | |
#endif | |
#elif __linux | |
// linux | |
#elif __unix // all unices not caught above | |
// Unix | |
#elif __posix | |
// POSIX | |
#endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment