diff --git a/CMakeLists.txt b/CMakeLists.txt
index 48f75411..ec23c48c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -31,6 +31,7 @@ option(RAWRBOX_USE_WAYLAND "Use Wayland for linux" OFF)
option(RAWRBOX_BUILD_TESTING "Build tests" OFF)
option(RAWRBOX_BUILD_SAMPLES "Build samples" OFF)
+option(RAWRBOX_BUILD_RAWRBOX_RENDER "Build rawrbox renderer, disable for renderless programs" ON)
option(RAWRBOX_BUILD_RAWRBOX_UI "Build rawrbox UI" OFF)
option(RAWRBOX_BUILD_RAWRBOX_RESOURCES "Build rawrbox resources utils" OFF)
option(RAWRBOX_BUILD_RAWRBOX_3D_PHYSICS "Build 3D physics support" OFF)
@@ -63,26 +64,27 @@ option(RAWRBOX_INTERPROCEDURAL_OPTIMIZATION "Enables IPO" ON)
# ---------------
# -----
-if(RAWRBOX_INTERPROCEDURAL_OPTIMIZATION)
- message(WARNING "Enabled INTERPROCEDURAL_OPTIMIZATION")
+if(RAWRBOX_INTERPROCEDURAL_OPTIMIZATION AND NOT ("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "ARM64") AND NOT ("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "ARM"))
+ message(STATUS "Enabled INTERPROCEDURAL_OPTIMIZATION for release and distribution")
include(CheckIPOSupported)
check_ipo_supported(RESULT ipoSupported OUTPUT error)
if(ipoSupported)
- set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
+ set(CMAKE_INTERPROCEDURAL_OPTIMIZATION_RELEASE TRUE)
+ set(CMAKE_INTERPROCEDURAL_OPTIMIZATION_DISTRIBUTION TRUE)
else()
message(FATAL_ERROR "IPO / LTO is not supported, please disable RAWRBOX_INTERPROCEDURAL_OPTIMIZATION")
endif()
endif()
-# Uncomment for package.lock generation
if(RAWRBOX_DEV_MODE)
message(WARNING "RAWRBOX Dev mode enabled!")
set(RAWRBOX_BUILD_TESTING ON)
set(RAWRBOX_BUILD_SAMPLES ON)
+ set(RAWRBOX_BUILD_RAWRBOX_RENDER ON)
set(RAWRBOX_BUILD_RAWRBOX_UI ON)
set(RAWRBOX_BUILD_RAWRBOX_RESOURCES ON)
set(RAWRBOX_BUILD_RAWRBOX_3D_PHYSICS ON)
@@ -135,6 +137,8 @@ if(NOT WIN32)
list(APPEND RAWRBOX_EXTRA_LIBS wayland-egl)
set(GLFW_BUILD_WAYLAND ON CACHE INTERNAL "")
endif()
+
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -frtti -fexceptions") # Enable exceptions and RTTI
else()
# Ignore warnings about missing pdb
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /ignore:4099")
@@ -142,7 +146,7 @@ else()
set(CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS} /ignore:4099")
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /permissive-")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /permissive- /EHsc /GR") # Enable strict mode, exceptions and RTTI
endif()
set(CMAKE_SKIP_RPATH TRUE)
@@ -162,14 +166,26 @@ endif()
# ---------------------
## CHECKS ---
-if(RAWRBOX_BUILD_SAMPLES AND NOT RAWRBOX_BUILD_RAWRBOX_RESOURCES)
- message(WARNING "Samples require RAWRBOX.RESOURCES to be enabled, enabling...")
- set(RAWRBOX_BUILD_RAWRBOX_RESOURCES ON)
-endif()
+if(NOT RAWRBOX_BUILD_RAWRBOX_RENDER)
+ message(WARNING "----------------------------------------\nRAWRBOX_BUILD_RAWRBOX_RENDER is disabled!\nDisabling UI / ASSIMP / IMGUI / WEBM and samples..\n----------------------------------------")
+ set(RAWRBOX_BUILD_RAWRBOX_UI OFF)
+ set(RAWRBOX_BUILD_RAWRBOX_ASSIMP OFF)
+ set(RAWRBOX_BUILD_RAWRBOX_IMGUI OFF)
+ set(RAWRBOX_BUILD_RAWRBOX_WEBM OFF)
+
+ set(RAWRBOX_BUILD_SAMPLES OFF)
+else()
+ # Samples & UI ---
+ if(RAWRBOX_BUILD_SAMPLES AND NOT RAWRBOX_BUILD_RAWRBOX_RESOURCES)
+ message(WARNING "Samples require RAWRBOX.RESOURCES to be enabled, enabling...")
+ set(RAWRBOX_BUILD_RAWRBOX_RESOURCES ON)
+ endif()
-if(RAWRBOX_BUILD_RAWRBOX_UI AND NOT RAWRBOX_BUILD_RAWRBOX_RESOURCES)
- message(WARNING "RAWRBOX.UI requires RAWRBOX.RESOURCES to be enabled, enabling...")
- set(RAWRBOX_BUILD_RAWRBOX_RESOURCES ON)
+ if(RAWRBOX_BUILD_RAWRBOX_UI AND NOT RAWRBOX_BUILD_RAWRBOX_RESOURCES)
+ message(WARNING "RAWRBOX.UI requires RAWRBOX.RESOURCES to be enabled, enabling...")
+ set(RAWRBOX_BUILD_RAWRBOX_RESOURCES ON)
+ endif()
+ # -----------
endif()
if(NOT RAWRBOX_BUILD_MSVC_MULTITHREADED_RUNTIME AND RAWRBOX_BUILD_RAWRBOX_3D_PHYSICS)
@@ -189,8 +205,10 @@ if(magic_enum_ADDED)
set_lib_runtime_mt(magic_enum)
endif()
-if(NOT WIN32 AND RAWRBOX_USE_WAYLAND)
- CPMAddPackage("https://gitlab.freedesktop.org/wayland/weston@13.0.3")
+if(RAWRBOX_BUILD_RAWRBOX_RENDER)
+ if(NOT WIN32 AND RAWRBOX_USE_WAYLAND)
+ CPMAddPackage("https://gitlab.freedesktop.org/wayland/weston@13.0.3")
+ endif()
endif()
CPMAddPackage("gh:stephenberry/glaze@3.2.5")
@@ -231,6 +249,11 @@ add_subdirectory("rawrbox.math")
add_subdirectory("rawrbox.utils")
add_subdirectory("rawrbox.engine")
+if(RAWRBOX_BUILD_RAWRBOX_RENDER)
+ message(STATUS "Enabled RAWRBOX.RENDER support")
+ add_subdirectory("rawrbox.render")
+endif()
+
if(RAWRBOX_BUILD_RAWRBOX_SCRIPTING)
message(STATUS "Enabled RAWRBOX.SCRIPTING support")
add_subdirectory("rawrbox.scripting")
@@ -246,8 +269,6 @@ if(RAWRBOX_BUILD_RAWRBOX_NETWORK)
add_subdirectory("rawrbox.network")
endif()
-add_subdirectory("rawrbox.render")
-
if(RAWRBOX_BUILD_RAWRBOX_WEBM)
message(STATUS "Enabled RAWRBOX.WEBM support")
add_subdirectory("rawrbox.webm")
diff --git a/README.md b/README.md
index 1ae2293e..06eb0204 100644
--- a/README.md
+++ b/README.md
@@ -60,6 +60,7 @@ This engine started as a C++ training project, with hopes of being applied in my
### REQUIRED SOFTWARE
- [Microsoft Visual C++ Redistributable](https://aka.ms/vs/17/release/vc_redist.x64.exe) 2015 - 2022 version
+- [Vulkan SDK](https://vulkan.lunarg.com/sdk/home#windows) (ensure the enviroment paths are correct)
- [GIT](https://git-scm.com/) or something similar to GIT
- [CMAKE](https://cmake.org/download/) at least > 3.16.3
- Download and install **C++ Build Tools** (2022 is recommended)
@@ -113,44 +114,45 @@ This engine started as a C++ training project, with hopes of being applied in my
# CMAKE OPTIONS
-| OPTION NAME | NOTE |
-| :----------------------------------------- | :------------------------------------------------------------------------------------------------- |
-| `RAWRBOX_BUILD_TESTING` | Builds & enables project tests |
-| `RAWRBOX_BUILD_SAMPLES` | Builds the project sample |
-| -- | -- |
-| `RAWRBOX_CONTENT_FOLDER` | The content folder to output assets. Default is `assets` |
-| -- | -- |
-| `RAWRBOX_USE_WAYLAND` | Enables WAYLAND compiling on LINUX |
-| -- | -- |
-| `RAWRBOX_BUILD_RAWRBOX_UI` | Builds and includes ui |
-| `RAWRBOX_BUILD_RAWRBOX_RESOURCES` | Builds and resouces manager (aka handling and storing loaded resources) |
-| `RAWRBOX_BUILD_RAWRBOX_3D_PHYSICS` | Builds the 3D physics engine |
-| `RAWRBOX_BUILD_RAWRBOX_2D_PHYSICS` | Builds the 2D physics engine |
-| `RAWRBOX_BUILD_RAWRBOX_BASS` | Enables BASS support. ⚠️ [BASS IS ONLY FREE FOR OPEN SOURCE PROJECTS](https://www.un4seen.com/) ⚠️ |
-| `RAWRBOX_BUILD_RAWRBOX_ASSIMP` | Enables assimp model loading |
-| `RAWRBOX_BUILD_RAWRBOX_WEBM` | Enables WEBM loading |
-| `RAWRBOX_BUILD_RAWRBOX_NETWORK` | Builds network support |
-| `RAWRBOX_BUILD_RAWRBOX_IMGUI` | Builds imgui support |
-| -- | -- |
-| `RAWRBOX_BUILD_RAWRBOX_SCRIPTING` | Enables lua & modding support |
-| `RAWRBOX_SCRIPTING_UNSAFE` | Enables io support on lua (loading and saving files on the data folder) |
-| `RAWRBOX_SCRIPTING_EXCEPTION` | Enables scripting throwing exceptions instead of catching them |
-| `RAWRBOX_SCRIPTING_WORKSHOP_MODDING` | Enables workshop utilities (useful for steam workshop / mod.io) |
-| -- | -- |
-| `RAWRBOX_BUILD_RAWRBOX_STEAMWORKS` | Enables steamworks support |
-| `STEAMWORKS_APPID` | Sets the steamworks appid |
-| -- | -- |
-| `RAWRBOX_BUILD_QHULL` | Builds QHull util |
-| -- | -- |
-| `RAWRBOX_BUILD_MSVC_MULTITHREADED_RUNTIME` | Builds libraries with MSVC Multithreaded runtime (Auto-enabled if jolt is used) |
-| -- | -- |
-| `RAWRBOX_DISABLE_SUPPORT_DX12` | Disable dx12 support |
-| `RAWRBOX_DISABLE_SUPPORT_VULKAN` | Disable vulkan support |
-| -- | -- |
-| `RAWRBOX_DEV_MODE` | Enables all the modules, used for rawrbox development |
-| -- | -- |
-| `RAWRBOX_TRACE_EXCEPTIONS` | Enables exception tracing |
-| `RAWRBOX_INTERPROCEDURAL_OPTIMIZATION` | Enables IPO compilation |
+| OPTION NAME | NOTE | DEFAULT |
+| :----------------------------------------- | :------------------------------------------------------------------------------------------------- | ------- |
+| `RAWRBOX_BUILD_TESTING` | Builds & enables project tests | OFF |
+| `RAWRBOX_BUILD_SAMPLES` | Builds the project sample | OFF |
+| -- | -- | -- |
+| `RAWRBOX_CONTENT_FOLDER` | The content folder to output assets. Default is `assets` | OFF |
+| -- | -- | -- |
+| `RAWRBOX_USE_WAYLAND` | Enables WAYLAND compiling on LINUX | OFF |
+| -- | -- | -- |
+| `RAWRBOX_BUILD_RAWRBOX_RENDER` | Builds and the renderer, disable for renderless programs | ON |
+| `RAWRBOX_BUILD_RAWRBOX_UI` | Builds rawrbox ui (alternative to imgui) | OFF |
+| `RAWRBOX_BUILD_RAWRBOX_RESOURCES` | Builds the resouces manager (aka handling and storing loaded resources) | OFF |
+| `RAWRBOX_BUILD_RAWRBOX_3D_PHYSICS` | Builds the 3D physics engine | OFF |
+| `RAWRBOX_BUILD_RAWRBOX_2D_PHYSICS` | Builds the 2D physics engine | OFF |
+| `RAWRBOX_BUILD_RAWRBOX_BASS` | Enables BASS support. ⚠️ [BASS IS ONLY FREE FOR OPEN SOURCE PROJECTS](https://www.un4seen.com/) ⚠️ | OFF |
+| `RAWRBOX_BUILD_RAWRBOX_ASSIMP` | Enables assimp model loading | OFF |
+| `RAWRBOX_BUILD_RAWRBOX_WEBM` | Enables WEBM loading | OFF |
+| `RAWRBOX_BUILD_RAWRBOX_NETWORK` | Builds network support | OFF |
+| `RAWRBOX_BUILD_RAWRBOX_IMGUI` | Builds imgui support | OFF |
+| -- | -- | -- |
+| `RAWRBOX_BUILD_RAWRBOX_SCRIPTING` | Enables lua & modding support | OFF |
+| `RAWRBOX_SCRIPTING_UNSAFE` | Enables io support on lua (loading and saving files on the data folder) | OFF |
+| `RAWRBOX_SCRIPTING_EXCEPTION` | Enables scripting throwing exceptions instead of catching them | OFF |
+| `RAWRBOX_SCRIPTING_WORKSHOP_MODDING` | Enables workshop utilities (useful for steam workshop / mod.io) | OFF |
+| -- | -- | -- |
+| `RAWRBOX_BUILD_RAWRBOX_STEAMWORKS` | Enables steamworks support | OFF |
+| `STEAMWORKS_APPID` | Sets the steamworks appid | OFF |
+| -- | -- | -- |
+| `RAWRBOX_BUILD_QHULL` | Builds QHull util | OFF |
+| -- | -- | -- |
+| `RAWRBOX_BUILD_MSVC_MULTITHREADED_RUNTIME` | Builds libraries with MSVC Multithreaded runtime (Auto-enabled if jolt is used) | OFF |
+| -- | -- | -- |
+| `RAWRBOX_DISABLE_SUPPORT_DX12` | Disable dx12 support | OFF |
+| `RAWRBOX_DISABLE_SUPPORT_VULKAN` | Disable vulkan support | OFF |
+| -- | -- | -- |
+| `RAWRBOX_DEV_MODE` | Enables all the modules, used for rawrbox development | OFF |
+| -- | -- | -- |
+| `RAWRBOX_TRACE_EXCEPTIONS` | Enables exception tracing | ON |
+| `RAWRBOX_INTERPROCEDURAL_OPTIMIZATION` | Enables IPO compilation on release | ON |
diff --git a/rawrbox.bass/src/resources/sound.cpp b/rawrbox.bass/src/resources/sound.cpp
index 625b10df..299e2d1c 100644
--- a/rawrbox.bass/src/resources/sound.cpp
+++ b/rawrbox.bass/src/resources/sound.cpp
@@ -15,8 +15,12 @@ namespace rawrbox {
} else {
loaded = rawrbox::BASS::loadSound(this->filePath, this->flags);
}
+#ifdef RAWRBOX_TRACE_EXCEPTIONS
} catch (const cpptrace::exception_with_message& e) {
- fmt::print("\n\t{}\n\t\t └── Loading fallback sound!\n", e.message());
+#else
+ } catch (const std::exception& e) {
+#endif
+ fmt::print("\n\t{}\n\t\t └── Loading fallback sound!\n", e.what());
loaded = rawrbox::BASS::loadSound("./assets/sound/error.ogg", this->flags);
}
diff --git a/rawrbox.engine/src/engine.cpp b/rawrbox.engine/src/engine.cpp
index f5481540..21cc9caa 100644
--- a/rawrbox.engine/src/engine.cpp
+++ b/rawrbox.engine/src/engine.cpp
@@ -4,10 +4,6 @@
#include
#include
-#ifdef RAWRBOX_TRACE_EXCEPTIONS
- #include
-#endif
-
#include
#include
diff --git a/rawrbox.physics_3d/CMakeLists.txt b/rawrbox.physics_3d/CMakeLists.txt
index 6a1d5b91..d53bf2a2 100644
--- a/rawrbox.physics_3d/CMakeLists.txt
+++ b/rawrbox.physics_3d/CMakeLists.txt
@@ -3,6 +3,19 @@ project("RAWRBOX.PHYSICS.3D" VERSION ${RAWRBOX_VERSION} DESCRIPTION "RawrBox - 3
set(output_target RAWRBOX.PHYSICS.3D)
# LIBS ---
+set(CMAKE_CXX_ORIGINAL_FLAGS ${CMAKE_CXX_FLAGS})
+
+if(CMAKE_BUILD_TYPE STREQUAL "Debug")
+ set(DEBUG_RENDERER_IN_DEBUG_AND_RELEASE ON CACHE STRING "" FORCE)
+ message(STATUS "Enabled jolt debug renderer")
+else()
+ set(DEBUG_RENDERER_IN_DEBUG_AND_RELEASE OFF CACHE STRING "" FORCE)
+ message(STATUS "Disabled jolt debug renderer")
+endif()
+
+set(CPP_EXCEPTIONS_ENABLED ON CACHE STRING "" FORCE)
+set(CPP_RTTI_ENABLED ON CACHE STRING "" FORCE)
+
CPMAddPackage(
NAME
Jolt
@@ -11,15 +24,14 @@ CPMAddPackage(
VERSION
5.1.0
OPTIONS
- # "CROSS_PLATFORM_DETERMINISTIC ON"
- "COMPILE_AS_SHARED_LIBRARY OFF"
"INTERPROCEDURAL_OPTIMIZATION ${RAWRBOX_INTERPROCEDURAL_OPTIMIZATION}"
+
+ "COMPILE_AS_SHARED_LIBRARY OFF"
"USE_STATIC_MSVC_RUNTIME_LIBRARY ON"
"ENABLE_ALL_WARNINGS OFF"
"DEBUG_RENDERER_IN_DISTRIBUTION OFF"
- "DEBUG_RENDERER_IN_DEBUG_AND_RELEASE OFF"
"PROFILER_IN_DISTRIBUTION OFF"
"PROFILER_IN_DEBUG_AND_RELEASE OFF"
@@ -33,11 +45,15 @@ CPMAddPackage(
file(GLOB_RECURSE RAWRBOX_PHYSICS_IMPORTS "src/*.cpp" "include/*.hpp")
add_library(${output_target} ${RAWRBOX_LIBRARY_TYPE} ${RAWRBOX_PHYSICS_IMPORTS})
target_compile_definitions(${output_target} PRIVATE _CRT_SECURE_NO_WARNINGS NOMINMAX)
-target_compile_definitions(${output_target} PUBLIC RAWRBOX_PHYSICS_3D JPH_DEBUG_RENDERER)
+target_compile_definitions(${output_target} PUBLIC RAWRBOX_PHYSICS_3D)
target_include_directories(${output_target} PUBLIC "include")
target_compile_features(${output_target} PUBLIC cxx_std_${CMAKE_CXX_STANDARD})
-target_link_libraries(${output_target} PUBLIC RAWRBOX.ENGINE RAWRBOX.MATH Jolt)
+if(DEBUG_RENDERER_IN_DEBUG_AND_RELEASE AND RAWRBOX_BUILD_RAWRBOX_RENDER)
+ target_link_libraries(${output_target} PUBLIC RAWRBOX.RENDER Jolt)
+else()
+ target_link_libraries(${output_target} PUBLIC RAWRBOX.ENGINE RAWRBOX.MATH Jolt)
+endif()
set_lib_runtime_mt(${output_target})
# --------------
diff --git a/rawrbox.physics_3d/include/rawrbox/physics/debugger.hpp b/rawrbox.physics_3d/include/rawrbox/physics/debugger.hpp
index 8436036b..448aa73c 100644
--- a/rawrbox.physics_3d/include/rawrbox/physics/debugger.hpp
+++ b/rawrbox.physics_3d/include/rawrbox/physics/debugger.hpp
@@ -1,7 +1,7 @@
-#pragma once
-
#ifdef _DEBUG
#ifdef RAWRBOX_RENDER
+ #pragma once
+
#include
#include
#include
diff --git a/rawrbox.physics_3d/include/rawrbox/physics/manager.hpp b/rawrbox.physics_3d/include/rawrbox/physics/manager.hpp
index 54fcc52d..fb3511a9 100644
--- a/rawrbox.physics_3d/include/rawrbox/physics/manager.hpp
+++ b/rawrbox.physics_3d/include/rawrbox/physics/manager.hpp
@@ -1,15 +1,12 @@
#pragma once
+
#include
#include
-#include
#include
-#include
-
// Jolt includes
-
-#include
-
+#include
+//--
#include
#include
#include
@@ -20,6 +17,10 @@
#include
#include
#include
+//---
+
+#include
+
#include
#include
diff --git a/rawrbox.render/src/textures/atlas.cpp b/rawrbox.render/src/textures/atlas.cpp
index c61277cf..53892cc5 100644
--- a/rawrbox.render/src/textures/atlas.cpp
+++ b/rawrbox.render/src/textures/atlas.cpp
@@ -8,10 +8,14 @@ namespace rawrbox {
TextureAtlas::TextureAtlas(const std::filesystem::path& filePath, const std::vector& buffer, uint32_t spriteSize, bool useFallback) : _spriteSize(spriteSize) {
try {
this->processAtlas(rawrbox::STBI::decode(buffer));
+#ifdef RAWRBOX_TRACE_EXCEPTIONS
} catch (const cpptrace::exception_with_message& e) {
+#else
+ } catch (const std::exception& e) {
+#endif
if (useFallback) {
this->loadFallback();
- this->_logger->warn("Failed to load '{}' ──> \n\t{}\n\t\t └── Loading fallback texture!", filePath.generic_string(), e.message());
+ this->_logger->warn("Failed to load '{}' ──> \n\t{}\n\t\t └── Loading fallback texture!", filePath.generic_string(), e.what());
return;
}
@@ -22,10 +26,14 @@ namespace rawrbox {
TextureAtlas::TextureAtlas(const std::filesystem::path& filePath, uint32_t spriteSize, bool useFallback) : _spriteSize(spriteSize) {
try {
this->processAtlas(rawrbox::STBI::decode(filePath));
+#ifdef RAWRBOX_TRACE_EXCEPTIONS
} catch (const cpptrace::exception_with_message& e) {
+#else
+ } catch (const std::exception& e) {
+#endif
if (useFallback) {
this->loadFallback();
- this->_logger->warn("Failed to load '{}' ──> \n\t{}\n\t\t └── Loading fallback texture!", filePath.generic_string(), e.message());
+ this->_logger->warn("Failed to load '{}' ──> \n\t{}\n\t\t └── Loading fallback texture!", filePath.generic_string(), e.what());
return;
}
diff --git a/rawrbox.render/src/textures/gif.cpp b/rawrbox.render/src/textures/gif.cpp
index f0f6616d..78840ae7 100644
--- a/rawrbox.render/src/textures/gif.cpp
+++ b/rawrbox.render/src/textures/gif.cpp
@@ -17,9 +17,13 @@ namespace rawrbox {
} else {
this->_data = rawrbox::GIF::decode(buffer);
}
+#ifdef RAWRBOX_TRACE_EXCEPTIONS
} catch (const cpptrace::exception_with_message& e) {
+#else
+ } catch (const std::exception& e) {
+#endif
if (useFallback) {
- this->_logger->warn("Failed to load '{}' ──> {}\n └── Loading fallback texture!", this->_filePath.generic_string(), e.message());
+ this->_logger->warn("Failed to load '{}' ──> {}\n └── Loading fallback texture!", this->_filePath.generic_string(), e.what());
this->loadFallback();
return;
}
diff --git a/rawrbox.render/src/textures/image.cpp b/rawrbox.render/src/textures/image.cpp
index f17b9b7d..2598c1a9 100644
--- a/rawrbox.render/src/textures/image.cpp
+++ b/rawrbox.render/src/textures/image.cpp
@@ -9,7 +9,11 @@ namespace rawrbox {
try {
this->_data = rawrbox::STBI::decode(buffer);
if (!this->_data.valid() || this->_data.total() == 0) throw this->_logger->error("Invalid image data!");
+#ifdef RAWRBOX_TRACE_EXCEPTIONS
} catch (const cpptrace::exception_with_message& e) {
+#else
+ } catch (const std::exception& e) {
+#endif
if (useFallback) {
this->loadFallback();
this->_logger->warn("Failed to load '{}' ──> {}\n └── Loading fallback texture!", this->_filePath.generic_string(), e.what());
@@ -24,7 +28,11 @@ namespace rawrbox {
try {
this->_data = rawrbox::STBI::decode(filePath);
if (!this->_data.valid() || this->_data.total() == 0) throw this->_logger->error("Invalid image data!");
+#ifdef RAWRBOX_TRACE_EXCEPTIONS
} catch (const cpptrace::exception_with_message& e) {
+#else
+ } catch (const std::exception& e) {
+#endif
if (useFallback) {
this->loadFallback();
this->_logger->warn("Failed to load '{}' ──> {}\n └── Loading fallback texture!", this->_filePath.generic_string(), e.what());
@@ -39,7 +47,11 @@ namespace rawrbox {
try {
this->_data = rawrbox::STBI::decode(buffer, bufferSize);
if (!this->_data.valid() || this->_data.total() == 0) throw this->_logger->error("Invalid image data!");
+#ifdef RAWRBOX_TRACE_EXCEPTIONS
} catch (const cpptrace::exception_with_message& e) {
+#else
+ } catch (const std::exception& e) {
+#endif
if (useFallback) {
this->loadFallback();
this->_logger->warn("Failed to load '{}' ──> {}\n └── Loading fallback texture!", this->_filePath.generic_string(), e.what());
diff --git a/rawrbox.render/src/textures/webp.cpp b/rawrbox.render/src/textures/webp.cpp
index 9fff08b2..7d9778ee 100644
--- a/rawrbox.render/src/textures/webp.cpp
+++ b/rawrbox.render/src/textures/webp.cpp
@@ -13,14 +13,18 @@ namespace rawrbox {
try {
this->_data = rawrbox::WEBP::decode(data);
- } catch (const cpptrace::exception_with_message& err) {
+#ifdef RAWRBOX_TRACE_EXCEPTIONS
+ } catch (const cpptrace::exception_with_message& e) {
+#else
+ } catch (const std::exception& e) {
+#endif
if (useFallback) {
- this->_logger->warn("Failed to load '{}' ──> \n\t{}\n\t\t └── Loading fallback texture!", this->_filePath.generic_string(), err.message());
+ this->_logger->warn("Failed to load '{}' ──> \n\t{}\n\t\t └── Loading fallback texture!", this->_filePath.generic_string(), e.what());
this->loadFallback();
return;
}
- throw err;
+ throw e;
}
}
} // namespace rawrbox
diff --git a/rawrbox.utils/include/rawrbox/utils/crc.hpp b/rawrbox.utils/include/rawrbox/utils/crc.hpp
index b8075be2..df49ad4c 100644
--- a/rawrbox.utils/include/rawrbox/utils/crc.hpp
+++ b/rawrbox.utils/include/rawrbox/utils/crc.hpp
@@ -1,3 +1,4 @@
+#pragma once
// NOLINTBEGIN(*)
/**
diff --git a/rawrbox.utils/src/threading.cpp b/rawrbox.utils/src/threading.cpp
index c99ae030..a6ee2250 100644
--- a/rawrbox.utils/src/threading.cpp
+++ b/rawrbox.utils/src/threading.cpp
@@ -1,9 +1,5 @@
#include
-#ifdef RAWRBOX_TRACE_EXCEPTIONS
- #include
-#endif
-
#include
namespace rawrbox {
diff --git a/rawrbox.webm/src/textures/webm.cpp b/rawrbox.webm/src/textures/webm.cpp
index 8212c376..41b3e2d8 100644
--- a/rawrbox.webm/src/textures/webm.cpp
+++ b/rawrbox.webm/src/textures/webm.cpp
@@ -28,14 +28,18 @@ namespace rawrbox {
this->_data.size = this->_webm->getSize();
this->_data.createFrame();
- } catch (const cpptrace::exception_with_message& err) {
+#ifdef RAWRBOX_TRACE_EXCEPTIONS
+ } catch (const cpptrace::exception_with_message& e) {
+#else
+ } catch (const std::exception& e) {
+#endif
if (useFallback) {
- _logger->warn("Failed to load '{}' ──> \n\t{}\n\t\t └── Loading fallback texture!", this->_filePath.generic_string(), err.message());
+ _logger->warn("Failed to load '{}' ──> \n\t{}\n\t\t └── Loading fallback texture!", this->_filePath.generic_string(), e.what());
this->loadFallback();
return;
}
- throw err;
+ throw e;
}
}
diff --git a/samples/001-stencil/CMakeLists.txt b/samples/001-stencil/CMakeLists.txt
index b57c04df..1d385884 100644
--- a/samples/001-stencil/CMakeLists.txt
+++ b/samples/001-stencil/CMakeLists.txt
@@ -18,6 +18,6 @@ set_lib_runtime_mt(${output_target})
if(NOT WIN32)
set_target_properties(${output_target} PROPERTIES LINK_FLAGS -Wl,-rpath,'\$ORIGIN')
else()
- add_compile_options("/EHsc")
+
copy_required_dlls(${output_target}) # Required by diligent
endif()
diff --git a/samples/002-generated-models/CMakeLists.txt b/samples/002-generated-models/CMakeLists.txt
index 06181be6..e075e86f 100644
--- a/samples/002-generated-models/CMakeLists.txt
+++ b/samples/002-generated-models/CMakeLists.txt
@@ -18,6 +18,6 @@ set_lib_runtime_mt(${output_target})
if(NOT WIN32)
set_target_properties(${output_target} PROPERTIES LINK_FLAGS -Wl,-rpath,'\$ORIGIN')
else()
- add_compile_options("/EHsc")
+
copy_required_dlls(${output_target}) # Required by diligent
endif()
diff --git a/samples/003-light/CMakeLists.txt b/samples/003-light/CMakeLists.txt
index 586b6dad..a2ce7fef 100644
--- a/samples/003-light/CMakeLists.txt
+++ b/samples/003-light/CMakeLists.txt
@@ -18,6 +18,6 @@ set_lib_runtime_mt(${output_target})
if(NOT WIN32)
set_target_properties(${output_target} PROPERTIES LINK_FLAGS -Wl,-rpath,'\$ORIGIN')
else()
- add_compile_options("/EHsc")
+
copy_required_dlls(${output_target}) # Required by diligent
endif()
diff --git a/samples/004-instancing/CMakeLists.txt b/samples/004-instancing/CMakeLists.txt
index 8b808749..b99b563c 100644
--- a/samples/004-instancing/CMakeLists.txt
+++ b/samples/004-instancing/CMakeLists.txt
@@ -8,7 +8,6 @@ file(GLOB_RECURSE RAWRBOX_SAMPLE_SOURCES "include/*.hpp" "src/*.cpp")
# Project setup
add_executable(${output_target} ${RAWRBOX_SAMPLE_SOURCES})
add_dependencies(${output_target} copy_resources_samples)
-target_compile_features(${output_target} PUBLIC cxx_std_20)
target_include_directories(${output_target} PRIVATE "include")
target_compile_features(${output_target} PRIVATE cxx_std_${CMAKE_CXX_STANDARD})
target_link_libraries(${output_target} PRIVATE RAWRBOX.RENDER)
@@ -19,6 +18,6 @@ set_lib_runtime_mt(${output_target})
if(NOT WIN32)
set_target_properties(${output_target} PROPERTIES LINK_FLAGS -Wl,-rpath,'\$ORIGIN')
else()
- add_compile_options("/EHsc")
+
copy_required_dlls(${output_target}) # Required by diligent
endif()
diff --git a/samples/005-post-process/CMakeLists.txt b/samples/005-post-process/CMakeLists.txt
index e2390e88..15b19333 100644
--- a/samples/005-post-process/CMakeLists.txt
+++ b/samples/005-post-process/CMakeLists.txt
@@ -18,6 +18,6 @@ set_lib_runtime_mt(${output_target})
if(NOT WIN32)
set_target_properties(${output_target} PROPERTIES LINK_FLAGS -Wl,-rpath,'\$ORIGIN')
else()
- add_compile_options("/EHsc")
+
copy_required_dlls(${output_target}) # Required by diligent
endif()
diff --git a/samples/006-decals/CMakeLists.txt b/samples/006-decals/CMakeLists.txt
index e608e6f5..38d06972 100644
--- a/samples/006-decals/CMakeLists.txt
+++ b/samples/006-decals/CMakeLists.txt
@@ -8,7 +8,6 @@ file(GLOB_RECURSE RAWRBOX_SAMPLE_SOURCES "include/*.hpp" "src/*.cpp")
# Project setup
add_executable(${output_target} ${RAWRBOX_SAMPLE_SOURCES})
add_dependencies(${output_target} copy_resources_samples)
-target_compile_features(${output_target} PUBLIC cxx_std_20)
target_include_directories(${output_target} PRIVATE "include")
target_compile_features(${output_target} PRIVATE cxx_std_${CMAKE_CXX_STANDARD})
target_link_libraries(${output_target} PRIVATE RAWRBOX.RENDER)
@@ -18,6 +17,6 @@ set_lib_runtime_mt(${output_target})
if(NOT WIN32)
set_target_properties(${output_target} PROPERTIES LINK_FLAGS -Wl,-rpath,'\$ORIGIN')
else()
- add_compile_options("/EHsc")
+
copy_required_dlls(${output_target}) # Required by diligent
endif()
diff --git a/samples/007-particle-system/CMakeLists.txt b/samples/007-particle-system/CMakeLists.txt
index 7e4154cf..d5210406 100644
--- a/samples/007-particle-system/CMakeLists.txt
+++ b/samples/007-particle-system/CMakeLists.txt
@@ -18,6 +18,6 @@ set_lib_runtime_mt(${output_target})
if(NOT WIN32)
set_target_properties(${output_target} PROPERTIES LINK_FLAGS -Wl,-rpath,'\$ORIGIN')
else()
- add_compile_options("/EHsc")
+
copy_required_dlls(${output_target}) # Required by diligent
endif()
diff --git a/samples/008-ui/CMakeLists.txt b/samples/008-ui/CMakeLists.txt
index f496d0bf..6914ba3e 100644
--- a/samples/008-ui/CMakeLists.txt
+++ b/samples/008-ui/CMakeLists.txt
@@ -18,6 +18,6 @@ set_lib_runtime_mt(${output_target})
if(NOT WIN32)
set_target_properties(${output_target} PROPERTIES LINK_FLAGS -Wl,-rpath,'\$ORIGIN')
else()
- add_compile_options("/EHsc")
+
copy_required_dlls(${output_target}) # Required by diligent
endif()
diff --git a/samples/009-assimp/CMakeLists.txt b/samples/009-assimp/CMakeLists.txt
index 3577e63c..34e77ff4 100644
--- a/samples/009-assimp/CMakeLists.txt
+++ b/samples/009-assimp/CMakeLists.txt
@@ -18,6 +18,6 @@ set_lib_runtime_mt(${output_target})
if(NOT WIN32)
set_target_properties(${output_target} PROPERTIES LINK_FLAGS -Wl,-rpath,'\$ORIGIN')
else()
- add_compile_options("/EHsc")
+
copy_required_dlls(${output_target}) # Required by diligent
endif()
diff --git a/samples/010-bass-audio/CMakeLists.txt b/samples/010-bass-audio/CMakeLists.txt
index baf39d13..94d15fad 100644
--- a/samples/010-bass-audio/CMakeLists.txt
+++ b/samples/010-bass-audio/CMakeLists.txt
@@ -18,6 +18,6 @@ set_lib_runtime_mt(${output_target})
if(NOT WIN32)
set_target_properties(${output_target} PROPERTIES LINK_FLAGS -Wl,-rpath,'\$ORIGIN')
else()
- add_compile_options("/EHsc")
+
copy_required_dlls(${output_target}) # Required by diligent
endif()
diff --git a/samples/011-physics-3D/CMakeLists.txt b/samples/011-physics-3D/CMakeLists.txt
index 08826c5f..3e11fef1 100644
--- a/samples/011-physics-3D/CMakeLists.txt
+++ b/samples/011-physics-3D/CMakeLists.txt
@@ -8,7 +8,6 @@ file(GLOB_RECURSE RAWRBOX_SAMPLE_SOURCES "include/*.hpp" "src/*.cpp")
# Project setup
add_executable(${output_target} ${RAWRBOX_SAMPLE_SOURCES})
add_dependencies(${output_target} copy_resources_samples)
-target_compile_features(${output_target} PUBLIC cxx_std_20)
target_include_directories(${output_target} PRIVATE "include")
target_compile_features(${output_target} PRIVATE cxx_std_${CMAKE_CXX_STANDARD})
target_link_libraries(${output_target} PRIVATE RAWRBOX.RENDER RAWRBOX.PHYSICS.3D)
@@ -18,6 +17,6 @@ set_lib_runtime_mt(${output_target})
if(NOT WIN32)
set_target_properties(${output_target} PROPERTIES LINK_FLAGS -Wl,-rpath,'\$ORIGIN')
else()
- add_compile_options("/EHsc")
+
copy_required_dlls(${output_target}) # Required by diligent
endif()
diff --git a/samples/011-physics-3D/include/phys_3d_test/game.hpp b/samples/011-physics-3D/include/phys_3d_test/game.hpp
index b757fa0c..629d9bff 100644
--- a/samples/011-physics-3D/include/phys_3d_test/game.hpp
+++ b/samples/011-physics-3D/include/phys_3d_test/game.hpp
@@ -1,7 +1,11 @@
#pragma once
#include
-#include
+
+#ifdef _DEBUG
+ #include
+#endif
+
#include
#include
#include
@@ -20,7 +24,7 @@ namespace phys_3d_test {
std::unique_ptr> _modelGrid = std::make_unique>();
std::vector> _boxes = std::vector>();
-#ifdef JPH_DEBUG_RENDERER
+#ifdef _DEBUG
std::unique_ptr _physDebug = nullptr;
#endif
diff --git a/samples/011-physics-3D/src/game.cpp b/samples/011-physics-3D/src/game.cpp
index 5d1c0303..b1bc7750 100644
--- a/samples/011-physics-3D/src/game.cpp
+++ b/samples/011-physics-3D/src/game.cpp
@@ -67,7 +67,7 @@ namespace phys_3d_test {
// rawrbox::PHYSICS::onBodyAwake += [](const JPH::BodyID& id, uint64_t inBodyUserData) { fmt::print("Body awake \n"); };
// rawrbox::PHYSICS::onBodySleep += [](const JPH::BodyID& id, uint64_t inBodyUserData) { fmt::print("Body sleep \n"); };
-#ifdef JPH_DEBUG_RENDERER
+#ifdef _DEBUG
this->_physDebug = std::make_unique();
#endif
// ----------------------------
@@ -197,7 +197,7 @@ namespace phys_3d_test {
void Game::onThreadShutdown(rawrbox::ENGINE_THREADS thread) {
if (thread == rawrbox::ENGINE_THREADS::THREAD_RENDER) {
this->_modelGrid.reset();
-#ifdef JPH_DEBUG_RENDERER
+#ifdef _DEBUG
this->_physDebug.reset();
#endif
this->_boxes.clear();
@@ -250,7 +250,7 @@ namespace phys_3d_test {
auto* stencil = rawrbox::RENDERER->stencil();
stencil->drawText(fmt::format("[F1] PAUSED: {}", !rawrbox::PHYSICS::simulate), {15, 15});
-#ifdef JPH_DEBUG_RENDERER
+#ifdef _DEBUG
stencil->drawText(fmt::format("[F2] DEBUG: {}", this->_debug), {15, 28});
stencil->drawText(fmt::format("[F3] CLEAR"), {15, 48});
diff --git a/samples/012-physics-2D/CMakeLists.txt b/samples/012-physics-2D/CMakeLists.txt
index 9d8bba3d..7b48450c 100644
--- a/samples/012-physics-2D/CMakeLists.txt
+++ b/samples/012-physics-2D/CMakeLists.txt
@@ -8,7 +8,6 @@ file(GLOB_RECURSE RAWRBOX_SAMPLE_SOURCES "include/*.hpp" "src/*.cpp")
# Project setup
add_executable(${output_target} ${RAWRBOX_SAMPLE_SOURCES})
add_dependencies(${output_target} copy_resources_samples)
-target_compile_features(${output_target} PUBLIC cxx_std_20)
target_include_directories(${output_target} PRIVATE "include")
target_compile_features(${output_target} PRIVATE cxx_std_${CMAKE_CXX_STANDARD})
target_link_libraries(${output_target} PRIVATE RAWRBOX.RENDER RAWRBOX.PHYSICS.2D)
@@ -18,6 +17,6 @@ set_lib_runtime_mt(${output_target})
if(NOT WIN32)
set_target_properties(${output_target} PROPERTIES LINK_FLAGS -Wl,-rpath,'\$ORIGIN')
else()
- add_compile_options("/EHsc")
+
copy_required_dlls(${output_target}) # Required by diligent
endif()
diff --git a/samples/013-webm/CMakeLists.txt b/samples/013-webm/CMakeLists.txt
index 091d6bb0..836fba25 100644
--- a/samples/013-webm/CMakeLists.txt
+++ b/samples/013-webm/CMakeLists.txt
@@ -8,7 +8,6 @@ file(GLOB_RECURSE RAWRBOX_SAMPLE_SOURCES "include/*.hpp" "src/*.cpp")
# Project setup
add_executable(${output_target} ${RAWRBOX_SAMPLE_SOURCES})
add_dependencies(${output_target} copy_resources_samples)
-target_compile_features(${output_target} PUBLIC cxx_std_20)
target_include_directories(${output_target} PRIVATE "include")
target_compile_features(${output_target} PRIVATE cxx_std_${CMAKE_CXX_STANDARD})
target_link_libraries(${output_target} PRIVATE RAWRBOX.RENDER RAWRBOX.WEBM)
@@ -18,6 +17,6 @@ set_lib_runtime_mt(${output_target})
if(NOT WIN32)
set_target_properties(${output_target} PROPERTIES LINK_FLAGS -Wl,-rpath,'\$ORIGIN')
else()
- add_compile_options("/EHsc")
+
copy_required_dlls(${output_target}) # Required by diligent
endif()
diff --git a/samples/014-scripting/CMakeLists.txt b/samples/014-scripting/CMakeLists.txt
index 6a32680c..80ca3c37 100644
--- a/samples/014-scripting/CMakeLists.txt
+++ b/samples/014-scripting/CMakeLists.txt
@@ -27,8 +27,6 @@ endif()
add_executable(${output_target} ${RAWRBOX_SAMPLE_SOURCES})
add_dependencies(${output_target} link_mods_samples)
add_dependencies(${output_target} copy_resources_samples)
-
-target_compile_features(${output_target} PUBLIC cxx_std_20)
target_include_directories(${output_target} PRIVATE "include")
target_compile_features(${output_target} PRIVATE cxx_std_${CMAKE_CXX_STANDARD})
target_link_libraries(${output_target} PRIVATE RAWRBOX.RENDER RAWRBOX.SCRIPTING ${EXTRA_LIBS})
@@ -38,6 +36,6 @@ set_lib_runtime_mt(${output_target})
if(NOT WIN32)
set_target_properties(${output_target} PROPERTIES LINK_FLAGS -Wl,-rpath,'\$ORIGIN')
else()
- add_compile_options("/EHsc")
+
copy_required_dlls(${output_target}) # Required by diligent
endif()
diff --git a/samples/015-gpu-picking/CMakeLists.txt b/samples/015-gpu-picking/CMakeLists.txt
index f04c580e..01fbc685 100644
--- a/samples/015-gpu-picking/CMakeLists.txt
+++ b/samples/015-gpu-picking/CMakeLists.txt
@@ -18,6 +18,6 @@ set_lib_runtime_mt(${output_target})
if(NOT WIN32)
set_target_properties(${output_target} PROPERTIES LINK_FLAGS -Wl,-rpath,'\$ORIGIN')
else()
- add_compile_options("/EHsc")
+
copy_required_dlls(${output_target}) # Required by diligent
endif()
diff --git a/samples/016-steamworks/CMakeLists.txt b/samples/016-steamworks/CMakeLists.txt
index 95c1be4c..f171e5d3 100644
--- a/samples/016-steamworks/CMakeLists.txt
+++ b/samples/016-steamworks/CMakeLists.txt
@@ -18,6 +18,5 @@ set_lib_runtime_mt(${output_target})
if(NOT WIN32)
set_target_properties(${output_target} PROPERTIES LINK_FLAGS -Wl,-rpath,'\$ORIGIN')
else()
- add_compile_options("/EHsc")
copy_required_dlls(${output_target}) # Required by diligent
endif()
diff --git a/samples/017-imgui/CMakeLists.txt b/samples/017-imgui/CMakeLists.txt
index 04d10bb3..c31cd8fc 100644
--- a/samples/017-imgui/CMakeLists.txt
+++ b/samples/017-imgui/CMakeLists.txt
@@ -18,6 +18,6 @@ set_lib_runtime_mt(${output_target})
if(NOT WIN32)
set_target_properties(${output_target} PROPERTIES LINK_FLAGS -Wl,-rpath,'\$ORIGIN')
else()
- add_compile_options("/EHsc")
+
copy_required_dlls(${output_target}) # Required by diligent
endif()