#pragma once

/*********
 * APPLE *
 ********/

#if __APPLE__
#include <TargetConditionals.h>
#define SWITCHBOARD_APPLE 1

#if TARGET_OS_IOS
#define SWITCHBOARD_IOS 1
#define SWITCHBOARD_PLATFORM "ios"
#if TARGET_OS_SIMULATOR
// iOS, tvOS, or watchOS Simulator
#define SWITCHBOARD_IPHONE_SIMULATOR 1
#else
// iOS, tvOS, or watchOS device
#define SWITCHBOARD_IPHONE 1
#endif
#elif TARGET_OS_MACCATALYST
// Mac's Catalyst (ports iOS API into Mac, like UIKit).
#define SWITCHBOARD_MACCATALYST 1
#define SWITCHBOARD_PLATFORM "maccatalyst"
#elif TARGET_OS_OSX
#define SWITCHBOARD_MAC 1
#define SWITCHBOARD_PLATFORM "macos"
#elif TARGET_OS_WATCH
#define SWITCHBOARD_WATCHOS 1
#define SWITCHBOARD_IOS 1
#define SWITCHBOARD_PLATFORM "watchos"
#endif

// Apple-specific defines
#if defined(SWITCHBOARD_APPLE)
#if defined(__arm__) || defined(__arm64__)
#define SWITCHBOARD_ARM 1
#else
#define SWITCHBOARD_INTEL 1
#endif

#if defined(SWITCHBOARD_IOS)
#define USE_ACCELERATE
#define APPLE_DECODER_AVAILABLE
#endif
#endif

/***********
 * ANDROID *
 **********/

#elif defined(__ANDROID__)
#define SWITCHBOARD_ANDROID 1
#define SWITCHBOARD_PLATFORM "android"

// Android-specific defines
#if defined(SWITCHBOARD_ANDROID)

#if defined(__arm__) || defined(__arm64__) || defined(__aarch64__)
#define SWITCHBOARD_ARM 1
#elif __MMX__ || __SSE__ || __amd64__
#define SWITCHBOARD_INTEL 1
#endif

#define USE_NEON
#endif

/***********
 * WINDOWS *
 **********/

#elif defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__) || defined(__CYGWIN__)
#define SWITCHBOARD_WINDOWS 1
#define SWITCHBOARD_PLATFORM "windows"

// Windows-specific defines
#if defined(SWITCHBOARD_WINDOWS)
#if defined(__arm__) || defined(__aarch64__) || defined(_M_ARM) || defined(_M_ARM64)
#define SWITCHBOARD_ARM 1
#else
#define SWITCHBOARD_INTEL 1
#endif
#endif

/*********
 * LINUX *
 ********/

#elif defined(OS_LINUX) || defined(__linux__)
#define SWITCHBOARD_LINUX 1
#define SWITCHBOARD_PLATFORM "linux"

// Linux-specific defines
#if defined(SWITCHBOARD_LINUX)
#if defined(__arm__) || defined(__arm64__) || defined(__aarch64__)
#define SWITCHBOARD_ARM 1
#elif __MMX__ || __SSE__ || __amd64__
#define SWITCHBOARD_INTEL 1
#endif
#endif

/*******
 * WEB *
 ******/


#elif defined(PLATFORM_WEB) || defined(__wasm__)
#define SWITCHBOARD_WEB 1
#define SWITCHBOARD_PLATFORM "web"

/************
 * EMBEDDED *
 ***********/

#elif defined(PLATFORM_EMBEDDED)
#define SWITCHBOARD_EMBEDDED 1
#define SWITCHBOARD_PLATFORM "embedded"

/************
 * UNKNOWN *
 ***********/
#else
#error "Unsupported platform"
#endif


