This commit is contained in:
ouczbs 2024-07-27 15:03:10 +08:00
parent 5b5c35a5ef
commit b17f3ef1d3
9 changed files with 13 additions and 15 deletions

View File

@ -1,6 +1,5 @@
#include "serde.h"
namespace gen {
#ifdef API_DEBUG
template<typename T>
inline bool JsonRead(yyjson_val* node, const T& t) {
if (!node) return false;
@ -10,10 +9,6 @@ namespace gen {
inline yyjson_mut_val* JsonWrite(yyjson_mut_doc* doc, const T& t) {
return JsonSerde<T>::Write(doc, &t);
}
#else
#define JsonRead(node, t) if(node)JsonSerde<decltype(t)>::Read(node, &t)
#define JsonWrite(doc, t) JsonSerde<decltype(t)>::Write(doc, &t)
#endif
template<typename T>
struct JsonSerde<T, std::enable_if_t<refl::is_meta_v<T>>> {
inline static bool Read(yyjson_val* val, const void* ptr) {

View File

@ -22,4 +22,4 @@ namespace api {
{ \
return new ModuleImplClass(); \
}
#define MODULE_DEPENDENCY(name, opt)
#define MODULE_DEPENDENCY(...)

View File

@ -1,6 +1,7 @@
#pragma once
#include "field.h"
namespace gen {
using refl::real_type_t;
using pmr::CName;
using pmr::FName;
using pmr::string_hash;

View File

@ -14,7 +14,7 @@ function find_my_program(name, sdkdir, use_next)
local sdkdir = sdkdir or path.join(os.projectdir(), "tools")
local exedir = find_exe_dir()
local tool = find_tool(name, {pathes = {sdkdir, exedir, "/usr/local/bin"}})
local prog = tool and tool.program or find_program(name, {pathes = {sdkdir,exedir, "/usr/local/bin"}})
local prog = tool and tool.program or find_program(name, {pathes = {sdkdir, exedir, "/usr/local/bin"}})
prog = prog or find_file(name, {sdkdir, exedir})
if (prog == nil) then
if os.host() ~= "windows" then

View File

@ -35,6 +35,7 @@ function _listen_gen_file(target, batch, template, macro, define)
)
end
function gen(target)
if is_mode("release") then return end
local gen_batch = target:data("codegen.batch")
if not gen_batch then
return

View File

@ -1,7 +1,6 @@
rule("c++.codegen")
set_extensions(".inl")
after_load(function (target)
if not is_mode("debug") then return end
import("make_gen")
local headerfiles = {}
local files = target:extraconf("rules", "c++.codegen", "files")
@ -14,6 +13,5 @@ rule("c++.codegen")
make_gen(target, headerfiles)
end)
on_config(function (target)
if not is_mode("debug") then return end
import("make_gen").gen(target)
end)

View File

@ -1,7 +1,7 @@
import("core.project.depend")
function cmd_compile(target, genfile, file)
if is_mode("release") then return end
import("find_sdk")
print("find make_plugin", is_mode("debug"))
local plugin = find_sdk.find_my_program("make_plugin")
if not plugin then return end
print("cmd_compile plugin", genfile, file)

View File

@ -1,7 +1,6 @@
rule("engine.plugin")
set_extensions(".h")
on_load(function (target)
if not is_mode("debug") then return end
import("make_plugin")
local file = target:extraconf("rules", "engine.plugin", "file")
make_plugin(target, file or "module.h")

View File

@ -1,5 +1,9 @@
rule("engine.tool")
-- after_build(function (target)
-- -- do nothing
-- --print("after_install", target:targetfile())
-- end)
after_build(function (target)
local tooldir = path.join(os.projectdir(), "tools", target:name())
if not os.isdir(tooldir) then
os.mkdir(tooldir)
end
local exefile = target:targetfile()
os.cp(exefile, path.join(tooldir, path.filename(exefile)))
end)