vt: expose optimize mode in build info API

Add GHOSTTY_BUILD_INFO_OPTIMIZE to query the Zig optimization mode
(debug, release safe/small/fast) the library was compiled with. This
reads directly from builtin.mode at comptime so it requires no build
system plumbing.
This commit is contained in:
Mitchell Hashimoto
2026-03-21 07:31:33 -07:00
parent abefe5b40c
commit 155bd3a58e
2 changed files with 46 additions and 0 deletions

View File

@@ -31,6 +31,16 @@
extern "C" {
#endif
/**
* Build optimization mode.
*/
typedef enum {
GHOSTTY_OPTIMIZE_DEBUG = 0,
GHOSTTY_OPTIMIZE_RELEASE_SAFE = 1,
GHOSTTY_OPTIMIZE_RELEASE_SMALL = 2,
GHOSTTY_OPTIMIZE_RELEASE_FAST = 3,
} GhosttyOptimizeMode;
/**
* Build info data types that can be queried.
*
@@ -60,6 +70,13 @@ typedef enum {
* Output type: bool *
*/
GHOSTTY_BUILD_INFO_TMUX_CONTROL_MODE = 3,
/**
* The optimization mode the library was built with.
*
* Output type: GhosttyOptimizeMode *
*/
GHOSTTY_BUILD_INFO_OPTIMIZE = 4,
} GhosttyBuildInfo;
/**