bugfix
This commit is contained in:
parent
5b5c35a5ef
commit
b17f3ef1d3
@ -1,6 +1,5 @@
|
|||||||
#include "serde.h"
|
#include "serde.h"
|
||||||
namespace gen {
|
namespace gen {
|
||||||
#ifdef API_DEBUG
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
inline bool JsonRead(yyjson_val* node, const T& t) {
|
inline bool JsonRead(yyjson_val* node, const T& t) {
|
||||||
if (!node) return false;
|
if (!node) return false;
|
||||||
@ -10,10 +9,6 @@ namespace gen {
|
|||||||
inline yyjson_mut_val* JsonWrite(yyjson_mut_doc* doc, const T& t) {
|
inline yyjson_mut_val* JsonWrite(yyjson_mut_doc* doc, const T& t) {
|
||||||
return JsonSerde<T>::Write(doc, &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>
|
template<typename T>
|
||||||
struct JsonSerde<T, std::enable_if_t<refl::is_meta_v<T>>> {
|
struct JsonSerde<T, std::enable_if_t<refl::is_meta_v<T>>> {
|
||||||
inline static bool Read(yyjson_val* val, const void* ptr) {
|
inline static bool Read(yyjson_val* val, const void* ptr) {
|
||||||
|
|||||||
@ -22,4 +22,4 @@ namespace api {
|
|||||||
{ \
|
{ \
|
||||||
return new ModuleImplClass(); \
|
return new ModuleImplClass(); \
|
||||||
}
|
}
|
||||||
#define MODULE_DEPENDENCY(name, opt)
|
#define MODULE_DEPENDENCY(...)
|
||||||
@ -1,6 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "field.h"
|
#include "field.h"
|
||||||
namespace gen {
|
namespace gen {
|
||||||
|
using refl::real_type_t;
|
||||||
using pmr::CName;
|
using pmr::CName;
|
||||||
using pmr::FName;
|
using pmr::FName;
|
||||||
using pmr::string_hash;
|
using pmr::string_hash;
|
||||||
|
|||||||
@ -14,7 +14,7 @@ function find_my_program(name, sdkdir, use_next)
|
|||||||
local sdkdir = sdkdir or path.join(os.projectdir(), "tools")
|
local sdkdir = sdkdir or path.join(os.projectdir(), "tools")
|
||||||
local exedir = find_exe_dir()
|
local exedir = find_exe_dir()
|
||||||
local tool = find_tool(name, {pathes = {sdkdir, exedir, "/usr/local/bin"}})
|
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})
|
prog = prog or find_file(name, {sdkdir, exedir})
|
||||||
if (prog == nil) then
|
if (prog == nil) then
|
||||||
if os.host() ~= "windows" then
|
if os.host() ~= "windows" then
|
||||||
|
|||||||
@ -35,6 +35,7 @@ function _listen_gen_file(target, batch, template, macro, define)
|
|||||||
)
|
)
|
||||||
end
|
end
|
||||||
function gen(target)
|
function gen(target)
|
||||||
|
if is_mode("release") then return end
|
||||||
local gen_batch = target:data("codegen.batch")
|
local gen_batch = target:data("codegen.batch")
|
||||||
if not gen_batch then
|
if not gen_batch then
|
||||||
return
|
return
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
rule("c++.codegen")
|
rule("c++.codegen")
|
||||||
set_extensions(".inl")
|
set_extensions(".inl")
|
||||||
after_load(function (target)
|
after_load(function (target)
|
||||||
if not is_mode("debug") then return end
|
|
||||||
import("make_gen")
|
import("make_gen")
|
||||||
local headerfiles = {}
|
local headerfiles = {}
|
||||||
local files = target:extraconf("rules", "c++.codegen", "files")
|
local files = target:extraconf("rules", "c++.codegen", "files")
|
||||||
@ -14,6 +13,5 @@ rule("c++.codegen")
|
|||||||
make_gen(target, headerfiles)
|
make_gen(target, headerfiles)
|
||||||
end)
|
end)
|
||||||
on_config(function (target)
|
on_config(function (target)
|
||||||
if not is_mode("debug") then return end
|
|
||||||
import("make_gen").gen(target)
|
import("make_gen").gen(target)
|
||||||
end)
|
end)
|
||||||
@ -1,7 +1,7 @@
|
|||||||
import("core.project.depend")
|
import("core.project.depend")
|
||||||
function cmd_compile(target, genfile, file)
|
function cmd_compile(target, genfile, file)
|
||||||
|
if is_mode("release") then return end
|
||||||
import("find_sdk")
|
import("find_sdk")
|
||||||
print("find make_plugin", is_mode("debug"))
|
|
||||||
local plugin = find_sdk.find_my_program("make_plugin")
|
local plugin = find_sdk.find_my_program("make_plugin")
|
||||||
if not plugin then return end
|
if not plugin then return end
|
||||||
print("cmd_compile plugin", genfile, file)
|
print("cmd_compile plugin", genfile, file)
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
rule("engine.plugin")
|
rule("engine.plugin")
|
||||||
set_extensions(".h")
|
set_extensions(".h")
|
||||||
on_load(function (target)
|
on_load(function (target)
|
||||||
if not is_mode("debug") then return end
|
|
||||||
import("make_plugin")
|
import("make_plugin")
|
||||||
local file = target:extraconf("rules", "engine.plugin", "file")
|
local file = target:extraconf("rules", "engine.plugin", "file")
|
||||||
make_plugin(target, file or "module.h")
|
make_plugin(target, file or "module.h")
|
||||||
|
|||||||
@ -1,5 +1,9 @@
|
|||||||
rule("engine.tool")
|
rule("engine.tool")
|
||||||
-- after_build(function (target)
|
after_build(function (target)
|
||||||
-- -- do nothing
|
local tooldir = path.join(os.projectdir(), "tools", target:name())
|
||||||
-- --print("after_install", target:targetfile())
|
if not os.isdir(tooldir) then
|
||||||
-- end)
|
os.mkdir(tooldir)
|
||||||
|
end
|
||||||
|
local exefile = target:targetfile()
|
||||||
|
os.cp(exefile, path.join(tooldir, path.filename(exefile)))
|
||||||
|
end)
|
||||||
Loading…
Reference in New Issue
Block a user