retrieve tracy path from environment variable during build
This commit is contained in:
parent
1f893385ef
commit
3895e252f9
13
build.c
13
build.c
@ -327,6 +327,10 @@ void OnBuild(StringList cli_args)
|
||||
* Read args
|
||||
* ========================== */
|
||||
|
||||
String tracy_env_var_name = Lit("TRACY_SRC_PATH");
|
||||
String tracy_src_dir_path = OS_GetEnvVar(&perm, tracy_env_var_name);
|
||||
String tracy_public_dir_path = StringF(&perm, Lit("%F%F"), FmtStr(tracy_src_dir_path), FmtStr(Lit("/public")));
|
||||
String tracy_include_path = StringF(&perm, Lit("%F%F"), FmtStr(tracy_public_dir_path), FmtStr(Lit("/tracy/TracyC.h")));
|
||||
{
|
||||
typedef enum ArgState {
|
||||
ArgState_None,
|
||||
@ -583,6 +587,13 @@ void OnBuild(StringList cli_args)
|
||||
}
|
||||
StringListAppend(&perm, &compile_args, Lit("-DPROFILING=1"));
|
||||
|
||||
/* Tracy include path */
|
||||
if (tracy_src_dir_path.len == 0 || !OS_DirExists(tracy_src_dir_path)) {
|
||||
Error(StringF(&perm, Lit("Profiling is enabled but tracy directory \"%F\" does not exist (set by environment variable \"%F\")"), FmtStr(tracy_src_dir_path), FmtStr(tracy_env_var_name)));
|
||||
OS_Exit(1);
|
||||
}
|
||||
StringListAppend(&perm, &compile_args, StringF(&perm, Lit("-DTRACY_INCLUDE_PATH=\"%F\""), FmtStr(tracy_include_path)));
|
||||
|
||||
/* Tracy flags */
|
||||
StringListAppend(&perm, &compile_args, Lit("-DTRACY_ENABLE=1"));
|
||||
if (!arg_profiler_sampling) {
|
||||
@ -836,7 +847,7 @@ void OnBuild(StringList cli_args)
|
||||
D_TagList src_files = D_GetDirContents(&perm, src_dir, false);
|
||||
|
||||
if (arg_profiling) {
|
||||
D_Tag tracy_src_dir = D_TagFromPath(&perm, Lit("src/third_party/tracy"), D_TagKind_Dir);
|
||||
D_Tag tracy_src_dir = D_TagFromPath(&perm, tracy_public_dir_path, D_TagKind_Dir);
|
||||
D_TagList tracy_src_files = D_GetDirContents(&perm, tracy_src_dir, true);
|
||||
for (D_TagListNode *n = tracy_src_files.first; n; n = n->next) {
|
||||
D_TagListAppend(&perm, &src_files, n->tag);
|
||||
|
||||
@ -15,8 +15,6 @@
|
||||
#define arena_pop(a, type, dst) arena_pop_struct((a), sizeof(type), dst)
|
||||
#define arena_pop_array(a, type, n, dst) arena_pop_struct((a), sizeof(type) * (n), dst)
|
||||
|
||||
#define arena_base(a) ((u8 *)(a) + ARENA_HEADER_SIZE)
|
||||
|
||||
/* Returns a pointer to where the next allocation would be (at alignment of type).
|
||||
* Equivalent to arena_push but without actually allocating anything or modifying the arena. */
|
||||
#define arena_push_dry(a, type) (type *)(_arena_push_dry((a), alignof(type)))
|
||||
@ -38,6 +36,11 @@ void arena_decommit_unused_blocks(struct arena *arena);
|
||||
void arena_set_readonly(struct arena *arena);
|
||||
void arena_set_readwrite(struct arena *arena);
|
||||
|
||||
INLINE u8 *arena_base(struct arena *arena)
|
||||
{
|
||||
return (u8 *)arena + ARENA_HEADER_SIZE;
|
||||
}
|
||||
|
||||
INLINE void *arena_push_bytes(struct arena *arena, u64 size, u64 align)
|
||||
{
|
||||
void *p = arena_push_bytes_no_zero(arena, size, align);
|
||||
|
||||
@ -632,7 +632,7 @@ INLINE f64 clamp_f64(f64 v, f64 min, f64 max) { return v < min ? min : v > max ?
|
||||
|
||||
#if PROFILING
|
||||
|
||||
#include "third_party/tracy/tracy/TracyC.h"
|
||||
#include STRINGIZE(TRACY_INCLUDE_PATH)
|
||||
|
||||
#define PROFILING_CAPTURE_FRAME_IMAGE 1
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user