Files
pip/libs/main/piplatform.h
2026-03-12 14:46:57 +03:00

210 lines
5.9 KiB
C
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/*! \file piplatform.h
* \ingroup Core
* \~\brief
* \~english Public platform and compiler detection macros
* \~russian Публичные макросы определения платформы и компилятора
*
* \~\details
* \~english
* This header defines portability macros that can be used in public PIP-aware
* code for platform, compiler and architecture checks.
* \~russian
* Этот заголовок определяет макросы переносимости, которые можно использовать
* в публичном PIP-коде для проверки платформы, компилятора и архитектуры.
*/
/*
PIP - Platform Independent Primitives
Platform and compiler macros
Ivan Pelipenko peri4ko@yandex.ru, Andrey Bychkov work.a.b@yandex.ru
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef PIPLATFORM_H
#define PIPLATFORM_H
#include <pip_export.h>
#ifdef DOXYGEN
//! \~\ingroup Core
//! \~\brief
//! \~english Defined for Windows targets.
//! \~russian Определяется для целевых сборок Windows.
# define WINDOWS
//! \~\ingroup Core
//! \~\brief
//! \~english Defined for Linux targets.
//! \~russian Определяется для целевых сборок Linux.
# define LINUX
//! \~\ingroup Core
//! \~\brief
//! \~english Defined for macOS targets.
//! \~russian Определяется для целевых сборок macOS.
# define MAC_OS
//! \~\ingroup Core
//! \~\brief
//! \~english Defined for Android targets.
//! \~russian Определяется для целевых сборок Android.
# define ANDROID
//! \~\ingroup Core
//! \~\brief
//! \~english Defined for QNX targets.
//! \~russian Определяется для целевых сборок QNX.
# define QNX
//! \~\ingroup Core
//! \~\brief
//! \~english Defined for FreeBSD targets.
//! \~russian Определяется для целевых сборок FreeBSD.
# define FREE_BSD
//! \~\ingroup Core
//! \~\brief
//! \~english Defined for reduced embedded PIP builds.
//! \~russian Определяется для облегченных встраиваемых сборок PIP.
# define MICRO_PIP
//! \~\ingroup Core
//! \~\brief
//! \~english Defined when the target architecture is 32-bit.
//! \~russian Определяется, когда целевая архитектура 32-битная.
# define ARCH_BITS_32
//! \~\ingroup Core
//! \~\brief
//! \~english Defined when the target architecture is 64-bit.
//! \~russian Определяется, когда целевая архитектура 64-битная.
# define ARCH_BITS_64
//! \~\ingroup Core
//! \~\brief
//! \~english Defined for GCC-compatible compilers.
//! \~russian Определяется для GCC-совместимых компиляторов.
# define CC_GCC
//! \~\ingroup Core
//! \~\brief
//! \~english Encoded GCC major and minor version for \a CC_GCC builds.
//! \~russian Содержит закодированную основную и дополнительную версию GCC для сборок с \a CC_GCC.
# define CC_GCC_VERSION
//! \~\ingroup Core
//! \~\brief
//! \~english Defined for Microsoft Visual C++.
//! \~russian Определяется для Microsoft Visual C++.
# define CC_VC
//! \~\ingroup Core
//! \~\brief
//! \~english Defined when no dedicated compiler macro above matched.
//! \~russian Определяется, когда ни один специализированный макрос компилятора выше не подошел.
# define CC_OTHER
//! \~\ingroup Core
//! \~\brief
//! \~english Defined when POSIX signal APIs are expected to be available.
//! \~russian Определяется, когда ожидается доступность POSIX API сигналов.
# define POSIX_SIGNALS
#endif
#if defined(WIN64) || defined(_WIN64) || defined(__WIN64__)
# define WINDOWS
# define ARCH_BITS_64
#else
# if defined(WIN32) || defined(_WIN32) || defined(__WIN32__)
# define WINDOWS
# define ARCH_BITS_32
# endif
#endif
#if defined(__QNX__) || defined(__QNXNTO__)
# define QNX
# ifdef Q_OS_BLACKBERRY
# define BLACKBERRY
# endif
#endif
#ifdef __FreeBSD__
# define FREE_BSD
#endif
#if defined(__APPLE__) || defined(__MACH__)
# define MAC_OS
#endif
#if defined(__ANDROID__) || defined(_ANDROID_) || defined(ANDROID)
# ifndef ANDROID
# define ANDROID
# endif
#endif
#ifdef PIP_FREERTOS
# define FREERTOS
#endif
#if defined(FREERTOS) || defined(PLATFORMIO)
# define MICRO_PIP
#endif
#ifndef WINDOWS
# ifndef QNX
# ifndef FREE_BSD
# ifndef MAC_OS
# ifndef ANDROID
# ifndef BLACKBERRY
# ifndef MICRO_PIP
# define LINUX
# endif
# endif
# endif
# endif
# endif
# endif
#endif
#ifndef WINDOWS
# if defined(__LP64__) || defined(_LP64_) || defined(LP64)
# define ARCH_BITS_64
# else
# define ARCH_BITS_32
# endif
#endif
#ifdef __GNUC__
# define CC_GCC
# define CC_GCC_VERSION ((__GNUC__ << 8) | __GNUC_MINOR__)
#elif defined(_MSC_VER)
# define CC_VC
#else
# define CC_OTHER
#endif
#ifdef __AVR__
# define CC_AVR_GCC
#endif
#ifdef WINDOWS
# ifdef CC_GCC
# define typeof __typeof
# endif
#else
# define typeof __typeof__
#endif
#if defined(LINUX) || defined(MAC_OS) || defined(ANDROID)
# define POSIX_SIGNALS
#endif
#endif // PIPLATFORM_H