The JUCE cross-platform C++ framework, with DISTRHO/KXStudio specific changes
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

270 lines
8.8KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library.
  4. Copyright (c) 2016 - ROLI Ltd.
  5. Permission is granted to use this software under the terms of the ISC license
  6. http://www.isc.org/downloads/software-support-policy/isc-license/
  7. Permission to use, copy, modify, and/or distribute this software for any
  8. purpose with or without fee is hereby granted, provided that the above
  9. copyright notice and this permission notice appear in all copies.
  10. THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD
  11. TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
  12. FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT,
  13. OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
  14. USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  15. TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
  16. OF THIS SOFTWARE.
  17. -----------------------------------------------------------------------------
  18. To release a closed-source product which uses other parts of JUCE not
  19. licensed under the ISC terms, commercial licenses are available: visit
  20. www.juce.com for more information.
  21. ==============================================================================
  22. */
  23. #pragma once
  24. #undef T
  25. //==============================================================================
  26. #if JUCE_MAC || JUCE_IOS
  27. #if JUCE_IOS
  28. #import <Foundation/Foundation.h>
  29. #import <UIKit/UIKit.h>
  30. #import <CoreData/CoreData.h>
  31. #import <MobileCoreServices/MobileCoreServices.h>
  32. #include <sys/fcntl.h>
  33. #else
  34. #import <Cocoa/Cocoa.h>
  35. #if (! defined MAC_OS_X_VERSION_10_12) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_12
  36. #define NSEventModifierFlagCommand NSCommandKeyMask
  37. #define NSEventModifierFlagControl NSControlKeyMask
  38. #define NSEventModifierFlagHelp NSHelpKeyMask
  39. #define NSEventModifierFlagNumericPad NSNumericPadKeyMask
  40. #define NSEventModifierFlagOption NSAlternateKeyMask
  41. #define NSEventModifierFlagShift NSShiftKeyMask
  42. #define NSCompositingOperationSourceOver NSCompositeSourceOver
  43. #define NSEventMaskApplicationDefined NSApplicationDefinedMask
  44. #define NSEventTypeApplicationDefined NSApplicationDefined
  45. #define NSEventTypeCursorUpdate NSCursorUpdate
  46. #define NSEventTypeMouseMoved NSMouseMoved
  47. #define NSEventTypeLeftMouseDown NSLeftMouseDown
  48. #define NSEventTypeRightMouseDown NSRightMouseDown
  49. #define NSEventTypeOtherMouseDown NSOtherMouseDown
  50. #define NSEventTypeLeftMouseUp NSLeftMouseUp
  51. #define NSEventTypeRightMouseUp NSRightMouseUp
  52. #define NSEventTypeOtherMouseUp NSOtherMouseUp
  53. #define NSEventTypeLeftMouseDragged NSLeftMouseDragged
  54. #define NSEventTypeRightMouseDragged NSRightMouseDragged
  55. #define NSEventTypeOtherMouseDragged NSOtherMouseDragged
  56. #define NSEventTypeScrollWheel NSScrollWheel
  57. #define NSEventTypeKeyDown NSKeyDown
  58. #define NSEventTypeKeyUp NSKeyUp
  59. #define NSEventTypeFlagsChanged NSFlagsChanged
  60. #define NSEventMaskAny NSAnyEventMask
  61. #define NSWindowStyleMaskBorderless NSBorderlessWindowMask
  62. #define NSWindowStyleMaskClosable NSClosableWindowMask
  63. #define NSWindowStyleMaskFullScreen NSFullScreenWindowMask
  64. #define NSWindowStyleMaskMiniaturizable NSMiniaturizableWindowMask
  65. #define NSWindowStyleMaskResizable NSResizableWindowMask
  66. #define NSWindowStyleMaskTitled NSTitledWindowMask
  67. #define NSAlertStyleCritical NSCriticalAlertStyle
  68. #define NSControlSizeRegular NSRegularControlSize
  69. #define NSEventTypeMouseEntered NSMouseEntered
  70. #define NSEventTypeMouseExited NSMouseExited
  71. #define NSAlertStyleInformational NSInformationalAlertStyle
  72. #define NSEventTypeTabletPoint NSTabletPoint
  73. #define NSEventTypeTabletProximity NSTabletProximity
  74. #endif
  75. #import <CoreAudio/HostTime.h>
  76. #include <sys/dir.h>
  77. #endif
  78. #include <sys/socket.h>
  79. #include <sys/sysctl.h>
  80. #include <sys/stat.h>
  81. #include <sys/param.h>
  82. #include <sys/mount.h>
  83. #include <sys/utsname.h>
  84. #include <sys/mman.h>
  85. #include <fnmatch.h>
  86. #include <utime.h>
  87. #include <dlfcn.h>
  88. #include <ifaddrs.h>
  89. #include <net/if_dl.h>
  90. #include <mach/mach_time.h>
  91. #include <mach-o/dyld.h>
  92. #include <objc/runtime.h>
  93. #include <objc/objc.h>
  94. #include <objc/message.h>
  95. //==============================================================================
  96. #elif JUCE_WINDOWS
  97. #if JUCE_MSVC
  98. #ifndef _CPPRTTI
  99. #error "You're compiling without RTTI enabled! This is needed for a lot of JUCE classes, please update your compiler settings!"
  100. #endif
  101. #ifndef _CPPUNWIND
  102. #error "You're compiling without exceptions enabled! This is needed for a lot of JUCE classes, please update your compiler settings!"
  103. #endif
  104. #pragma warning (push, 0) // disable all warnings whilst including system headers
  105. #endif
  106. #define NOMINMAX
  107. #define _WINSOCK_DEPRECATED_NO_WARNINGS 1
  108. #define STRICT 1
  109. #define WIN32_LEAN_AND_MEAN 1
  110. #if JUCE_MINGW
  111. #define _WIN32_WINNT 0x0501
  112. #else
  113. #define _WIN32_WINNT 0x0602
  114. #endif
  115. #define _UNICODE 1
  116. #define UNICODE 1
  117. #ifndef _WIN32_IE
  118. #define _WIN32_IE 0x0500
  119. #endif
  120. #include <windows.h>
  121. #include <shellapi.h>
  122. #include <tchar.h>
  123. #include <stddef.h>
  124. #include <ctime>
  125. #include <wininet.h>
  126. #include <nb30.h>
  127. #include <winsock2.h>
  128. #include <ws2tcpip.h>
  129. #include <iphlpapi.h>
  130. #include <mapi.h>
  131. #include <float.h>
  132. #include <process.h>
  133. #include <shlobj.h>
  134. #include <shlwapi.h>
  135. #include <mmsystem.h>
  136. #if JUCE_MINGW
  137. #include <basetyps.h>
  138. #include <sys/time.h>
  139. #ifndef alloca
  140. #define alloca __builtin_alloca
  141. #endif
  142. #else
  143. #include <crtdbg.h>
  144. #include <comutil.h>
  145. #endif
  146. #ifndef S_FALSE
  147. #define S_FALSE (1) // (apparently some obscure win32 dev environments don't define this)
  148. #endif
  149. #undef PACKED
  150. #if JUCE_MSVC
  151. #pragma warning (pop)
  152. #pragma warning (4: 4511 4512 4100)
  153. #endif
  154. #if JUCE_MSVC && ! JUCE_DONT_AUTOLINK_TO_WIN32_LIBRARIES
  155. #pragma comment (lib, "kernel32.lib")
  156. #pragma comment (lib, "user32.lib")
  157. #pragma comment (lib, "wininet.lib")
  158. #pragma comment (lib, "advapi32.lib")
  159. #pragma comment (lib, "ws2_32.lib")
  160. #pragma comment (lib, "version.lib")
  161. #pragma comment (lib, "shlwapi.lib")
  162. #pragma comment (lib, "winmm.lib")
  163. #ifdef _NATIVE_WCHAR_T_DEFINED
  164. #ifdef _DEBUG
  165. #pragma comment (lib, "comsuppwd.lib")
  166. #else
  167. #pragma comment (lib, "comsuppw.lib")
  168. #endif
  169. #else
  170. #ifdef _DEBUG
  171. #pragma comment (lib, "comsuppd.lib")
  172. #else
  173. #pragma comment (lib, "comsupp.lib")
  174. #endif
  175. #endif
  176. #endif
  177. /* Used with DynamicLibrary to simplify importing functions from a win32 DLL.
  178. dll: the DynamicLibrary object
  179. functionName: function to import
  180. localFunctionName: name you want to use to actually call it (must be different)
  181. returnType: the return type
  182. params: list of params (bracketed)
  183. */
  184. #define JUCE_LOAD_WINAPI_FUNCTION(dll, functionName, localFunctionName, returnType, params) \
  185. typedef returnType (WINAPI *type##localFunctionName) params; \
  186. type##localFunctionName localFunctionName = (type##localFunctionName) dll.getFunction (#functionName);
  187. //==============================================================================
  188. #elif JUCE_LINUX
  189. #include <sched.h>
  190. #include <pthread.h>
  191. #include <sys/time.h>
  192. #include <errno.h>
  193. #include <sys/stat.h>
  194. #include <sys/dir.h>
  195. #include <sys/ptrace.h>
  196. #include <sys/vfs.h>
  197. #include <sys/wait.h>
  198. #include <sys/mman.h>
  199. #include <fnmatch.h>
  200. #include <utime.h>
  201. #include <pwd.h>
  202. #include <fcntl.h>
  203. #include <dlfcn.h>
  204. #include <netdb.h>
  205. #include <arpa/inet.h>
  206. #include <netinet/in.h>
  207. #include <sys/types.h>
  208. #include <sys/ioctl.h>
  209. #include <sys/socket.h>
  210. #include <net/if.h>
  211. #include <sys/sysinfo.h>
  212. #include <sys/file.h>
  213. #include <sys/prctl.h>
  214. #include <signal.h>
  215. #include <stddef.h>
  216. //==============================================================================
  217. #elif JUCE_ANDROID
  218. #include <jni.h>
  219. #include <pthread.h>
  220. #include <sched.h>
  221. #include <sys/time.h>
  222. #include <utime.h>
  223. #include <errno.h>
  224. #include <fcntl.h>
  225. #include <dlfcn.h>
  226. #include <sys/stat.h>
  227. #include <sys/statfs.h>
  228. #include <sys/ptrace.h>
  229. #include <sys/sysinfo.h>
  230. #include <sys/mman.h>
  231. #include <pwd.h>
  232. #include <dirent.h>
  233. #include <fnmatch.h>
  234. #include <sys/wait.h>
  235. #endif
  236. // Need to clear various moronic redefinitions made by system headers..
  237. #undef max
  238. #undef min
  239. #undef direct
  240. #undef check