(WIP) Restructuring of the project, rework of addons.
This commit is contained in:
50
test/codegen/private/test/SModule
Normal file
50
test/codegen/private/test/SModule
Normal 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')
|
||||
8
test/codegen/private/test/main.cpp
Normal file
8
test/codegen/private/test/main.cpp
Normal file
@@ -0,0 +1,8 @@
|
||||
|
||||
#include "./test.hpp"
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
tst::printHelloWorld(100);
|
||||
return 0;
|
||||
}
|
||||
12
test/codegen/private/test/test.cpp
Normal file
12
test/codegen/private/test/test.cpp
Normal file
@@ -0,0 +1,12 @@
|
||||
|
||||
#include "./test.hpp"
|
||||
|
||||
#include <print>
|
||||
|
||||
namespace tst
|
||||
{
|
||||
void printHelloWorld(int param) noexcept
|
||||
{
|
||||
std::println("Hello World! Param is {}.", param);
|
||||
}
|
||||
}
|
||||
33
test/codegen/private/test/test.hpp
Normal file
33
test/codegen/private/test/test.hpp
Normal 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;
|
||||
}
|
||||
Reference in New Issue
Block a user