$ show bkaradzic/GENie
GENie is a build system generator that creates native project files (Makefile, Visual Studio, Xcode, Ninja, etc.) from Lua-based project descriptions. It embeds Lua 5.3.0 as its scripting engine and uses a hierarchical configuration system (solution/project/platform/configuration) to manage build settings. The tool processes user-defined Lua scripts (typically premake4.lua) to generate tool-specific build files through registered actions. Architecture consists of a C host layer handling platform abstractions, Lua modules for core functionality (solution/project/config management, action/option system), toolchain-specific compilers/linkers, and generator actions for each build system. Key entry points are src/host/premake_main.c (main) and the embedded Lua API. Data flow involves: CLI args → Lua state initialization → user script execution → action-specific file generation. External dependencies are limited to system libc and platform APIs; Lua is fully embedded.
The LLM identified 5 files worth highlighting for reuse:
Implements configuration baking process that merges settings from solution/project/platform/configuration scopes, resolves project dependencies, and deduplicates output directories. Demonstrates non-obvious skill in handling complex inheritance chains with keyword-based scoping and post-processing logic. Self-contained with minimal dependencies (base modules only) and reusable in any configuration system requiring hierarchical overrides.
Provides cross-platform path manipulation functions (join, split, normalize, make relative/absolute) with consistent behavior across Windows and POSIX. Isolated module with no internal dependencies beyond base/string.lua. Represents a well-crafted abstraction layer that solves the recurring problem of platform-specific path handling in build systems. Could be extracted for use in any Lua project needing portable filesystem operations.
Extends Lua's table library with useful functions like insertflat (flatten and insert), union, intersection, difference, and contains. Implements common set operations and table manipulations missing from standard Lua. Self-contained, dependency-free, and demonstrates practical utility for build configuration processing. Reusable in any Lua project requiring advanced table operations beyond the standard library.
Defines the action registration system that allows build system generators (like vs2010, xcode15, ninja) to be added as plugins. Actions register themselves via newaction() and are looked up by name at runtime. Demonstrates clean plugin architecture with clear separation between core framework and extensions. Minimal coupling (depends only on base/globals.lua) and reusable for any tool needing dynamic command registration.
Implements GCC toolchain interface translating common build settings (includedirs, links, flags) into compiler-specific command-line arguments. Follows consistent interface (gettoolset, getcflags, getldflags, etc.) used by all toolchain modules. Isolated and self-contained, demonstrating the strategy pattern for compiler abstraction. Represents a reusable pattern for adding new toolchains with minimal boilerplate.