|
|
@ -0,0 +1,48 @@ |
|
|
|
(set-cakelisp-option cakelisp-src-dir "Dependencies/cakelisp/src") |
|
|
|
|
|
|
|
(import &comptime-only "Macros.cake") |
|
|
|
|
|
|
|
(c-import "Tracy.hpp") |
|
|
|
|
|
|
|
;; TODO: Linux only |
|
|
|
(c-import "unistd.h") |
|
|
|
|
|
|
|
(defun test-tracy-main (&return int) |
|
|
|
(ZoneScopedN "main") |
|
|
|
|
|
|
|
(while (not (on-call (call (in tracy GetProfiler)) IsConnected)) |
|
|
|
(ZoneScopedN "wait for profiler") |
|
|
|
(sleep 1)) |
|
|
|
|
|
|
|
(var i int 0) |
|
|
|
(while (< i 100000) |
|
|
|
(ZoneScopedN "hot loop") |
|
|
|
(sleep 1) |
|
|
|
(incr i)) |
|
|
|
(return 0)) |
|
|
|
|
|
|
|
;; TODO: Any file which includes Tracy needs these |
|
|
|
;; For now, an easy way to build files which include necessary headers |
|
|
|
(defmacro module-use-tracy-build-options () |
|
|
|
(tokenize-push output |
|
|
|
(set-module-option build-time-compiler "/usr/bin/clang++") |
|
|
|
;; Include cakelisp source for DynamicLoader.hpp |
|
|
|
(set-module-option build-time-compile-arguments |
|
|
|
"-Werror" "-Wall" "-Wextra" "-Wno-unused-parameter" "-Wno-unused-variable" |
|
|
|
"-c" 'source-input "-o" 'object-output "-fPIC" |
|
|
|
"-DTRACY_ENABLE" "-IDependencies/tracy")) |
|
|
|
(return true)) |
|
|
|
|
|
|
|
(module-use-tracy-build-options) |
|
|
|
|
|
|
|
(add-cpp-build-dependency "../Dependencies/tracy/TracyClient.cpp") |
|
|
|
|
|
|
|
(defun-comptime tracy-link-hook (manager (& ModuleManager) |
|
|
|
linkCommand (& ProcessCommand) |
|
|
|
linkTimeInputs (* ProcessCommandInput) numLinkTimeInputs int |
|
|
|
&return bool) |
|
|
|
(command-add-string-argument "-lpthread") |
|
|
|
(command-add-string-argument "-ldl") |
|
|
|
(return true)) |
|
|
|
|
|
|
|
(add-compile-time-hook pre-link tracy-link-hook) |