GameLib is a collection of libraries for creating applications in Cakelisp.
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.

63 lines
2.1 KiB

;; Raylib: a game programming library
(add-cakelisp-search-directory "Dependencies/cakelisp/runtime")
(import "CHelpers.cake" "BuildTools.cake" "Dependencies.cake")
(add-c-search-directory-module "Dependencies/raylib/src")
(c-import "raylib.h"))
(defun test--raylib (&return int)
(InitWindow 800 450 "raylib [core] example - basic window")
(while (not (WindowShouldClose))
(ClearBackground RAYWHITE)
(DrawText "Congrats! You created your first window!" 190 200 20 LIGHTGRAY)
(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)
("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))
("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")
"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")