1/**
2 * Copyright (c) 2006-2023 LOVE Development Team
3 *
4 * This software is provided 'as-is', without any express or implied
5 * warranty. In no event will the authors be held liable for any damages
6 * arising from the use of this software.
7 *
8 * Permission is granted to anyone to use this software for any purpose,
9 * including commercial applications, and to alter it and redistribute it
10 * freely, subject to the following restrictions:
11 *
12 * 1. The origin of this software must not be misrepresented; you must not
13 * claim that you wrote the original software. If you use this software
14 * in a product, an acknowledgment in the product documentation would be
15 * appreciated but is not required.
16 * 2. Altered source versions must be plainly marked as such, and must not be
17 * misrepresented as being the original software.
18 * 3. This notice may not be removed or altered from any source distribution.
19 **/
20
21#ifndef LOVE_CONFIG_H
22#define LOVE_CONFIG_H
23
24// Platform stuff.
25#if defined(WIN32) || defined(_WIN32)
26# define LOVE_WINDOWS 1
27 // If _USING_V110_SDK71_ is defined it means we are using the xp toolset.
28# if defined(_MSC_VER) && (_MSC_VER >= 1700) && !_USING_V110_SDK71_
29# include <winapifamily.h>
30# if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) && !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
31# define LOVE_WINDOWS_UWP 1
32# define LOVE_NO_MODPLUG 1
33# define LOVE_NOMPG123 1
34# endif
35# endif
36#endif
37#if defined(linux) || defined(__linux) || defined(__linux__)
38# define LOVE_LINUX 1
39#endif
40#if defined(__ANDROID__)
41# define LOVE_ANDROID 1
42#endif
43#if defined(__APPLE__)
44# include <TargetConditionals.h>
45# if TARGET_OS_IPHONE
46# define LOVE_IOS 1
47# elif TARGET_OS_MAC
48# define LOVE_MACOSX 1
49# endif
50#endif
51#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
52// I know it's not linux, but it seems most "linux-only" code is bsd-compatible
53# define LOVE_LINUX 1
54#endif
55
56// Endianness.
57#if defined(__ppc__) || defined(__ppc) || defined(__powerpc__) || defined(__powerpc)
58# define LOVE_BIG_ENDIAN 1
59#else
60# define LOVE_LITTLE_ENDIAN 1
61#endif
62
63// SSE instructions.
64#if defined(__SSE__)
65# define LOVE_SIMD_SSE
66#elif defined(_MSC_VER)
67# if defined(_M_AMD64) || defined(_M_X64)
68# define LOVE_SIMD_SSE
69# elif _M_IX86_FP
70# define LOVE_SIMD_SSE
71# endif
72#endif
73
74// NEON instructions.
75#if defined(__ARM_NEON)
76# define LOVE_SIMD_NEON
77#endif
78
79// Warnings.
80#ifndef _CRT_SECURE_NO_WARNINGS
81# define _CRT_SECURE_NO_WARNINGS
82#endif
83
84// Preferably, and ironically, this macro should go unused.
85#ifndef LOVE_UNUSED
86# define LOVE_UNUSED(x) (void)sizeof(x)
87#endif
88
89
90// Warn on unused return values
91#ifdef __GNUC__
92# define LOVE_WARN_UNUSED __attribute__((warn_unused_result))
93#elif _MSC_VER
94# define LOVE_WARN_UNUSED _Check_return_
95#else
96# define LOVE_WARN_UNUSED
97#endif
98
99#ifndef LOVE_BUILD
100# define LOVE_BUILD
101# define LOVE_BUILD_STANDALONE
102# define LOVE_BUILD_EXE
103//# define LOVE_BUILD_DLL
104#endif
105
106// DLL-stuff.
107#if defined(_MSC_VER)
108# define LOVE_EXPORT __declspec(dllexport)
109#elif defined(__GNUC__) || defined(__clang__)
110# define LOVE_EXPORT __attribute__((visibility("default")))
111#else
112# define LOVE_EXPORT
113#endif
114
115#if defined(LOVE_WINDOWS)
116#ifndef LOVE_WINDOWS_UWP
117# define LOVE_LEGENDARY_CONSOLE_IO_HACK
118#endif // LOVE_WINDOWS_UWP
119# define NOMINMAX
120#endif
121
122#if defined(LOVE_MACOSX) || defined(LOVE_IOS)
123# define LOVE_LEGENDARY_APP_ARGV_HACK
124#endif
125
126#if defined(LOVE_ANDROID) || defined(LOVE_IOS)
127# define LOVE_LEGENDARY_ACCELEROMETER_AS_JOYSTICK_HACK
128#endif
129
130// Autotools config.h
131#ifdef HAVE_CONFIG_H
132# include <../config.h>
133# undef VERSION
134# ifdef WORDS_BIGENDIAN
135# undef LOVE_LITTLE_ENDIAN
136# define LOVE_BIG_ENDIAN 1
137# else
138# undef LOVE_BIG_ENDIAN
139# define LOVE_LITTLE_ENDIAN 1
140# endif
141#else
142# define LOVE_ENABLE_LOVE
143# define LOVE_ENABLE_AUDIO
144# define LOVE_ENABLE_DATA
145# define LOVE_ENABLE_EVENT
146# define LOVE_ENABLE_FILESYSTEM
147# define LOVE_ENABLE_FONT
148# define LOVE_ENABLE_GRAPHICS
149# define LOVE_ENABLE_IMAGE
150# define LOVE_ENABLE_JOYSTICK
151# define LOVE_ENABLE_KEYBOARD
152# define LOVE_ENABLE_MATH
153# define LOVE_ENABLE_MOUSE
154# define LOVE_ENABLE_PHYSICS
155# define LOVE_ENABLE_SOUND
156# define LOVE_ENABLE_SYSTEM
157# define LOVE_ENABLE_THREAD
158# define LOVE_ENABLE_TIMER
159# define LOVE_ENABLE_TOUCH
160# define LOVE_ENABLE_VIDEO
161# define LOVE_ENABLE_WINDOW
162
163# define LOVE_ENABLE_ENET
164# define LOVE_ENABLE_LUASOCKET
165# define LOVE_ENABLE_LUA53
166#endif
167
168// Check we have a sane configuration
169#if !defined(LOVE_WINDOWS) && !defined(LOVE_LINUX) && !defined(LOVE_IOS) && !defined(LOVE_MACOSX) && !defined(LOVE_ANDROID)
170# error Could not detect target platform
171#endif
172#if !defined(LOVE_LITTLE_ENDIAN) && !defined(LOVE_BIG_ENDIAN)
173# error Could not detect endianness
174#endif
175
176#endif // LOVE_CONFIG_H
177