Compare commits

..

6 Commits

10 changed files with 30 additions and 17 deletions

View File

@@ -62,6 +62,7 @@ if(NOT BUILDCORE_TARGET STREQUAL "gba")
deps/imgui
deps/imgui/backends
deps/nfde/src/include
/usr/local/include
)
add_subdirectory(deps/glad)
add_subdirectory(deps/glfw)

View File

@@ -88,7 +88,7 @@ if (CMAKE_VERSION VERSION_LESS "3.16" AND APPLE)
LANGUAGE C)
endif()
add_library(glfw OBJECT ${glfw_SOURCES} ${glfw_HEADERS})
add_library(glfw ${glfw_SOURCES} ${glfw_HEADERS})
set_target_properties(glfw PROPERTIES
OUTPUT_NAME ${GLFW_LIB_NAME}
VERSION ${GLFW_VERSION_MAJOR}.${GLFW_VERSION_MINOR}

View File

@@ -15,8 +15,7 @@ if(nfd_PLATFORM STREQUAL PLATFORM_LINUX)
# for Linux, we support GTK3 and xdg-desktop-portal
option(NFD_PORTAL "Use xdg-desktop-portal instead of GTK" OFF)
if(NOT NFD_PORTAL)
pkg_check_modules(GTK3 REQUIRED gtk+-3.0)
message("Using GTK version: ${GTK3_VERSION}")
pkg_check_modules(GTK3 REQUIRED IMPORTED_TARGET gtk+-3.0)
list(APPEND SOURCE_FILES nfd_gtk.cpp)
else()
pkg_check_modules(DBUS REQUIRED dbus-1)
@@ -31,7 +30,7 @@ if(nfd_PLATFORM STREQUAL PLATFORM_MACOS)
endif()
# Define the library
add_library(${TARGET_NAME} OBJECT
add_library(${TARGET_NAME}
${SOURCE_FILES})
# Allow includes from include/
@@ -40,10 +39,8 @@ target_include_directories(${TARGET_NAME}
if(nfd_PLATFORM STREQUAL PLATFORM_LINUX)
if(NOT NFD_PORTAL)
target_include_directories(${TARGET_NAME}
PRIVATE ${GTK3_INCLUDE_DIRS})
target_link_libraries(${TARGET_NAME}
PRIVATE ${GTK3_LIBRARIES})
PRIVATE PkgConfig::GTK3)
else()
target_include_directories(${TARGET_NAME}
PRIVATE ${DBUS_INCLUDE_DIRS})

View File

@@ -1,3 +1,6 @@
set(OX_FREEBSD ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
set(OX_LINUX ${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
if(OX_USE_STDLIB)
add_subdirectory(oc)
endif()

View File

@@ -16,7 +16,7 @@ if(NOT MSVC)
endif()
if(NOT OX_BARE_METAL)
if(NOT APPLE AND NOT MSVC)
if(NOT APPLE AND NOT MSVC AND NOT ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
target_link_libraries(
OxFS PUBLIC
stdc++fs

View File

@@ -20,6 +20,7 @@ target_link_libraries(
OxLogConn PUBLIC
OxStd
OxMetalClaw
$<$<BOOL:OX_FREEBSD>:pthread>
)
install(

View File

@@ -44,7 +44,7 @@ add_library(
if(NOT MSVC)
target_compile_options(OxStd PRIVATE -Wsign-conversion)
target_compile_options(OxStd PRIVATE -Wconversion)
if(UNIX AND NOT APPLE)
if(${OX_LINUX})
target_compile_options(OxStd PUBLIC -export-dynamic)
#target_link_options(OxStd PUBLIC -W1,-E)
endif()
@@ -74,6 +74,7 @@ endif()
target_link_libraries(
OxStd PUBLIC
$<$<CXX_COMPILER_ID:GNU>:gcc>
$<$<BOOL:${OX_FREEBSD}>:execinfo>
OxTraceHook
)

View File

@@ -41,8 +41,11 @@ constexpr T *make(Args &&...args) noexcept {
#ifdef __cpp_exceptions
try {
return new T(ox::forward<Args>(args)...);
} catch (std::exception const&ex) {
oxPanic(OxError(1, ex.what()), ex.what());
return nullptr;
} catch (...) {
oxPanic(OxError(1, "Allocation or constructor failed"), "Allocation or constructor failed");
oxPanic(OxError(2, "Allocation or constructor failed"), "Allocation or constructor failed");
return nullptr;
}
#else

View File

@@ -18,6 +18,7 @@
#endif
#endif
#include "defines.hpp"
#include "string.hpp"
#include "trace.hpp"
#include "vector.hpp"
@@ -32,7 +33,12 @@ static auto symbolicate([[maybe_unused]]void **frames,
using StrT = BasicString<100>;
Vector<StrT, 30> out;
#if __has_include(<cxxabi.h>) && __has_include(<execinfo.h>)
const auto mangledSymbols = backtrace_symbols(frames, static_cast<int>(frameCnt));
#ifdef OX_OS_FreeBSD
using FrameCnt_t = unsigned;
#else
using FrameCnt_t = signed;
#endif
const auto mangledSymbols = backtrace_symbols(frames, static_cast<FrameCnt_t>(frameCnt));
for (auto i = 0u; i < frameCnt; ++i) {
Dl_info info;
if (dladdr(frames[i], &info) && info.dli_sname) {
@@ -55,7 +61,12 @@ void printStackTrace([[maybe_unused]]unsigned shave) noexcept {
#if defined(OX_USE_STDLIB) && __has_include(<unistd.h>) && __has_include(<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()))));
#ifdef OX_OS_FreeBSD
using FrameCnt_t = unsigned;
#else
using FrameCnt_t = signed;
#endif
frames.resize(static_cast<std::size_t>(backtrace(frames.data(), static_cast<FrameCnt_t>(frames.size()))));
if (frames.size() - shave > 2) {
const auto symbolicatedStacktrace = symbolicate(frames.data() + shave, frames.size() - shave, "\t");
oxErr("Stacktrace:\n");

View File

@@ -17,11 +17,7 @@ class StudioModule: public studio::Module {
{
{FileExt_ng},
[ctx](ox::CRStringView path) -> ox::Result<studio::BaseEditor*> {
try {
return ox::make<TileSheetEditorImGui>(ctx, path);
} catch (const ox::Exception &ex) {
return ex.toError();
}
return ox::makeCatch<TileSheetEditorImGui>(ctx, path);
}
},
{