welder 0.1.0
Bindings for annotated C++ types, from C++26 reflection
Loading...
Searching...
No Matches
module.hpp File Reference

Full-automation entry point for the LuaCATS stub rod: the WELDER_LUACATS_MAIN generator-main() macro. More...

#include <fstream>
#include <iostream>
#include <welder/rods/lua/luacats/rod.hpp>
Include dependency graph for module.hpp:

Go to the source code of this file.

Macros

#define WELDER_LUACATS_MAIN(ns)
 Define a main() that emits the LuaCATS stub for namespace ns.

Detailed Description

Full-automation entry point for the LuaCATS stub rod: the WELDER_LUACATS_MAIN generator-main() macro.

Include this (instead of rod.hpp) in a stub-generator TU so the whole executable is one macro line; welder_luacats_generate_stub() (CMake) builds and runs it into <name>.lua.

Definition in file module.hpp.

Macro Definition Documentation

◆ WELDER_LUACATS_MAIN

#define WELDER_LUACATS_MAIN ( ns)
Value:
int main(int argc, char** argv) { \
if (argc > 1) { \
::std::ofstream welder_out_{argv[1]}; \
::welder::rods::luacats::rod::generate<^^ns>(welder_out_); \
} else { \
::welder::rods::luacats::rod::generate<^^ns>(::std::cout); \
} \
return 0; \
}

Define a main() that emits the LuaCATS stub for namespace ns.

Writes to the file named by the first command-line argument, or to stdout when none is given. The build-time analogue of a backend entry point: a generator executable links this and welder_luacats_generate_stub runs it with the output path to produce <ns>.lua.

Parameters
nsthe top-level namespace / module name token.

Definition at line 23 of file module.hpp.