25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.

715 satır
25 KiB

1 yıl önce
1 yıl önce
3 yıl önce
7 yıl önce
3 yıl önce
3 yıl önce
7 yıl önce
10 ay önce
2 yıl önce
2 yıl önce
2 yıl önce
5 yıl önce
7 yıl önce
7 yıl önce
3 yıl önce
7 yıl önce
2 yıl önce
1 yıl önce
5 yıl önce
7 yıl önce
5 yıl önce
5 yıl önce
7 yıl önce
WARNING: `rcore` module split per-platform **BIG CHANGE** (#3388) * Submodules (#3311) * Check in current state * Add submodules to Makefile and clean up some imports * Start moving InitGraphicsDeivce * Move android_main and CloseWindow() out of rcore * Move WindowShouldClose out of rcore * Move IsWindowHidden out of rcore * Move IsWindowMinimized out of rcore * Move IsWindowMaximized, IsWindowFocused and IsWindowResized out of rcore * Move ToggleFullscreen out of rcore * Move MaximizeWindow, MinimizeWindow and RestoreWindow out of rcore * Move 13 functions out of rcore: ToggleBorderlessWindowed SetWindowState ClearWindowState SetWindowIcon SetWindowIcons SetWindowTitle SetWindowPosition SetWindowMonitor SetWindowMinSize SetWindowMaxSize SetWindowSize SetWindowOpacity SetWindowFocused * Minor clean up, revert makefile change, include submodules directly in rcore * Fix makefile comment * Remove rcore.h from Makefile * Remove debug include * Move 18 functions from rcore to submodules GetWindowHandle GetMonitorCount GetCurrentMonitor GetMonitorPosition GetMonitorWidth GetMonitorHeight GetMonitorPhysicalHeight GetMonitorRefreshRate GetWindowPosition GetWindowScaleDPI GetMonitorName SetClipboardText GetClipboardText ShowCursor HideCursor EnableCursor DisableCursor GetTime * Move TakeScreenshot, OpenURL, GetGamepadName out of rcore into submodules * remove debugging #defines * Move GetMonitorPhysicalWidth from rcore to submodule * Move GetGamepadAxisCount from rcore * Move SetGamepadMappings out of rcore * Move GetMouseX, GetMouseY, GetMousePosition out of rcore * Move SetMousePosition out of rcore * Move GetMouseWheelMove out of rcore * Move the last functions out of rcore * Move shared function defs and some global var to rcore.h * Clean up rcore.c and rcore.h a little more * Remove unnecessary #define --------- Co-authored-by: MichaelFiber <michael@cubeofb.org> * REVIEWED: `PLATFORM_DESKTOP` Windows building * Revert "REVIEWED: `PLATFORM_DESKTOP` Windows building" This reverts commit 71a12171f768eb25053ef908732b4ce8fdf802f7. * Reviewed Windows building * [split] Fix compilation for web (and desktop) (#3329) * Fix compilation for web * Remove EM_ASM_INT from core_input_gestures_web example * Fix raymath undefined symbols for desktop and web * Remove raylib_opengl_interop from examples Makefile * Revert previous commit (8651c78) * Fix TraceLog for web and desktop * [split] `rcore`, `rcore_web` and `rcore_desktop` changes (batch 2) (#3334) * Fix formatting * Reapply commit 9d230d7 (#3305) that was missing * Reapplies commits 719365f (#3309) and 8a1779b (#3312) that were missing * Reapply commit 5c9cc3f (#3323) that was missing * Reapply commit a2b3b1e that was missing * Revert commit cef25c6 to fix macro redefined warning * Move rcore.h #include to after config.h to fix macro redefinitions warnings * [split] `rcore`, `web`, `desktop`, `android` changes (batch 3) (#3338) * First pass to remove unneeded platform macros for web * Second pass to remove unneeded platform macros for web * Move GetTouchX, GetTouchY, GetTouchPosition from rcore to web, desktop, android * Move SetMouseCursor from rcore to android, desktop, web * [split] `rcore`, `web`, `desktop`, `android` changes (batch 4) (#3343) * Fix ToggleBorderlessWindowed duplicated glfwSetWindowSize calls * First pass to remove unneeded platform macros for android * Second pass to remove unneeded platform macros for android * Remove unneeded platform macros for desktop * Relocate GetGamepadName and update SetGamepadMappings on android, desktop, web * Add missing comment to web * [split] `rcore`, `web`, `desktop`, `android` changes (batch 5) (#3345) * Move SetExitKey from core to android, desktop, web * Move some callbacks from core to desktop and web * Relocate emscripten callbacks on web * Relocate android callbacks on android * Revert "Relocate android callbacks on android" This reverts commit bbdbecc01ea7f871dae56019724386e73611c69c. * Updates UnloadVrStereoConfig on rcore * Update SetClipboardText on android * Fix screenMin/Max default values for android * [split] `rcore`, `drm` changes (#3347) * Tweak makefiles for PLATFORM_DRM and move rcore_drm's dependencies to rcore.h * Move drm functions to rcore_drm.c * Fix a typo in rcore.c * Add SetExitKey to rcore_drm.c --------- Co-authored-by: MichaelFiber <michael@cubeofb.org> * Fix compilation for android (#3360) * Fix android include (#3364) * Reviewed platform split #3313 - Added file headers info - Added TRACELOG message for unimplemented functions - Reviewed code formatting and organization - Several code tweaks * REVIEWED: `GetDirectoryPath()` --------- Co-authored-by: MichaelFiber <42419558+michaelfiber@users.noreply.github.com> Co-authored-by: MichaelFiber <michael@cubeofb.org> Co-authored-by: ubkp <118854183+ubkp@users.noreply.github.com>
1 yıl önce
3 yıl önce
3 yıl önce
2 yıl önce
2 yıl önce
2 yıl önce
2 yıl önce
2 yıl önce
2 yıl önce
7 yıl önce
2 yıl önce
7 yıl önce
2 ay önce
7 yıl önce
7 yıl önce
7 yıl önce
7 yıl önce
7 yıl önce
  1. #**************************************************************************************************
  2. #
  3. # raylib makefile for multiple platforms
  4. #
  5. # This file supports building raylib examples for the following platforms:
  6. #
  7. # > PLATFORM_DESKTOP
  8. # - Defaults to PLATFORM_DESKTOP_GLFW
  9. # > PLATFORM_DESKTOP_GFLW (GLFW backend):
  10. # - Windows (Win32, Win64)
  11. # - Linux (X11/Wayland desktop mode)
  12. # - macOS/OSX (x64, arm64)
  13. # - FreeBSD, OpenBSD, NetBSD, DragonFly (X11 desktop)
  14. # > PLATFORM_DESKTOP_SDL (SDL backend):
  15. # - Windows (Win32, Win64)
  16. # - Linux (X11/Wayland desktop mode)
  17. # - Others (not tested)
  18. # > PLATFORM_DESKTOP_RGFW (RGFW backend):
  19. # - Windows (Win32, Win64)
  20. # - Linux (X11 desktop mode)
  21. # - macOS/OSX (x64, arm64 (not tested))
  22. # - Others (not tested)
  23. # > PLATFORM_WEB:
  24. # - HTML5 (WebAssembly)
  25. # > PLATFORM_DRM:
  26. # - Raspberry Pi 0-5 (DRM/KMS)
  27. # - Linux DRM subsystem (KMS mode)
  28. # > PLATFORM_ANDROID:
  29. # - Android (ARM, ARM64)
  30. #
  31. # Copyright (c) 2013-2024 Ramon Santamaria (@raysan5)
  32. #
  33. # This software is provided "as-is", without any express or implied warranty. In no event
  34. # will the authors be held liable for any damages arising from the use of this software.
  35. #
  36. # Permission is granted to anyone to use this software for any purpose, including commercial
  37. # applications, and to alter it and redistribute it freely, subject to the following restrictions:
  38. #
  39. # 1. The origin of this software must not be misrepresented; you must not claim that you
  40. # wrote the original software. If you use this software in a product, an acknowledgment
  41. # in the product documentation would be appreciated but is not required.
  42. #
  43. # 2. Altered source versions must be plainly marked as such, and must not be misrepresented
  44. # as being the original software.
  45. #
  46. # 3. This notice may not be removed or altered from any source distribution.
  47. #
  48. #**************************************************************************************************
  49. .PHONY: all clean
  50. # Define required environment variables
  51. #------------------------------------------------------------------------------------------------
  52. # Define target platform: PLATFORM_DESKTOP, PLATFORM_DESKTOP_SDL, PLATFORM_DRM, PLATFORM_ANDROID, PLATFORM_WEB
  53. PLATFORM ?= PLATFORM_DESKTOP
  54. ifeq ($(PLATFORM), PLATFORM_DESKTOP)
  55. TARGET_PLATFORM = PLATFORM_DESKTOP_GLFW
  56. else
  57. TARGET_PLATFORM = $(PLATFORM)
  58. endif
  59. # Define required raylib variables
  60. PROJECT_NAME ?= raylib_examples
  61. RAYLIB_VERSION ?= 5.5.0
  62. RAYLIB_PATH ?= ..
  63. # Define raylib source code path
  64. RAYLIB_SRC_PATH ?= ../src
  65. # Locations of raylib.h and libraylib.a/libraylib.so
  66. # NOTE: Those variables are only used for PLATFORM_OS: LINUX, BSD
  67. DESTDIR ?= /usr/local
  68. RAYLIB_INCLUDE_PATH ?= $(DESTDIR)/include
  69. RAYLIB_LIB_PATH ?= $(DESTDIR)/lib
  70. # Library type compilation: STATIC (.a) or SHARED (.so/.dll)
  71. RAYLIB_LIBTYPE ?= STATIC
  72. # Build mode for project: DEBUG or RELEASE
  73. BUILD_MODE ?= RELEASE
  74. # Use external GLFW library instead of rglfw module
  75. USE_EXTERNAL_GLFW ?= FALSE
  76. # PLATFORM_DESKTOP_SDL: It requires SDL library to be provided externally
  77. # WARNING: Library is not included in raylib, it MUST be configured by users
  78. SDL_INCLUDE_PATH ?= $(RAYLIB_SRC_PATH)/external/SDL2/include
  79. SDL_LIBRARY_PATH ?= $(RAYLIB_SRC_PATH)/external/SDL2/lib
  80. SDL_LIBRARIES ?= -lSDL2 -lSDL2main
  81. # Use Wayland display server protocol on Linux desktop (by default it uses X11 windowing system)
  82. # NOTE: This variable is only used for PLATFORM_OS: LINUX
  83. USE_WAYLAND_DISPLAY ?= FALSE
  84. # PLATFORM_WEB: Default properties
  85. BUILD_WEB_ASYNCIFY ?= TRUE
  86. BUILD_WEB_SHELL ?= $(RAYLIB_PATH)/src/minshell.html
  87. BUILD_WEB_HEAP_SIZE ?= 134217728
  88. BUILD_WEB_RESOURCES ?= TRUE
  89. BUILD_WEB_RESOURCES_PATH ?= $(dir $<)resources@resources
  90. # Determine PLATFORM_OS when required
  91. ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM),PLATFORM_DESKTOP_GLFW PLATFORM_DESKTOP_SDL PLATFORM_DESKTOP_RGFW PLATFORM_WEB))
  92. # No uname.exe on MinGW!, but OS=Windows_NT on Windows!
  93. # ifeq ($(UNAME),Msys) -> Windows
  94. ifeq ($(OS),Windows_NT)
  95. PLATFORM_OS = WINDOWS
  96. else
  97. UNAMEOS = $(shell uname)
  98. ifeq ($(UNAMEOS),Linux)
  99. PLATFORM_OS = LINUX
  100. endif
  101. ifeq ($(UNAMEOS),FreeBSD)
  102. PLATFORM_OS = BSD
  103. endif
  104. ifeq ($(UNAMEOS),OpenBSD)
  105. PLATFORM_OS = BSD
  106. endif
  107. ifeq ($(UNAMEOS),NetBSD)
  108. PLATFORM_OS = BSD
  109. endif
  110. ifeq ($(UNAMEOS),DragonFly)
  111. PLATFORM_OS = BSD
  112. endif
  113. ifeq ($(UNAMEOS),Darwin)
  114. PLATFORM_OS = OSX
  115. endif
  116. endif
  117. endif
  118. ifeq ($(TARGET_PLATFORM),PLATFORM_DRM)
  119. UNAMEOS = $(shell uname)
  120. ifeq ($(UNAMEOS),Linux)
  121. PLATFORM_OS = LINUX
  122. endif
  123. endif
  124. # RAYLIB_PATH adjustment for LINUX platform
  125. # TODO: Do we really need this?
  126. ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_GLFW)
  127. ifeq ($(PLATFORM_OS),LINUX)
  128. RAYLIB_PREFIX ?= ..
  129. RAYLIB_PATH = $(realpath $(RAYLIB_PREFIX))
  130. endif
  131. endif
  132. # Default path for raylib on Raspberry Pi
  133. ifeq ($(TARGET_PLATFORM),PLATFORM_DRM)
  134. RAYLIB_PATH ?= /home/pi/raylib
  135. endif
  136. # Define raylib release directory for compiled library
  137. RAYLIB_RELEASE_PATH ?= $(RAYLIB_PATH)/src
  138. ifeq ($(TARGET_PLATFORM),PLATFORM_WEB)
  139. ifeq ($(PLATFORM_OS),WINDOWS)
  140. # Emscripten required variables
  141. EMSDK_PATH ?= C:/raylib/emsdk
  142. EMSCRIPTEN_PATH ?= $(EMSDK_PATH)/upstream/emscripten
  143. CLANG_PATH = $(EMSDK_PATH)/upstream/bin
  144. PYTHON_PATH = $(EMSDK_PATH)/python/3.9.2-nuget_64bit
  145. NODE_PATH = $(EMSDK_PATH)/node/20.18.0_64bit/bin
  146. export PATH = $(EMSDK_PATH);$(EMSCRIPTEN_PATH);$(CLANG_PATH);$(NODE_PATH);$(PYTHON_PATH):$$(PATH)
  147. endif
  148. endif
  149. # Define default C compiler: CC
  150. #------------------------------------------------------------------------------------------------
  151. CC = gcc
  152. ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_GLFW)
  153. ifeq ($(PLATFORM_OS),OSX)
  154. # OSX default compiler
  155. CC = clang
  156. endif
  157. ifeq ($(PLATFORM_OS),BSD)
  158. # FreeBSD, OpenBSD, NetBSD, DragonFly default compiler
  159. CC = clang
  160. endif
  161. endif
  162. ifeq ($(TARGET_PLATFORM),PLATFORM_WEB)
  163. # HTML5 emscripten compiler
  164. # WARNING: To compile to HTML5, code must be redesigned
  165. # to use emscripten.h and emscripten_set_main_loop()
  166. CC = emcc
  167. endif
  168. # Define default make program: MAKE
  169. #------------------------------------------------------------------------------------------------
  170. MAKE ?= make
  171. ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_GLFW)
  172. ifeq ($(PLATFORM_OS),WINDOWS)
  173. MAKE = mingw32-make
  174. endif
  175. endif
  176. ifeq ($(TARGET_PLATFORM),PLATFORM_ANDROID)
  177. MAKE = mingw32-make
  178. endif
  179. ifeq ($(TARGET_PLATFORM),PLATFORM_WEB)
  180. ifeq ($(OS),Windows_NT)
  181. MAKE = mingw32-make
  182. else
  183. EMMAKE != type emmake
  184. ifneq (, $(EMMAKE))
  185. MAKE = emmake make
  186. else
  187. MAKE = mingw32-make
  188. endif
  189. endif
  190. endif
  191. # Define compiler flags: CFLAGS
  192. #------------------------------------------------------------------------------------------------
  193. # -O1 defines optimization level
  194. # -g include debug information on compilation
  195. # -s strip unnecessary data from build
  196. # -Wall turns on most, but not all, compiler warnings
  197. # -std=c99 defines C language mode (standard C from 1999 revision)
  198. # -std=gnu99 defines C language mode (GNU C from 1999 revision)
  199. # -Wno-missing-braces ignore invalid warning (GCC bug 53119)
  200. # -Wno-unused-value ignore unused return values of some functions (i.e. fread())
  201. # -D_DEFAULT_SOURCE use with -std=c99 on Linux and PLATFORM_WEB, required for timespec
  202. CFLAGS = -Wall -std=c99 -D_DEFAULT_SOURCE -Wno-missing-braces -Wunused-result
  203. ifeq ($(BUILD_MODE),DEBUG)
  204. CFLAGS += -g -D_DEBUG
  205. ifeq ($(TARGET_PLATFORM),PLATFORM_WEB)
  206. CFLAGS += -sASSERTIONS=1 --profiling
  207. endif
  208. else
  209. ifeq ($(TARGET_PLATFORM),PLATFORM_WEB)
  210. ifeq ($(BUILD_WEB_ASYNCIFY),TRUE)
  211. CFLAGS += -O3
  212. else
  213. CFLAGS += -Os
  214. endif
  215. else
  216. CFLAGS += -O2
  217. endif
  218. endif
  219. # Additional flags for compiler (if desired)
  220. # -Wextra enables some extra warning flags that are not enabled by -Wall
  221. # -Wmissing-prototypes warn if a global function is defined without a previous prototype declaration
  222. # -Wstrict-prototypes warn if a function is declared or defined without specifying the argument types
  223. # -Werror=implicit-function-declaration catch function calls without prior declaration
  224. #CFLAGS += -Wextra -Wmissing-prototypes -Wstrict-prototypes
  225. ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_GLFW)
  226. ifeq ($(PLATFORM_OS),LINUX)
  227. ifeq ($(RAYLIB_LIBTYPE),STATIC)
  228. CFLAGS += -D_DEFAULT_SOURCE
  229. endif
  230. ifeq ($(RAYLIB_LIBTYPE),SHARED)
  231. # Explicitly enable runtime link to libraylib.so
  232. CFLAGS += -Wl,-rpath,$(RAYLIB_RELEASE_PATH)
  233. endif
  234. endif
  235. endif
  236. ifeq ($(TARGET_PLATFORM),PLATFORM_DRM)
  237. CFLAGS += -std=gnu99 -DEGL_NO_X11
  238. endif
  239. # Define include paths for required headers: INCLUDE_PATHS
  240. # NOTE: Some external/extras libraries could be required (stb, easings...)
  241. #------------------------------------------------------------------------------------------------
  242. INCLUDE_PATHS = -I. -I$(RAYLIB_PATH)/src -I$(RAYLIB_PATH)/src/external $(EXTRA_INCLUDE_PATHS)
  243. # Define additional directories containing required header files
  244. ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_GLFW)
  245. ifeq ($(PLATFORM_OS),BSD)
  246. INCLUDE_PATHS += -I$(RAYLIB_INCLUDE_PATH) -I/usr/pkg/include -I/usr/X11R7/include
  247. endif
  248. ifeq ($(PLATFORM_OS),LINUX)
  249. INCLUDE_PATHS += -I$(RAYLIB_INCLUDE_PATH)
  250. endif
  251. endif
  252. ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_SDL)
  253. INCLUDE_PATHS += -I$(SDL_INCLUDE_PATH)
  254. endif
  255. ifeq ($(TARGET_PLATFORM),PLATFORM_DRM)
  256. INCLUDE_PATHS += -I$(RAYLIB_INCLUDE_PATH)
  257. INCLUDE_PATHS += -I/usr/include/libdrm
  258. endif
  259. # Include GLFW required for examples/others/rlgl_standalone.c
  260. ifeq ($(USE_EXTERNAL_GLFW),FALSE)
  261. all others: INCLUDE_PATHS += -I$(RAYLIB_PATH)/src/external/glfw/include
  262. endif
  263. # Define library paths containing required libs: LDFLAGS
  264. #------------------------------------------------------------------------------------------------
  265. LDFLAGS = -L. -L$(RAYLIB_RELEASE_PATH) -L$(RAYLIB_PATH)/src
  266. ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_GLFW)
  267. ifeq ($(PLATFORM_OS),WINDOWS)
  268. # NOTE: The resource .rc file contains windows executable icon and properties
  269. LDFLAGS += $(RAYLIB_PATH)/src/raylib.rc.data
  270. # -Wl,--subsystem,windows hides the console window
  271. ifeq ($(BUILD_MODE), RELEASE)
  272. LDFLAGS += -Wl,--subsystem,windows
  273. endif
  274. endif
  275. ifeq ($(PLATFORM_OS),LINUX)
  276. LDFLAGS += -L$(RAYLIB_LIB_PATH)
  277. endif
  278. ifeq ($(PLATFORM_OS),BSD)
  279. LDFLAGS += -Lsrc -L$(RAYLIB_LIB_PATH)
  280. endif
  281. endif
  282. ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_SDL)
  283. ifeq ($(PLATFORM_OS),WINDOWS)
  284. # NOTE: The resource .rc file contains windows executable icon and properties
  285. LDFLAGS += $(RAYLIB_PATH)/src/raylib.rc.data
  286. # -Wl,--subsystem,windows hides the console window
  287. ifeq ($(BUILD_MODE), RELEASE)
  288. LDFLAGS += -Wl,--subsystem,windows
  289. endif
  290. endif
  291. LDFLAGS += -L$(SDL_LIBRARY_PATH)
  292. endif
  293. ifeq ($(TARGET_PLATFORM),PLATFORM_WEB)
  294. # -Os # size optimization
  295. # -O2 # optimization level 2, if used, also set --memory-init-file 0
  296. # -sUSE_GLFW=3 # Use glfw3 library (context/input management)
  297. # -sALLOW_MEMORY_GROWTH=1 # to allow memory resizing -> WARNING: Audio buffers could FAIL!
  298. # -sTOTAL_MEMORY=16777216 # to specify heap memory size (default = 16MB) (67108864 = 64MB)
  299. # -sUSE_PTHREADS=1 # multithreading support
  300. # -sWASM=0 # disable Web Assembly, emitted by default
  301. # -sASYNCIFY # lets synchronous C/C++ code interact with asynchronous JS
  302. # -sFORCE_FILESYSTEM=1 # force filesystem to load/save files data
  303. # -sASSERTIONS=1 # enable runtime checks for common memory allocation errors (-O1 and above turn it off)
  304. # -sGL_ENABLE_GET_PROC_ADDRESS # enable using the *glGetProcAddress() family of functions, required for extensions loading
  305. # --profiling # include information for code profiling
  306. # --memory-init-file 0 # to avoid an external memory initialization code file (.mem)
  307. # --preload-file resources # specify a resources folder for data compilation
  308. # --source-map-base # allow debugging in browser with source map
  309. LDFLAGS += -sUSE_GLFW=3 -sTOTAL_MEMORY=$(BUILD_WEB_HEAP_SIZE) -sFORCE_FILESYSTEM=1
  310. # Build using asyncify
  311. ifeq ($(BUILD_WEB_ASYNCIFY),TRUE)
  312. LDFLAGS += -sASYNCIFY
  313. endif
  314. # Add resources building if required
  315. ifeq ($(BUILD_WEB_RESOURCES),TRUE)
  316. LDFLAGS += --preload-file $(BUILD_WEB_RESOURCES_PATH)
  317. endif
  318. # Add debug mode flags if required
  319. ifeq ($(BUILD_MODE),DEBUG)
  320. LDFLAGS += -sASSERTIONS=1 --profiling
  321. endif
  322. # Define a custom shell .html and output extension
  323. LDFLAGS += --shell-file $(BUILD_WEB_SHELL)
  324. EXT = .html
  325. # NOTE: Simple raylib examples are compiled to be interpreter with asyncify, that way,
  326. # we can compile same code for ALL platforms with no change required, but, working on bigger
  327. # projects, code needs to be refactored to avoid a blocking while() loop, moving Update and Draw
  328. # logic to a self contained function: UpdateDrawFrame(), check core_basic_window_web.c for reference.
  329. endif
  330. # Define libraries required on linking: LDLIBS
  331. # NOTE: To link libraries (lib<name>.so or lib<name>.a), use -l<name>
  332. #------------------------------------------------------------------------------------------------
  333. ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_GLFW)
  334. ifeq ($(PLATFORM_OS),WINDOWS)
  335. # Libraries for Windows desktop compilation
  336. # NOTE: WinMM library required to set high-res timer resolution
  337. LDLIBS = -lraylib -lopengl32 -lgdi32 -lwinmm
  338. endif
  339. ifeq ($(PLATFORM_OS),LINUX)
  340. # Libraries for Debian GNU/Linux desktop compiling
  341. # NOTE: Required packages: libegl1-mesa-dev
  342. LDLIBS = -lraylib -lGL -lm -lpthread -ldl -lrt
  343. # On X11 requires also below libraries
  344. LDLIBS += -lX11
  345. # NOTE: It seems additional libraries are not required any more, latest GLFW just dlopen them
  346. #LDLIBS += -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor
  347. # On Wayland windowing system, additional libraries requires
  348. ifeq ($(USE_WAYLAND_DISPLAY),TRUE)
  349. LDLIBS += -lwayland-client -lwayland-cursor -lwayland-egl -lxkbcommon
  350. endif
  351. # Explicit link to libc
  352. ifeq ($(RAYLIB_LIBTYPE),SHARED)
  353. LDLIBS += -lc
  354. endif
  355. # NOTE: On ARM 32bit arch, miniaudio requires atomics library
  356. LDLIBS += -latomic
  357. endif
  358. ifeq ($(PLATFORM_OS),OSX)
  359. # Libraries for OSX 10.9 desktop compiling
  360. # NOTE: Required packages: libopenal-dev libegl1-mesa-dev
  361. LDLIBS = -lraylib -framework OpenGL -framework Cocoa -framework IOKit -framework CoreAudio -framework CoreVideo
  362. endif
  363. ifeq ($(PLATFORM_OS),BSD)
  364. # Libraries for FreeBSD, OpenBSD, NetBSD, DragonFly desktop compiling
  365. # NOTE: Required packages: mesa-libs
  366. LDFLAGS += -L/usr/X11R7/lib -Wl,-R/usr/X11R7/lib
  367. LDLIBS = -lraylib -lGL -lm -lpthread
  368. # On XWindow requires also below libraries
  369. LDLIBS += -lX11 -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor
  370. endif
  371. ifeq ($(USE_EXTERNAL_GLFW),TRUE)
  372. # NOTE: It could require additional packages installed: libglfw3-dev
  373. LDLIBS += -lglfw
  374. endif
  375. endif
  376. ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_SDL)
  377. ifeq ($(PLATFORM_OS),WINDOWS)
  378. # Libraries for Windows desktop compilation
  379. LDLIBS = -lraylib $(SDL_LIBRARIES) -lopengl32 -lgdi32
  380. endif
  381. ifeq ($(PLATFORM_OS),LINUX)
  382. # Libraries for Debian GNU/Linux desktop compiling
  383. # NOTE: Required packages: libegl1-mesa-dev
  384. LDLIBS = -lraylib $(SDL_LIBRARIES) -lGL -lm -lpthread -ldl -lrt
  385. # On X11 requires also below libraries
  386. LDLIBS += -lX11
  387. # NOTE: It seems additional libraries are not required any more, latest GLFW just dlopen them
  388. #LDLIBS += -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor
  389. # On Wayland windowing system, additional libraries requires
  390. ifeq ($(USE_WAYLAND_DISPLAY),TRUE)
  391. LDLIBS += -lwayland-client -lwayland-cursor -lwayland-egl -lxkbcommon
  392. endif
  393. # Explicit link to libc
  394. ifeq ($(RAYLIB_LIBTYPE),SHARED)
  395. LDLIBS += -lc
  396. endif
  397. # NOTE: On ARM 32bit arch, miniaudio requires atomics library
  398. LDLIBS += -latomic
  399. endif
  400. endif
  401. ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_RGFW)
  402. ifeq ($(PLATFORM_OS),WINDOWS)
  403. # Libraries for Windows desktop compilation
  404. LDFLAGS += -L..\src
  405. LDLIBS = -lraylib -lgdi32 -lwinmm -lopengl32
  406. endif
  407. ifeq ($(PLATFORM_OS),LINUX)
  408. # Libraries for Debian GNU/Linux desktop compipling
  409. # NOTE: Required packages: libegl1-mesa-dev
  410. LDFLAGS += -L../src
  411. LDLIBS = -lraylib -lGL -lX11 -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor -lm -lpthread -ldl -lrt
  412. # Explicit link to libc
  413. ifeq ($(RAYLIB_LIBTYPE),SHARED)
  414. LDLIBS += -lc
  415. endif
  416. # NOTE: On ARM 32bit arch, miniaudio requires atomics library
  417. LDLIBS += -latomic
  418. endif
  419. ifeq ($(PLATFORM_OS),OSX)
  420. # Libraries for Debian GNU/Linux desktop compiling
  421. # NOTE: Required packages: libegl1-mesa-dev
  422. LDFLAGS += -L../src
  423. LDLIBS = -lraylib -lm
  424. LDLIBS += -framework Foundation -framework AppKit -framework OpenGL -framework CoreVideo
  425. endif
  426. endif
  427. ifeq ($(TARGET_PLATFORM),PLATFORM_DRM)
  428. # Libraries for DRM compiling
  429. # NOTE: Required packages: libasound2-dev (ALSA)
  430. LDLIBS = -lraylib -lGLESv2 -lEGL -lpthread -lrt -lm -lgbm -ldrm -ldl -latomic
  431. endif
  432. ifeq ($(TARGET_PLATFORM),PLATFORM_WEB)
  433. # Libraries for web (HTML5) compiling
  434. LDLIBS = $(RAYLIB_RELEASE_PATH)/libraylib.a
  435. endif
  436. # Define source code object files required
  437. #------------------------------------------------------------------------------------------------
  438. CORE = \
  439. core/core_2d_camera \
  440. core/core_2d_camera_mouse_zoom \
  441. core/core_2d_camera_platformer \
  442. core/core_2d_camera_split_screen \
  443. core/core_3d_camera_first_person \
  444. core/core_3d_camera_free \
  445. core/core_3d_camera_mode \
  446. core/core_3d_camera_split_screen \
  447. core/core_3d_picking \
  448. core/core_automation_events \
  449. core/core_basic_screen_manager \
  450. core/core_basic_window \
  451. core/core_basic_window_web \
  452. core/core_custom_frame_control \
  453. core/core_custom_logging \
  454. core/core_drop_files \
  455. core/core_input_gamepad \
  456. core/core_input_gamepad_info \
  457. core/core_input_gestures \
  458. core/core_input_gestures_web \
  459. core/core_input_keys \
  460. core/core_input_mouse \
  461. core/core_input_mouse_wheel \
  462. core/core_input_multitouch \
  463. core/core_input_virtual_controls \
  464. core/core_loading_thread \
  465. core/core_random_sequence \
  466. core/core_random_values \
  467. core/core_scissor_test \
  468. core/core_smooth_pixelperfect \
  469. core/core_storage_values \
  470. core/core_vr_simulator \
  471. core/core_window_flags \
  472. core/core_window_letterbox \
  473. core/core_window_should_close \
  474. core/core_world_screen
  475. SHAPES = \
  476. shapes/shapes_basic_shapes \
  477. shapes/shapes_bouncing_ball \
  478. shapes/shapes_collision_area \
  479. shapes/shapes_colors_palette \
  480. shapes/shapes_draw_circle_sector \
  481. shapes/shapes_draw_rectangle_rounded \
  482. shapes/shapes_draw_ring \
  483. shapes/shapes_easings_ball_anim \
  484. shapes/shapes_easings_box_anim \
  485. shapes/shapes_easings_rectangle_array \
  486. shapes/shapes_following_eyes \
  487. shapes/shapes_lines_bezier \
  488. shapes/shapes_logo_raylib \
  489. shapes/shapes_logo_raylib_anim \
  490. shapes/shapes_rectangle_scaling \
  491. shapes/shapes_splines_drawing \
  492. shapes/shapes_top_down_lights \
  493. shapes/shapes_rectangle_advanced
  494. TEXTURES = \
  495. textures/textures_background_scrolling \
  496. textures/textures_blend_modes \
  497. textures/textures_bunnymark \
  498. textures/textures_draw_tiled \
  499. textures/textures_fog_of_war \
  500. textures/textures_gif_player \
  501. textures/textures_image_channel \
  502. textures/textures_image_drawing \
  503. textures/textures_image_generation \
  504. textures/textures_image_kernel \
  505. textures/textures_image_loading \
  506. textures/textures_image_processing \
  507. textures/textures_image_rotate \
  508. textures/textures_image_text \
  509. textures/textures_logo_raylib \
  510. textures/textures_mouse_painting \
  511. textures/textures_npatch_drawing \
  512. textures/textures_particles_blending \
  513. textures/textures_polygon \
  514. textures/textures_raw_data \
  515. textures/textures_sprite_anim \
  516. textures/textures_sprite_button \
  517. textures/textures_sprite_explosion \
  518. textures/textures_srcrec_dstrec \
  519. textures/textures_textured_curve \
  520. textures/textures_to_image
  521. TEXT = \
  522. text/text_codepoints_loading \
  523. text/text_draw_3d \
  524. text/text_font_filters \
  525. text/text_font_loading \
  526. text/text_font_sdf \
  527. text/text_font_spritefont \
  528. text/text_format_text \
  529. text/text_input_box \
  530. text/text_raylib_fonts \
  531. text/text_rectangle_bounds \
  532. text/text_unicode \
  533. text/text_writing_anim
  534. MODELS = \
  535. models/models_animation \
  536. models/models_billboard \
  537. models/models_bone_socket \
  538. models/models_box_collisions \
  539. models/models_cubicmap \
  540. models/models_draw_cube_texture \
  541. models/models_first_person_maze \
  542. models/models_geometric_shapes \
  543. models/models_heightmap \
  544. models/models_loading \
  545. models/models_loading_gltf \
  546. models/models_loading_m3d \
  547. models/models_loading_vox \
  548. models/models_mesh_generation \
  549. models/models_mesh_picking \
  550. models/models_orthographic_projection \
  551. models/models_point_rendering \
  552. models/models_rlgl_solar_system \
  553. models/models_skybox \
  554. models/models_waving_cubes \
  555. models/models_yaw_pitch_roll \
  556. models/models_gpu_skinning
  557. SHADERS = \
  558. shaders/shaders_basic_lighting \
  559. shaders/shaders_basic_pbr \
  560. shaders/shaders_custom_uniform \
  561. shaders/shaders_deferred_render \
  562. shaders/shaders_eratosthenes \
  563. shaders/shaders_fog \
  564. shaders/shaders_hot_reloading \
  565. shaders/shaders_hybrid_render \
  566. shaders/shaders_julia_set \
  567. shaders/shaders_lightmap \
  568. shaders/shaders_mesh_instancing \
  569. shaders/shaders_model_shader \
  570. shaders/shaders_multi_sample2d \
  571. shaders/shaders_palette_switch \
  572. shaders/shaders_postprocessing \
  573. shaders/shaders_raymarching \
  574. shaders/shaders_shadowmap \
  575. shaders/shaders_shapes_textures \
  576. shaders/shaders_simple_mask \
  577. shaders/shaders_spotlight \
  578. shaders/shaders_texture_drawing \
  579. shaders/shaders_texture_outline \
  580. shaders/shaders_texture_tiling \
  581. shaders/shaders_texture_waves \
  582. shaders/shaders_write_depth \
  583. shaders/shaders_vertex_displacement
  584. AUDIO = \
  585. audio/audio_mixed_processor \
  586. audio/audio_module_playing \
  587. audio/audio_music_stream \
  588. audio/audio_raw_stream \
  589. audio/audio_sound_loading \
  590. audio/audio_sound_multi \
  591. audio/audio_stream_effects
  592. OTHERS = \
  593. others/easings_testbed \
  594. others/embedded_files_loading \
  595. others/raylib_opengl_interop \
  596. others/raymath_vector_angle \
  597. others/rlgl_compute_shader
  598. ifeq ($(TARGET_PLATFORM), PLATFORM_DESKTOP_GFLW)
  599. OTHERS += others/rlgl_standalone
  600. endif
  601. CURRENT_MAKEFILE = $(lastword $(MAKEFILE_LIST))
  602. # Define processes to execute
  603. #------------------------------------------------------------------------------------------------
  604. # Default target entry
  605. all: $(CORE) $(SHAPES) $(TEXT) $(TEXTURES) $(MODELS) $(SHADERS) $(AUDIO) $(OTHERS)
  606. core: $(CORE)
  607. shapes: $(SHAPES)
  608. textures: $(TEXTURES)
  609. text: $(TEXT)
  610. models: $(MODELS)
  611. shaders: $(SHADERS)
  612. audio: $(AUDIO)
  613. others: $(OTHERS)
  614. # Generic compilation pattern
  615. # NOTE: Examples must be ready for Android compilation!
  616. %: %.c
  617. ifeq ($(TARGET_PLATFORM),PLATFORM_ANDROID)
  618. $(MAKE) -f Makefile.Android PROJECT_NAME=$@ PROJECT_SOURCE_FILES=$<
  619. else ifeq ($(TARGET_PLATFORM),PLATFORM_WEB)
  620. $(MAKE) -f Makefile.Web $@
  621. else
  622. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) -D$(TARGET_PLATFORM)
  623. endif
  624. # Clean everything
  625. clean:
  626. ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_GLFW)
  627. ifeq ($(PLATFORM_OS),WINDOWS)
  628. del *.o *.exe /s
  629. endif
  630. ifeq ($(PLATFORM_OS),BSD)
  631. find . -type f -perm -ugo+x -delete
  632. rm -fv *.o
  633. endif
  634. ifeq ($(PLATFORM_OS),LINUX)
  635. find . -type f -executable -delete
  636. rm -fv *.o
  637. endif
  638. ifeq ($(PLATFORM_OS),OSX)
  639. find . -type f -perm +ugo+x -delete
  640. rm -f *.o
  641. endif
  642. endif
  643. ifeq ($(TARGET_PLATFORM),PLATFORM_DRM)
  644. find . -type f -executable -delete
  645. rm -fv *.o
  646. endif
  647. ifeq ($(TARGET_PLATFORM),PLATFORM_WEB)
  648. ifeq ($(PLATFORM_OS),WINDOWS)
  649. del *.wasm *.html *.js *.data
  650. else
  651. rm -f */*.wasm */*.html */*.js */*.data
  652. endif
  653. endif
  654. @echo Cleaning done