config.h 4.5 KB

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