[ox] Fix for Windows
This commit is contained in:
parent
ad412177ab
commit
4077f0bddc
2
deps/ox/src/ox/mc/write.cpp
vendored
2
deps/ox/src/ox/mc/write.cpp
vendored
@ -15,4 +15,6 @@
|
||||
|
||||
namespace ox {
|
||||
|
||||
template class ModelHandlerInterface<MetalClawWriter>;
|
||||
|
||||
}
|
||||
|
20
deps/ox/src/ox/mc/write.hpp
vendored
20
deps/ox/src/ox/mc/write.hpp
vendored
@ -106,6 +106,22 @@ class MetalClawWriter {
|
||||
constexpr void setTypeInfo(const char *name = T::TypeName, int version = T::TypeVersion,
|
||||
const Vector<String>& = {}, int fields = ModelFieldCount_v<T>) noexcept;
|
||||
|
||||
/**
|
||||
* stringLength is not implemented in MetalClawWriter
|
||||
*/
|
||||
[[nodiscard]]
|
||||
constexpr auto stringLength(const char*) noexcept {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* stringLength is not implemented in MetalClawWriter
|
||||
*/
|
||||
[[nodiscard]]
|
||||
constexpr auto arrayLength(const char*, bool = true) noexcept {
|
||||
return 0;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
constexpr std::size_t size() const noexcept;
|
||||
|
||||
@ -134,6 +150,8 @@ class MetalClawWriter {
|
||||
|
||||
};
|
||||
|
||||
extern template class ModelHandlerInterface<MetalClawWriter>;
|
||||
|
||||
constexpr MetalClawWriter::MetalClawWriter(uint8_t *buff, std::size_t buffLen, int unionIdx) noexcept:
|
||||
m_fieldPresence(buff, buffLen),
|
||||
m_unionIdx(unionIdx),
|
||||
@ -284,7 +302,7 @@ constexpr Error MetalClawWriter::field(const char*, T *val) noexcept {
|
||||
bool fieldSet = false;
|
||||
if (val && (m_unionIdx == -1 || m_unionIdx == m_field)) {
|
||||
MetalClawWriter writer(m_buff + m_buffIt, m_buffLen - m_buffIt);
|
||||
ModelHandlerInterface handler{&writer};
|
||||
ModelHandlerInterface<MetalClawWriter> handler{&writer};
|
||||
oxReturnError(model(&handler, val));
|
||||
if (static_cast<std::size_t>(writer.m_fieldPresence.getMaxLen()) < writer.m_buffIt) {
|
||||
m_buffIt += writer.m_buffIt;
|
||||
|
5
deps/ox/src/ox/std/CMakeLists.txt
vendored
5
deps/ox/src/ox/std/CMakeLists.txt
vendored
@ -57,9 +57,14 @@ target_compile_definitions(
|
||||
$<$<BOOL:${OX_NODEBUG}>:OX_NODEBUG>
|
||||
)
|
||||
|
||||
if(NOT WIN32)
|
||||
target_link_libraries(
|
||||
OxStd PUBLIC
|
||||
$<$<CXX_COMPILER_ID:GNU>:$<$<BOOL:${OX_USE_STDLIB}>:dl>>
|
||||
)
|
||||
endif()
|
||||
target_link_libraries(
|
||||
OxStd PUBLIC
|
||||
$<$<CXX_COMPILER_ID:GNU>:gcc>
|
||||
OxTraceHook
|
||||
)
|
||||
|
4
deps/ox/src/ox/std/fmt.hpp
vendored
4
deps/ox/src/ox/std/fmt.hpp
vendored
@ -153,9 +153,9 @@ template<std::size_t segementCnt>
|
||||
[[nodiscard]]
|
||||
constexpr Fmt<segementCnt> fmtSegments(StringView fmt) noexcept {
|
||||
Fmt<segementCnt> out;
|
||||
const auto prev = [fmt](std::size_t i) -> char {
|
||||
const auto prev = [fmt](int i) -> char {
|
||||
if (i > 0) {
|
||||
return fmt[i - 1];
|
||||
return fmt[static_cast<std::size_t>(i) - 1];
|
||||
} else {
|
||||
return '\0';
|
||||
}
|
||||
|
6
deps/ox/src/ox/std/stacktrace.cpp
vendored
6
deps/ox/src/ox/std/stacktrace.cpp
vendored
@ -9,8 +9,10 @@
|
||||
#if defined(OX_USE_STDLIB) && __has_include(<unistd.h>)
|
||||
#include <iostream>
|
||||
|
||||
#if __has_include_next(<execinfo.h>)
|
||||
#include <execinfo.h>
|
||||
#include <dlfcn.h>
|
||||
#endif
|
||||
|
||||
#if __has_include(<cxxabi.h>)
|
||||
#include <cxxabi.h>
|
||||
@ -30,7 +32,7 @@ static auto symbolicate([[maybe_unused]]char **frames,
|
||||
[[maybe_unused]]const char *linePrefix) {
|
||||
using StrT = BasicString<100>;
|
||||
Vector<StrT, 30> out;
|
||||
#if __has_include(<cxxabi.h>)
|
||||
#if __has_include(<cxxabi.h>) && __has_include_next(<execinfo.h>)
|
||||
for (auto i = 0u; i < symbolsLen; ++i) {
|
||||
Dl_info info;
|
||||
if (dladdr(frames[i], &info) && info.dli_sname) {
|
||||
@ -49,7 +51,7 @@ static auto symbolicate([[maybe_unused]]char **frames,
|
||||
#endif // defined(OX_USE_STDLIB) && __has_include(<unistd.h>)
|
||||
|
||||
void printStackTrace([[maybe_unused]]unsigned shave) noexcept {
|
||||
#if defined(OX_USE_STDLIB) && __has_include(<unistd.h>)
|
||||
#if defined(OX_USE_STDLIB) && __has_include(<unistd.h>) && __has_include_next(<execinfo.h>)
|
||||
constexpr auto FrameCnt = 100;
|
||||
Vector<void*, FrameCnt> frames(FrameCnt);
|
||||
frames.resize(static_cast<std::size_t>(backtrace(frames.data(), static_cast<int>(frames.size()))));
|
||||
|
Loading…
Reference in New Issue
Block a user