Skip to content

v2.pref #

fn file_has_incompatible_os_suffix #

fn file_has_incompatible_os_suffix(file string, current_os string) bool

file_has_incompatible_os_suffix reports whether file is specialized for a different OS.

fn new_preferences #

fn new_preferences() Preferences

fn new_preferences_from_args #

fn new_preferences_from_args(args []string) Preferences

new_preferences_from_args parses full args list including option values

fn new_preferences_using_options #

fn new_preferences_using_options(options []string) Preferences

enum Arch #

enum Arch {
	auto // Auto-detect based on OS
	x64
	arm64
}

enum Backend #

enum Backend {
	v      // V source output (default)
	eval   // AST interpreter
	cleanc // Clean C backend (AST -> C)
	c      // SSA -> C backend
	x64    // Native x64/AMD64 backend
	arm64  // Native ARM64 backend
}

struct Preferences #

struct Preferences {
pub mut:
	debug                 bool
	verbose               bool
	skip_genv             bool
	skip_builtin          bool
	skip_imports          bool
	skip_type_check       bool // Skip type checking phase (for backends that don't need it yet)
	no_parallel           bool = true // default to sequential parsing until parallel is fixed
	no_cache              bool // Disable build cache
	no_markused           bool // Disable markused stage and dead-function pruning
	show_cc               bool // Print C compiler command(s)
	stats                 bool // Print extended statistics
	print_parsed_files    bool // Print all parsed files grouped by full/.vh parse mode
	keep_c                bool // Keep generated C file after compilation
	use_context_allocator bool // Use context allocator for heap allocations (enables profiling)
	is_shared_lib         bool // Compile to shared library (.dylib/.so) for live reload
	no_optimize           bool // -O0: skip SSA optimization (mem2reg, phi elimination)
	backend               Backend
	arch                  Arch = .auto
	output_file           string
	printfn_list          []string // List of function names whose generated C source should be printed
	user_defines          []string // User-defined comptime flags via -d <name>
	hot_fn                string   // Extract raw machine code for this function only (hot reload)
	eval_runtime_args     []string // Program argv exposed to the eval backend
pub:
	vroot         string = detect_vroot()
	vmodules_path string = os.vmodules_dir()
}

fn (Preferences) get_effective_arch #

fn (p &Preferences) get_effective_arch() Arch

get_effective_arch returns the architecture to use based on preferences and OS

fn (Preferences) get_module_path #

fn (p &Preferences) get_module_path(mod string, importing_file_path string) string

check for relative and then vlib

fn (Preferences) get_vlib_module_path #

fn (p &Preferences) get_vlib_module_path(mod string) string