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.
 
 
 
 
 
 

87 lines
3.2 KiB

(set-cakelisp-option cakelisp-src-dir "Dependencies/cakelisp/src")
(add-cakelisp-search-directory "Dependencies/cakelisp/runtime")
(import "BuildTools.cake" "ComptimeHelpers.cake" "CHelpers.cake" "Cakelisp.cake")
;; We don't actually test anything here; we use comptime to run the tests
(defun main (&return int)
(return 0))
(defmacro gamelib-run-test (test-name string files array)
(tokenize-push output
(scope
(var files ([] (* (const char))) (token-splice files))
(Logf "\n===============\n%s\n\n" (token-splice test-name))
(unless (cakelisp-evaluate-build-execute-files files (array-size files))
(Logf "error: test %s failed\n" (token-splice test-name))
(return false))
(Logf "\n%s succeeded\n" (token-splice test-name))))
(return true))
(defmacro gamelib-build (test-name string files array)
(tokenize-push output
(scope
(var files ([] (* (const char))) (token-splice files))
(Logf "\n===============\nBuild %s\n\n" (token-splice test-name))
(unless (cakelisp-evaluate-build-files files (array-size files))
(return false))))
(return true))
(defun-comptime run-tests (manager (& ModuleManager) module (* Module) &return bool)
(var platform-config (* (const char))
(comptime-cond
('Windows
"src/Config_Windows.cake")
(true
"src/Config_Linux.cake")))
(var test-minimal bool true)
;; (var test-minimal bool false)
;; (var test-opengl-only bool true)
(var test-opengl-only bool false)
(var test-ogre bool false)
;; (var test-ogre bool true)
(cond
(test-minimal
(gamelib-run-test
"Auto Test (somewhat minimal)"
(array platform-config
"../src/AutoTest.cake" "../src/Introspection.cake"
"../src/Dictionary.cake" "../src/DynamicArray.cake"
"../src/TaskSystem.cake" "../src/Image.cake" "../src/DataBundle.cake")))
(test-opengl-only
(gamelib-run-test
"Auto Test (OpenGL only)"
(array platform-config
"../src/AutoTest.cake" "../src/OpenGL.cake")))
(true ;; Test everything, which requires user input and takes a while
(gamelib-run-test
"Auto Test"
(array platform-config
"../src/AutoTest.cake" "../src/SDL.cake" "../src/Math.cake"
"../src/Aubio.cake" "../src/ImGui.cake" "../src/Dictionary.cake"
"../src/DynamicArray.cake" "../src/Introspection.cake" "../src/OpenGL.cake"
"../src/Tracy.cake" "../src/TaskSystem.cake" "../src/Image.cake"
"../src/DataBundle.cake" "../src/ProfilerAutoInstrument.cake"))
(when test-ogre
(gamelib-run-test "Ogre" (array platform-config "src/OgreApp.cake"))
(gamelib-run-test "SDL Ogre" (array platform-config "src/SDLOgreApp.cake"))
(gamelib-run-test "Hot-loader"
(array platform-config "src/Loader.cake"))
(gamelib-build "Vocal Game (hot reload)"
(array platform-config "src/MakeHotReload.cake" "src/VocalGame.cake"))
(gamelib-run-test "Vocal Game (no reload)"
(array platform-config "src/NoHotReload.cake" "src/VocalGame.cake")))))
(Log "\nGameLibTests: All tests succeeded!\n")
(return true))
(add-compile-time-hook-module pre-build run-tests)