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.

39 lines
2.3 KiB

(set-cakelisp-option cakelisp-src-dir "Dependencies/cakelisp/src")
(add-cakelisp-search-directory "Dependencies/cakelisp/runtime")
(import &comptime-only "ComptimeHelpers.cake" "BuildTools.cake")
;; Define 'Dependencies-Clone-Only to clone only - useful if you don't want to or cannot use git
;; submodules. For example, gamelib/test clones so I don't need to keep removing the test Dependencies.
;; TODO Pitfall: This will pull master, which we might not know works. We need to specify a branch
(defmacro add-dependency-git-submodule (hook-name symbol repository-url string output-directory string)
(tokenize-push output
(defun-comptime (token-splice hook-name) (manager (& ModuleManager) module (* Module) &return bool)
(unless (fileExists (token-splice output-directory))
(Logf "%s: Cloning from %s. Will NOT be tracked as a submodule\\n\\n"
(token-splice output-directory) (token-splice repository-url))
("git" "clone" (token-splice repository-url) (token-splice output-directory))
(Logf "error: failed to clone %s\\n" (token-splice output-directory))
(return false)))
(Logf "%s: Automatically adding as submodule from %s\\n\\n"
(token-splice output-directory) (token-splice repository-url))
("git" "submodule" "add" (token-splice repository-url) (token-splice output-directory))
(Logf "error: failed to add %s as a git submodule dependency. Are you in a git repository?\\n"
(token-splice output-directory))
(return false))))
;; Initialize its submodules, in case it has them
("git" "submodule" "update" "--init" "--recursive" :in-directory (token-splice output-directory))
(Logf "error: failed to initialize submodules belonging to %s\\n"
(token-splice output-directory))
(return false)))
(return true))
;; High priority so that it comes before dependency build steps
(add-compile-time-hook-module pre-build (token-splice hook-name) :priority-increase 10))
(return true))