Skip to content

Commit 198728c

Browse files
committed
Added reflection implementation and fixed various compile errors exposed by Clang 21/C++26
1 parent e44887b commit 198728c

16 files changed

Lines changed: 593 additions & 30 deletions

File tree

CMakeLists.txt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -283,8 +283,7 @@ endif()
283283

284284
set(CMAKE_CXX_EXTENSIONS OFF )
285285
set(CXX_EXTENSIONS OFF )
286-
set(CMAKE_CXX_STANDARD 23)
287-
list(APPEND PE_COMPILER_FEATURES cxx_std_23)
286+
set(CMAKE_CXX_STANDARD 26)
288287

289288
if(PE_GLES)
290289
find_package(OpenGL REQUIRED)
@@ -333,7 +332,7 @@ else()
333332
if(PE_VERBOSE)
334333
list(APPEND PE_COMPILE_OPTIONS -Wall;-Wextra)
335334
endif()
336-
list(APPEND PE_COMPILE_OPTIONS -fstrict-aliasing;-Wno-switch;-Wno-unknown-pragmas;-Wno-unused-function;-g)
335+
list(APPEND PE_COMPILE_OPTIONS -fstrict-aliasing;-stdlib=libc++;-Wno-switch;-Wno-unknown-pragmas;-Wno-unused-function;-g;-Wno-missing-template-arg-list-after-template-kw;-freflection-latest;-Wno-enum-enum-conversion)
337336
list(APPEND PE_COMPILE_OPTIONS
338337
$<$<CONFIG:Debug>: -gdwarf-2>
339338
$<$<CONFIG:Release>: -fomit-frame-pointer;-ffunction-sections;-fdata-sections>)

assembler/CMakeLists.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
set(LOCAL_PROJECT assembler)
22
include(FetchContent)
33

4-
set(CMAKE_CXX_EXTENSIONS OFF )
5-
set(CXX_EXTENSIONS OFF )
6-
set(CMAKE_CXX_STANDARD 23)
74
option(AS_DEVMODE "Enable this for slightly easier dev experience where the app doesn't auto-shut by default" OFF)
85
option(AS_ENABLE_INSTALL "Enable installation" OFF)
96

assembler/src/details/shader_cache.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#include "details/shader_cache.hpp"
22
#include "stdafx.hpp"
3+
#include <chrono>
34

