Skip to content

oreyg/hqcodegen_demoproject

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HQCodeGen Demo

Standalone demo and test project for HQCodeGen — the code generation tool from the Hokku engine. Demonstrates compile-time reflection, enum introspection, and archive-based serialization without requiring the full engine.

Contents

  • CodeGen/ — Submodule containing the code generator, standalone Introspect library, Inja templates, and CMake helpers
  • Demo/ — Demo application that registers reflected types, queries metadata, and serializes with PrintArchive/CountArchive
  • Tests/ — Test suites validating CodeGen output (TestA: reflection, TestB: conflicts, TestC: inheritance)
  • Vendor/ — FindLibClang CMake module and Conan dependency list

Prerequisites

  • CMake 3.28+
  • C++23 compiler (MSVC v143+ or Clang 17+)
  • LLVM/Clang 15-17 (libclang)
  • [Optional] Conan 2.x (pip install conan)

Setup

1. Clone with submodules

git clone --recursive <repo-url>

2. Install dependencies

cd Vendor
conan install . -of Conan -b missing -s build_type=Release -c tools.cmake.cmaketoolchain:generator=Ninja

3. Configure environment (Windows)

Conan\conanvcvars.bat

4. Build

cmake -S . -B Build -G Ninja -DCMAKE_BUILD_TYPE=Debug -DCMAKE_TOOLCHAIN_FILE=Conan/conan_toolchain.cmake
cmake --build Build

5. Run

Build/Demo.exe
ctest --test-dir Build

CMake options

Option Default Description
HQ_BUILD_DEMO ON Build the demo application
HQ_BUILD_TESTS ON Build the test suite (requires doctest)
HQ_GLOBAL_TYPES ON Expose hq:: type aliases (c8, u32, f32, ...) in global namespace
HQ_USING_CONAN auto Auto-detected from toolchain file; set manually if detection fails

Limitations

  • This project deliberately uses single-file parsing (does not expand includes), adding support for proper parsing is a TODO
  • Defines that are shadowing C++ keywords would not be reflected (for example '#define NMSPC namespace'), this is a TODO
  • [[Reflect]] attributes require explicit template instantiation of a Reflect function (with specific Archive types), see 'codegen.cpp_template.txt' for reference

About

Flexible Code Generator for C++ (tests and demoproject)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors