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.
74 lines
2.4 KiB
74 lines
2.4 KiB
;; Raylib: a game programming library
|
|
(add-cakelisp-search-directory "Dependencies/cakelisp/runtime")
|
|
(import "CHelpers.cake" "BuildTools.cake" "Dependencies.cake")
|
|
|
|
(comptime-define-symbol 'STBImageDefinedInRaylib)
|
|
|
|
(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"
|
|
;; Enable file formats raylib normally disables, because if raylib defines stb image, we use
|
|
;; the same definitions.
|
|
"-DCUSTOMIZE_BUILD=ON" "-DSUPPORT_FILEFORMAT_JPG=ON"
|
|
"-DSUPPORT_FILEFORMAT_BMP=ON" "-DSUPPORT_FILEFORMAT_TGA=ON"
|
|
"../../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")
|
|
|
|
(comptime-cond
|
|
('Unix
|
|
(add-library-dependency "dl" "pthread")))
|
|
|
|
(add-dependency-git-submodule
|
|
clone-raylib
|
|
"https://github.com/raysan5/raylib.git"
|
|
"Dependencies/raylib")
|
|
|
|
|