config.h 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. /**
  2. * Copyright (c) 2006-2024 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. #ifndef LOVE_CONFIG_H
  21. #define LOVE_CONFIG_H
  22. // Platform stuff.
  23. #if defined(WIN32) || defined(_WIN32)
  24. # define LOVE_WINDOWS 1
  25. # include <winapifamily.h>
  26. # if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) && !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
  27. # define LOVE_WINDOWS_UWP 1
  28. # define LOVE_NO_MODPLUG 1
  29. # endif
  30. #endif
  31. #if defined(linux) || defined(__linux) || defined(__linux__)
  32. # define LOVE_LINUX 1
  33. #endif
  34. #if defined(__ANDROID__)
  35. # define LOVE_ANDROID 1
  36. // Needed for ENet
  37. # define HAS_SOCKLEN_T 1
  38. #endif
  39. #if defined(__APPLE__)
  40. # include <TargetConditionals.h>
  41. # if TARGET_OS_IPHONE
  42. # define LOVE_IOS 1
  43. # elif TARGET_OS_MAC
  44. # define LOVE_MACOS 1
  45. # endif
  46. #endif
  47. #if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
  48. // I know it's not linux, but it seems most "linux-only" code is bsd-compatible
  49. # define LOVE_LINUX 1
  50. #endif
  51. // Endianness.
  52. #if defined(__ppc__) || defined(__ppc) || defined(__powerpc__) || defined(__powerpc)
  53. # define LOVE_BIG_ENDIAN 1
  54. #else
  55. # define LOVE_LITTLE_ENDIAN 1
  56. #endif
  57. // SSE instructions.
  58. #if defined(__SSE__)
  59. # define LOVE_SIMD_SSE
  60. #elif defined(_MSC_VER)
  61. # if defined(_M_AMD64) || defined(_M_X64)
  62. # define LOVE_SIMD_SSE
  63. # elif _M_IX86_FP
  64. # define LOVE_SIMD_SSE
  65. # endif
  66. #endif
  67. // NEON instructions.
  68. #if defined(__ARM_NEON) || defined(_M_ARM64)
  69. # define LOVE_SIMD_NEON
  70. #endif
  71. // Warnings.
  72. #ifndef _CRT_SECURE_NO_WARNINGS
  73. # define _CRT_SECURE_NO_WARNINGS
  74. #endif
  75. // Preferably, and ironically, this macro should go unused.
  76. #ifndef LOVE_UNUSED
  77. # define LOVE_UNUSED(x) (void)sizeof(x)
  78. #endif
  79. // Warn on unused return values
  80. #ifdef __GNUC__
  81. # define LOVE_WARN_UNUSED __attribute__((warn_unused_result))
  82. #elif _MSC_VER
  83. # define LOVE_WARN_UNUSED _Check_return_
  84. #else
  85. # define LOVE_WARN_UNUSED
  86. #endif
  87. #ifndef LOVE_BUILD
  88. # define LOVE_BUILD
  89. # define LOVE_BUILD_STANDALONE
  90. # define LOVE_BUILD_EXE
  91. //# define LOVE_BUILD_DLL
  92. #endif
  93. // DLL-stuff.
  94. #if defined(_MSC_VER) || defined(__MINGW32__)
  95. # define LOVE_EXPORT __declspec(dllexport)
  96. #elif defined(__GNUC__) || defined(__clang__)
  97. # define LOVE_EXPORT __attribute__((visibility("default")))
  98. #else
  99. # define LOVE_EXPORT
  100. #endif
  101. #if defined(LOVE_WINDOWS)
  102. #ifndef LOVE_WINDOWS_UWP
  103. # define LOVE_LEGENDARY_CONSOLE_IO_HACK
  104. #endif // LOVE_WINDOWS_UWP
  105. #ifndef __MINGW32__
  106. # define NOMINMAX
  107. #endif
  108. #endif
  109. #if defined(LOVE_MACOS) || defined(LOVE_IOS)
  110. # define LOVE_LEGENDARY_APP_ARGV_HACK
  111. #endif
  112. #if defined(LOVE_WINDOWS) || defined(LOVE_LINUX) || defined(LOVE_ANDROID)
  113. # define LOVE_GRAPHICS_VULKAN
  114. #endif
  115. #if defined(LOVE_MACOS) || defined(LOVE_IOS)
  116. # define LOVE_GRAPHICS_METAL
  117. #endif
  118. // Autotools config.h
  119. #ifdef HAVE_CONFIG_H
  120. # include <../config.h>
  121. # undef VERSION
  122. # ifdef WORDS_BIGENDIAN
  123. # undef LOVE_LITTLE_ENDIAN
  124. # define LOVE_BIG_ENDIAN 1
  125. # else
  126. # undef LOVE_BIG_ENDIAN
  127. # define LOVE_LITTLE_ENDIAN 1
  128. # endif
  129. #else
  130. # define LOVE_ENABLE_LOVE
  131. # define LOVE_ENABLE_AUDIO
  132. # define LOVE_ENABLE_DATA
  133. # define LOVE_ENABLE_EVENT
  134. # define LOVE_ENABLE_FILESYSTEM
  135. # define LOVE_ENABLE_FONT
  136. # define LOVE_ENABLE_GRAPHICS
  137. # define LOVE_ENABLE_IMAGE
  138. # define LOVE_ENABLE_JOYSTICK
  139. # define LOVE_ENABLE_KEYBOARD
  140. # define LOVE_ENABLE_MATH
  141. # define LOVE_ENABLE_MOUSE
  142. # define LOVE_ENABLE_PHYSICS
  143. # define LOVE_ENABLE_SENSOR
  144. # define LOVE_ENABLE_SOUND
  145. # define LOVE_ENABLE_SYSTEM
  146. # define LOVE_ENABLE_THREAD
  147. # define LOVE_ENABLE_TIMER
  148. # define LOVE_ENABLE_TOUCH
  149. # define LOVE_ENABLE_VIDEO
  150. # define LOVE_ENABLE_WINDOW
  151. # define LOVE_ENABLE_ENET
  152. # define LOVE_ENABLE_LUASOCKET
  153. # define LOVE_ENABLE_LUA53
  154. # define LOVE_ENABLE_LUAHTTPS
  155. #endif
  156. // Check we have a sane configuration
  157. #if !defined(LOVE_WINDOWS) && !defined(LOVE_LINUX) && !defined(LOVE_IOS) && !defined(LOVE_MACOS) && !defined(LOVE_ANDROID)
  158. # error Could not detect target platform
  159. #endif
  160. #if !defined(LOVE_LITTLE_ENDIAN) && !defined(LOVE_BIG_ENDIAN)
  161. # error Could not detect endianness
  162. #endif
  163. #endif // LOVE_CONFIG_H