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.
67 lines
2.5 KiB
67 lines
2.5 KiB
;; Export libraries included? Only if static linked
|
|
|
|
;; Make sure HotReloading.cake interface can be found by lib
|
|
;; TODO: This shouldn't be necessary because the loader can find C++ mangled types for us. I only
|
|
;; have to do this here because HotReloadingCodeModifier imports the header with c-linkage on
|
|
;; I would need an option to disable c linkage on that file in order to make it work
|
|
(set-cakelisp-option use-c-linkage true)
|
|
(add-build-config-label "HotLoader")
|
|
|
|
(set-cakelisp-option executable-output "Loader")
|
|
|
|
;; TODO: Tracy gets confused when the reloaded lib has its own version of Tracy
|
|
(ignore
|
|
(add-cakelisp-search-directory "src")
|
|
(import "Tracy.cake"))
|
|
|
|
;; We only want the shared libraries these use
|
|
;; (import "src/Ogre.cake"
|
|
;; "src/SDL.cake")
|
|
|
|
(add-cakelisp-search-directory "Dependencies/cakelisp/runtime")
|
|
(import "Options.cake")
|
|
;; TODO: Should this happen automatically, because import automatically adds current working dir?
|
|
;; Should it add working dir?
|
|
(add-c-search-directory-module ".")
|
|
|
|
(import "HotReloading.cake")
|
|
|
|
(c-import "stdio.h")
|
|
|
|
(defun main (&return int)
|
|
(def-function-signature reload-entry-point-signature (&return bool))
|
|
(var hot-reload-entry-point-func reload-entry-point-signature null)
|
|
(register-function-pointer (type-cast (addr hot-reload-entry-point-func) (* (* void)))
|
|
;; TODO Support name conversion at runtime (conversion requires tokens)
|
|
"reloadableEntryPoint")
|
|
|
|
(unless (do-hot-reload)
|
|
(printf "error: failed to load\n")
|
|
(hot-reload-clean-up)
|
|
(return 1))
|
|
|
|
(while (hot-reload-entry-point-func)
|
|
(unless (do-hot-reload)
|
|
(printf "error: failed to hot-reload\n")
|
|
(hot-reload-clean-up)
|
|
(return 1)))
|
|
(hot-reload-clean-up)
|
|
(return 0))
|
|
|
|
;;
|
|
;; Libraries
|
|
;;
|
|
|
|
;; TODO: Is this necessary to include? (will they be unloaded when the hot-lib is unloaded,
|
|
;; losing their state?)
|
|
;; TODO: Add debug version
|
|
(add-library-search-directory "Dependencies/ogre-next/build/Debug/lib" "Dependencies/SDL/buildSDLBuild/lib")
|
|
(add-library-dependency "OgreHlmsPbs_d"
|
|
"OgreHlmsUnlit_d"
|
|
"OgreMain_d"
|
|
"OgreOverlay_d"
|
|
"SDL2")
|
|
;; TODO: Relative path is going to break for sure
|
|
(add-library-runtime-search-directory "."
|
|
"../Dependencies/ogre-next/build/Debug/lib"
|
|
"../Dependencies/SDL/buildSDLBuild/lib")
|
|
|