(WIP) Restructuring of the project, rework of addons.

This commit is contained in:
2025-09-20 12:16:54 +02:00
parent 7b2e5c7432
commit 5c17999cdf
29 changed files with 1238 additions and 56 deletions

View File

@@ -0,0 +1,50 @@
Import('env')
env.ModuleConfig(
name = 'Test',
description = 'Test Module',
cxx_namespace = 'tst'
)
src_files = Split("""
main.cpp
test.cpp
test.generated.cpp
""")
# env.IncludeGen(src_files,
# template=env.File('#templates/header.jinja'),
# include_filter=r'.*\.refl.hpp'
# )
# env.CodeGen('GenSource', inputs = [], template=env.File('#templates/source.jinja'), )
# env.CodeGen(
# target = 'test.generated.cpp',
# template = env.File('#templates/source.jinja'),
# inputs = {'source': 'test.cpp'}
# )
ast_json = env.AstJson(
target = env.File('test.json'),
source = 'test.hpp'
)
env.Default(ast_json)
ast_hpp = env.AstJinja(
target = env.File('test.refl.hpp'),
source = env.File('test.hpp'),
template = env.File('#templates/header.jinja')
)
prog_app = env.Program(
name = 'Test',
target = env['BIN_DIR'] + '/test',
source = src_files,
dependencies = {
}
)
env.Requires(prog_app.target, ast_hpp)
env.Default(prog_app)
Return('env')

View File

@@ -0,0 +1,8 @@
#include "./test.hpp"
int main(int, char**)
{
tst::printHelloWorld(100);
return 0;
}

View File

@@ -0,0 +1,12 @@
#include "./test.hpp"
#include <print>
namespace tst
{
void printHelloWorld(int param) noexcept
{
std::println("Hello World! Param is {}.", param);
}
}

View File

@@ -0,0 +1,33 @@
#pragma once
#include <vector>
#if __has_include("test.refl.hpp")
#include "test.refl.hpp"
#endif
namespace tst
{
static constexpr int kAnnotVal = 17;
class MyClass
{
private:
std::vector<int> mInts;
public:
MyClass();
#if defined(__clang__)
[[clang::annotate("reflect", "yes, please", kAnnotVal)]]
#endif
int getVal();
void setVal(int val);
static constexpr int kVal = 1;
};
}
namespace tst
{
void printHelloWorld(int param) noexcept;
}