update refl
This commit is contained in:
parent
6f423500b6
commit
1e81945b20
@ -2,16 +2,24 @@
|
||||
namespace refl {
|
||||
namespace detail {
|
||||
template<typename T>
|
||||
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<typename T>
|
||||
constexpr auto raw_type_name() noexcept {
|
||||
constexpr std::string_view sign = func_signature<T>();
|
||||
constexpr size_t size = sign.size();
|
||||
return TStr<size>{ sign };
|
||||
}
|
||||
template<size_t N, size_t M>
|
||||
constexpr auto concat(const TStr<N>& lhs, const TStr<M>& 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<T>();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -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")
|
||||
@ -0,0 +1,22 @@
|
||||
#define ZLIB_API
|
||||
#define ZLIB_API_VAL
|
||||
#include "refl/pch.h"
|
||||
#include <iostream>
|
||||
using namespace refl;
|
||||
namespace api {
|
||||
struct api_t {
|
||||
|
||||
};
|
||||
}
|
||||
struct test {
|
||||
|
||||
};
|
||||
void (*testfn)(test);
|
||||
using testfn_t = decltype(testfn);
|
||||
int main() {
|
||||
auto r1 = type_name<testfn_t>();
|
||||
auto r2 = type_name<api::api_t>();
|
||||
auto t1 = r1.View();
|
||||
auto t2 = r2.View();
|
||||
std::cout << "hello world" << std::endl;
|
||||
}
|
||||
@ -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")
|
||||
add_headerfiles("editor/*.h")
|
||||
add_deps("zlib")
|
||||
Loading…
Reference in New Issue
Block a user