Monado OpenXR Runtime
xrt_config_os.h
Go to the documentation of this file.
1// Copyright 2019, Collabora, Ltd.
2// SPDX-License-Identifier: BSL-1.0
3/*!
4 * @file
5 * @brief Auto detect OS and certain features.
6 * @author Jakob Bornecrantz <jakob@collabora.com>
7 * @ingroup xrt_iface
8 */
9
10#pragma once
11
12
13/*
14 *
15 * Auto detect OS.
16 *
17 */
18
19#if defined(__ANDROID__)
20#include "xrt/xrt_config_android.h"
21#define XRT_OS_ANDROID
22#if defined(XRT_FEATURE_AHARDWARE_BUFFER)
23#define XRT_OS_ANDROID_USE_AHB
24#endif
25#define XRT_OS_LINUX
26#define XRT_OS_UNIX
27#define XRT_OS_WAS_AUTODETECTED
28#endif
29
30#if defined(__linux__) && !defined(XRT_OS_WAS_AUTODETECTED)
31#define XRT_OS_LINUX
32#define XRT_OS_UNIX
33#define XRT_OS_WAS_AUTODETECTED
34#endif
35
36#if defined(_WIN32)
37#define XRT_OS_WINDOWS
38#define XRT_OS_WAS_AUTODETECTED
39#endif
40
41#if defined(__MINGW32__)
42#define XRT_ENV_MINGW
43#endif
44
45#ifndef XRT_OS_WAS_AUTODETECTED
46#error "OS type not found during compile"
47#endif
48#undef XRT_OS_WAS_AUTODETECTED