Macoy Madson 8 months ago
parent
commit
3873a4cf3c
  1. 2
      ReadMe.org
  2. 63
      src/Raylib.cake

2
ReadMe.org

@ -109,6 +109,7 @@ Here are the known compatibility results, where blank means untested/unknown:
| OpenGL.cake | Yes | No[1] | Yes | |
| ProfilerAutoInstrument.cake | Yes | Yes | Yes | Yes |
| ProfilerNull.cake | Yes | Yes | Yes | Yes |
| Raylib.cake | Yes | | | |
| SDL.cake | Yes | | Yes | |
| STB.cake | Yes | Yes | Yes | Yes |
| TaskSystem.cake | Yes | | Yes | |
@ -134,6 +135,7 @@ The following modules will automatically download their dependencies if missing:
- Ogre.cake
- OgreInitialize.cake
- OpenGL.cake
- Raylib.cake
- SDL.cake
- STB.cake
- TaskSystem.cake

63
src/Raylib.cake

@ -0,0 +1,63 @@
;; Raylib: a game programming library
(add-cakelisp-search-directory "Dependencies/cakelisp/runtime")
(import "CHelpers.cake" "BuildTools.cake" "Dependencies.cake")
(export-and-evaluate
(add-c-search-directory-module "Dependencies/raylib/src")
(c-import "raylib.h"))
(comptime-cond
('auto-test
(defun test--raylib (&return int)
(InitWindow 800 450 "raylib [core] example - basic window")
(while (not (WindowShouldClose))
(BeginDrawing)
(ClearBackground RAYWHITE)
(DrawText "Congrats! You created your first window!" 190 200 20 LIGHTGRAY)
(EndDrawing))
(CloseWindow)
(return 0))))
;;
;; Building
;;
(defun-comptime build-raylib (manager (& ModuleManager) module (* Module) &return bool)
;; Already built?
;; We could enhance this by checking for modifications, but that's pretty rare
(when (and (fileExists "cakelisp_cache/RaylibBuild/raylib/libraylib.a"))
(return true))
(Log "Raylib: Building via Configure and Make\n")
(var raylib-output-dir (* (const char)) "cakelisp_cache/RaylibBuild")
(makeDirectory raylib-output-dir)
(run-process-sequential-or
("cmake" "../../Dependencies/raylib" :in-directory raylib-output-dir)
(Log "failed at Raylib configure step. This requires a sh/bash-style shell to execute.")
(return false))
(run-process-sequential-or
("make" "--jobs=8" :in-directory raylib-output-dir)
(Log "failed at Raylib make. This tool requires Makefile support.")
(return false))
;; One final to check to ensure everything's good to go
(unless (fileExists "cakelisp_cache/RaylibBuild/raylib/libraylib.a")
(Log
"error: Raylib build sequence completed, but files are not where expected. Is there an issue
with the configuration?\nFile expected:\n\tcakelisp_cache/RaylibBuild/raylib/libraylib.a\n")
(return false))
(return true))
(add-compile-time-hook-module pre-build build-raylib)
(add-static-link-objects "cakelisp_cache/RaylibBuild/raylib/libraylib.a")
(add-dependency-git-submodule
clone-raylib
"https://github.com/raysan5/raylib.git"
"Dependencies/raylib")
Loading…
Cancel
Save