Line data Source code
1 1 : /** 2 : * @file arch/platform.h 3 : * 4 : * @brief Determine on what OS we are compiling 5 : * 6 : * This header performs some macro checks set by common compilers to determine 7 : * if we are compiling towards a POSIX target or a Windows target. 8 : * In case of POSIX, it also tries to set some macros used to understand what 9 : * is the POSIX version on which we are running. 10 : * 11 : * SPDX-FileCopyrightText: 2008-2021 HPDCS Group <rootsim@googlegroups.com> 12 : * SPDX-License-Identifier: GPL-3.0-only 13 : */ 14 : #pragma once 15 : 16 : #if defined(_WIN32) 17 : #define __WINDOWS 18 : #elif defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__)) 19 : #define __POSIX 20 : 21 : #if defined(__linux__) 22 : #define __LINUX 23 : #endif 24 : 25 : #if defined(__APPLE__) && defined(__MACH__) 26 : #define __MACOS 27 : #endif 28 : 29 : #else 30 : #error Unsupported operating system 31 : #endif