SRSDK  0.10.39
Loading...
Searching...
No Matches
defines.h
Go to the documentation of this file.
1#pragma once
2
3#if defined(_WIN32) || defined(_WIN64)
4# define LEIA_OS_WINDOWS
5#elif defined(__ANDROID__)
6# define LEIA_OS_ANDROID
7#else
8# error "Unsupported platform"
9#endif
10
11#if defined(_MSC_VER)
12# define LEIA_COMPILER_MSVC
13#elif defined(__clang__)
14# define LEIA_COMPILER_CLANG
15#else
16# error "Unsupported compiler"
17#endif
18
19#if defined(LEIA_OS_WINDOWS)
20# if defined(LEIA_COMPILER_MSVC)
21# define LEIA_EXPORT __declspec(dllexport)
22# define LEIA_IMPORT __declspec(dllimport)
23# define LEIA_HIDDEN
24# else
25# define LEIA_EXPORT __attribute__((dllexport))
26# define LEIA_IMPORT __attribute__((dllimport))
27# define LEIA_HIDDEN
28# endif
29#else
30# define LEIA_EXPORT __attribute__((visibility("default")))
31# define LEIA_IMPORT
32# define LEIA_HIDDEN __attribute__((visibility("hidden")))
33#endif
34
35#if defined(LEIA_OS_ANDROID)
36# define LEIA_CLASS_EXPORT LEIA_EXPORT
37# define LEIA_CLASS_IMPORT LEIA_IMPORT
38#else
39# define LEIA_CLASS_EXPORT
40# define LEIA_CLASS_IMPORT
41#endif
42
43#if defined(LEIA_COMPILER_MSVC)
44# define LEIA_DEPRECATED __declspec(deprecated)
45#elif defined(LEIA_COMPILER_CLANG)
46# define LEIA_DEPRECATED __attribute__((__deprecated__))
47#else
48# define LEIA_DEPRECATED
49#endif
50
51#if defined(LEIA_COMPILER_MSVC)
52# define LEIA_FORCE_INLINE __forceinline
53#elif defined(LEIA_COMPILER_CLANG)
54# define LEIA_FORCE_INLINE inline __attribute__((always_inline))
55#else
56# define LEIA_FORCE_INLINE inline
57#endif
58
59#if !defined(LEIA_FUNCTION)
60# if defined(LEIA_COMPILER_CLANG)
61# define LEIA_FUNCTION __PRETTY_FUNCTION__
62# elif defined(LEIA_COMPILER_MSVC)
63# define LEIA_FUNCTION __FUNCSIG__
64# else
65# define LEIA_FUNCTION __FUNCTION__
66# endif
67#endif // !LEIA_FUNCTION
68
69#ifdef __cplusplus
70# define BEGIN_CAPI_DECL extern "C" {
71# define END_CAPI_DECL }
72#else
73# define BEGIN_CAPI_DECL
74# define END_CAPI_DECL
75#endif
76
77#if defined(__has_cpp_attribute)
78# if __has_cpp_attribute(nodiscard)
79# define LEIA_NODISCARD [[nodiscard]]
80# endif
81#endif
82#ifndef LEIA_NODISCARD
83# if defined(_MSC_VER) && _MSC_VER >= 1700
84# define LEIA_NODISCARD _Check_return_
85# else
86# define LEIA_NODISCARD __attribute__((warn_unused_result))
87# endif
88#endif
89
90#define _LEIA_STRINGIZE(x) #x
91#define LEIA_STRINGIZE(x) _LEIA_STRINGIZE(x)
92
93#if defined(__LP64__) || defined(_WIN64) || (defined(__x86_64__) && !defined(__ILP32__)) || defined(_M_X64) || defined(__ia64) || defined(_M_IA64) || \
94 defined(__aarch64__) || defined(__powerpc64__)
95# define LEIA_X64
96#else
97# define LEIA_X32
98#endif
99
105#define OWNING(ptr) ptr
106
110#define NONOWNING(ptr) ptr
111
112#define LEIA_USE_OPENGL
113
114#if defined(LEIA_X64)
115# define LEIA_USE_VULKAN // Vulkan is only supported in x64 builds
116#endif
117
118#ifdef LEIA_OS_WINDOWS
119# define LEIA_USE_DIRECTX
120// #define LEIA_USE_DIRECTX12 // Disabled until CI issues resolved
121#endif