diff --git a/engine/modules/engine/zlib/include/refl/detail/name.inl b/engine/modules/engine/zlib/include/refl/detail/name.inl index e78046f..b089672 100644 --- a/engine/modules/engine/zlib/include/refl/detail/name.inl +++ b/engine/modules/engine/zlib/include/refl/detail/name.inl @@ -2,16 +2,24 @@ namespace refl { namespace detail { template - constexpr auto func_signature_impl() noexcept { + constexpr std::string_view func_signature() noexcept { # if defined(__clang__) - return std::string_view{ __PRETTY_FUNCTION__ }; + auto sign = std::string_view{ __PRETTY_FUNCTION__ }; + return sign.substr(53, sign.size() - 54); # elif defined(__GNUC__) - return std::string_view{ __PRETTY_FUNCTION__ }; + auto sign = std::string_view{ __PRETTY_FUNCTION__ }; + return sign.substr(62, sign.size() - 62); # elif defined(_MSC_VER) - return std::string_view{ __FUNCSIG__ }; + auto sign = std::string_view{ __FUNCSIG__ }; + return sign.substr(48, sign.size() - 48); # endif } - + template + constexpr auto raw_type_name() noexcept { + constexpr std::string_view sign = func_signature(); + constexpr size_t size = sign.size(); + return TStr{ sign }; + } template constexpr auto concat(const TStr& lhs, const TStr& rhs) { constexpr size_t L = N + M - 1; @@ -88,8 +96,7 @@ namespace refl { return detail::concat(prefix, bit); } else { - //static_assert("not support"); - return TStr{ "unknown" }; + return detail::raw_type_name(); } } } \ No newline at end of file diff --git a/engine/modules/xmake.lua b/engine/modules/xmake.lua index 20dd4c8..fb7805d 100644 --- a/engine/modules/xmake.lua +++ b/engine/modules/xmake.lua @@ -48,8 +48,8 @@ function game_instance(name, opt) add_rules("engine.plugin", {file = opt and opt.file or "src/" .. name .. ".h"}) add_defines("SDL_MAIN_HANDLED") target(name .. "-editor") - set_kind("shared") + set_kind("binary") set_group("Games") - add_deps(name) + --add_deps(name) end includes("**/xmake.lua") \ No newline at end of file diff --git a/game/zworld/editor/zworld_editor.cpp b/game/zworld/editor/zworld_editor.cpp index e69de29..c4bfb67 100644 --- a/game/zworld/editor/zworld_editor.cpp +++ b/game/zworld/editor/zworld_editor.cpp @@ -0,0 +1,22 @@ +#define ZLIB_API +#define ZLIB_API_VAL +#include "refl/pch.h" +#include +using namespace refl; +namespace api { + struct api_t { + + }; +} +struct test { + +}; +void (*testfn)(test); +using testfn_t = decltype(testfn); +int main() { + auto r1 = type_name(); + auto r2 = type_name(); + auto t1 = r1.View(); + auto t2 = r2.View(); + std::cout << "hello world" << std::endl; +} \ No newline at end of file diff --git a/game/zworld/xmake.lua b/game/zworld/xmake.lua index 5f1579b..670ffe8 100644 --- a/game/zworld/xmake.lua +++ b/game/zworld/xmake.lua @@ -2,7 +2,8 @@ game_instance("zworld", "src/zworld.h") target("zworld") add_files("src/*.cpp") add_headerfiles("src/*.h") - add_dependency("engine", "editor", "vulkan", {public = true}) + add_deps("engine", "editor", "vulkan", {public = true}) target("zworld-editor") add_files("editor/*.cpp") - add_headerfiles("editor/*.h") \ No newline at end of file + add_headerfiles("editor/*.h") + add_deps("zlib") \ No newline at end of file