45
namespace assembler::details {
56
auto shader_cache_t::get_transformed_content(entry_t const& entry) -> std::optional<psl::string> {

core/src/audio/engine.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ bool engine_t::init_audio(audio_t const& audio) const {
3838

3939
auto result = ma_audio_buffer_init(&bufferConfig, buffer);
4040
if(result != MA_SUCCESS) {
41-
delete(audio.m_EngineBuffer);
41+
delete((ma_audio_buffer*)audio.m_EngineBuffer);
4242
audio.m_EngineBuffer = nullptr;
4343
core::log->error("Failed to initialize audio buffer.");
4444
return false;
@@ -48,9 +48,9 @@ bool engine_t::init_audio(audio_t const& audio) const {
4848
result = ma_sound_init_from_data_source(
4949
m_Engine.get(), buffer, MA_SOUND_FLAG_NO_SPATIALIZATION, nullptr, (ma_sound*)audio.m_EngineSound);
5050
if(result != MA_SUCCESS) {
51-
delete(audio.m_EngineBuffer);
51+
delete((ma_audio_buffer*)audio.m_EngineBuffer);
5252
audio.m_EngineBuffer = nullptr;
53-
delete(audio.m_EngineSound);
53+
delete((ma_sound*)audio.m_EngineSound);
5454
audio.m_EngineSound = nullptr;
5555
core::log->error("Failed to initialize sound.");
5656
return false;
@@ -60,9 +60,9 @@ bool engine_t::init_audio(audio_t const& audio) const {
6060
void engine_t::deinit_audio(audio_t const& audio) const {
6161
if(audio.m_EngineSound) {
6262
ma_sound_uninit((ma_sound*)audio.m_EngineSound);
63-
delete(audio.m_EngineSound);
63+
delete((ma_sound*)audio.m_EngineSound);
6464
audio.m_EngineSound = nullptr;
65-
delete(audio.m_EngineBuffer);
65+
delete((ma_audio_buffer*)audio.m_EngineBuffer);
6666
audio.m_EngineBuffer = nullptr;
6767
}
6868
}

core/src/logging.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ auto core::initialize_loggers(bool to_file, bool to_terminal) -> void {
191191
mainlogger->add_sink(std::make_shared<spdlog::sinks::msvc_sink_mt>());
192192
#else
193193
auto outlogger = std::make_shared<spdlog::sinks::stdout_color_sink_mt>();
194-
outlogger->set_level(spdlog::level::level_enum::warn);
194+
outlogger->set_level(spdlog::level::level_enum::info);
195195
mainlogger->add_sink(outlogger);
196196
#endif
197197
}

examples/PlayAudio/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ int entry(core::gfx::graphics_backend backend, std::unique_ptr<core::os::context
4747
psl::ecs::state_t state {};
4848
auto gpuCameraSystem = core::ecs::systems::gpu_camera {
4949
state, engine_instance.surface(), engine_instance.frame_cam_buffer_binding(), backend};
50-
auto renderSystem = core::ecs::systems::render {state, engine_instance.swapchain()};
50+
auto renderSystem = core::ecs::systems::render {state, engine_instance.swapchain()};
5151
renderSystem.add_render_range(0, 1000);
5252

5353
auto audioSystem = core::ecs::systems::audio_t(state, audioEngineHandle);

examples/Shared/inc/examples/cli_parser.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#pragma once
2-
#include <vector>
32
#include <string_view>
3+
#include <vector>
44

55
#include "core/gfx/types.hpp"
66

examples/Shared/inc/examples/engine_instance.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ class engine_instance_t {
7575
~engine_instance_t();
7676
/// \brief This method runs until the surface or os context is closed.
7777
/// Every frame, it will call the callback function.
78-
void run(std::function<void(engine_instance_t const&, std::chrono::duration<float>, std::chrono::duration<float>)> callback);
78+
void run(std::function<void(engine_instance_t const&, std::chrono::duration<float>, std::chrono::duration<float>)>
79+
callback);
7980

8081
core::resource::handle<core::gfx::context> const& context() const noexcept {
8182
return m_ContextHandle;

examples/Shared/src/engine_instance.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ engine_instance_t::engine_instance_t(options_t options, std::unique_ptr<core::os
4242
m_MemoryRegion = std::make_unique<memory::region>(options.cpu_backed_memory_region.size,
4343
options.cpu_backed_memory_region.alignment,
4444
new memory::default_allocator());
45-
m_Cache = std::make_unique<core::resource::cache_t>(psl::meta::library {"./data/resources.metalib", {{environment}}});
45+
m_Cache =
46+
std::make_unique<core::resource::cache_t>(psl::meta::library {"./data/resources.metalib", {{environment}}});
4647

4748
auto& cache = *m_Cache;
4849

@@ -146,7 +147,8 @@ engine_instance_t::~engine_instance_t() {
146147
m_MemoryRegion.reset();
147148
}
148149

149-
void engine_instance_t::run(std::function<void(engine_instance_t const&, std::chrono::duration<float>, std::chrono::duration<float>)> callback) {
150+
void engine_instance_t::run(
151+
std::function<void(engine_instance_t const&, std::chrono::duration<float>, std::chrono::duration<float>)> callback) {
150152
std::chrono::high_resolution_clock::time_point last_tick = std::chrono::high_resolution_clock::now();
151153
std::chrono::duration<float> dTime {};
152154
std::chrono::duration<float> elapsed {};

psl/inc.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ logging
3131
meta
3232
pack_view
3333
platform_def
34+
reflection
3435
sparse_array
3536
static_array
3637
stdafx_psl

0 commit comments

Comments
 (0)