Skip to content

Commit 256aa2f

Browse files
committed
-Dev: added Ninja as build system to cmake config
1 parent 06c1e41 commit 256aa2f

File tree

13 files changed

+160
-17
lines changed

13 files changed

+160
-17
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ endif()
1818

1919

2020
# Set the platform (e.g., x64)
21-
set(CMAKE_GENERATOR_PLATFORM x64) # or Win32, as needed
21+
# set(CMAKE_GENERATOR_PLATFORM x64) # or Win32, as needed
2222

2323
# Use C++17
2424
set(CMAKE_CXX_STANDARD 17)

CMakePresets.json

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
2+
{
3+
"version": 3,
4+
"cmakeMinimumRequired": {
5+
"major": 3,
6+
"minor": 16,
7+
"patch": 0
8+
},
9+
10+
"configurePresets": [
11+
{
12+
"name": "ninja-debug",
13+
"displayName": "Ninja (Debug)",
14+
"generator": "Ninja",
15+
"binaryDir": "${sourceDir}/build/ninja-debug",
16+
"cacheVariables": {
17+
"CMAKE_CXX_COMPILER": "clang++",
18+
"CMAKE_C_COMPILER": "clang",
19+
"CMAKE_CXX_STANDARD": "17",
20+
"CMAKE_CXX_STANDARD_REQUIRED": "ON",
21+
"CMAKE_CXX_EXTENSIONS": "OFF",
22+
"CMAKE_BUILD_TYPE": "Debug"
23+
}
24+
25+
},
26+
{
27+
"name": "ninja-release",
28+
"displayName": "Ninja (Release)",
29+
"generator": "Ninja",
30+
"binaryDir": "${sourceDir}/build/ninja-release",
31+
"cacheVariables": {
32+
"CMAKE_CXX_COMPILER": "clang++",
33+
"CMAKE_C_COMPILER": "clang",
34+
"CMAKE_CXX_STANDARD": "17",
35+
"CMAKE_CXX_STANDARD_REQUIRED": "ON",
36+
"CMAKE_CXX_EXTENSIONS": "OFF",
37+
"CMAKE_BUILD_TYPE": "Release"
38+
}
39+
},
40+
{
41+
"name": "vs2022-x64-debug",
42+
"displayName": "Visual Studio 2022 (x64) (Debug)",
43+
"generator": "Visual Studio 17 2022",
44+
"architecture": "x64",
45+
"binaryDir": "${sourceDir}/build/vs2022-x64-debug",
46+
"cacheVariables": {
47+
"CMAKE_BUILD_TYPE": "Debug"
48+
}
49+
},
50+
{
51+
"name": "vs2022-x64-release",
52+
"displayName": "Visual Studio 2022 (x64) (Release)",
53+
"generator": "Visual Studio 17 2022",
54+
"architecture": "x64",
55+
"binaryDir": "${sourceDir}/build/vs2022-x64-release",
56+
"cacheVariables": {
57+
"CMAKE_BUILD_TYPE": "Release"
58+
}
59+
}
60+
],
61+
62+
"buildPresets": [
63+
{
64+
"name": "ninja-debug",
65+
"configurePreset": "ninja-debug"
66+
},
67+
{
68+
"name": "ninja-release",
69+
"configurePreset": "ninja-release"
70+
},
71+
{
72+
"name": "vs2022-x64-release",
73+
"configurePreset": "vs2022-x64-release",
74+
"configuration": "Release"
75+
},
76+
{
77+
"name": "vs2022-x64-debug",
78+
"configurePreset": "vs2022-x64-debug",
79+
"configuration": "Debug"
80+
}
81+
]
82+
}

examples/sponza/application.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ void Application::setup_gui() {
7373
explorerPanel->add_child(new Tools::Space());
7474
explorerPanel->add_child(new Tools::ControllerWidget(m_controller));
7575
explorerPanel->add_child(new Tools::Separator());
76-
explorerPanel->add_child(new Tools::TextLine(" Application average"));
76+
explorerPanel->add_child(new Tools::TextLine("Application average"));
7777
explorerPanel->add_child(new Tools::Profiler());
7878
explorerPanel->add_child(new Tools::Space());
7979

include/engine/core/passes/pass.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ class BasePass
8787
: m_framebuffers.resize(m_device->get_swapchain().get_present_images().size());
8888
m_imageExtent = extent;
8989
}
90+
virtual ~BasePass(){
91+
}
9092

9193
#pragma region Getters & Setters
9294

include/engine/core/scene/light.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ class Light : public Object3D
5454
m_nonRaytraceCount++;
5555
}
5656

57+
virtual ~Light(){}
58+
5759
virtual inline Vec3 get_color() const {
5860
return m_color;
5961
}

include/engine/core/scene/scene.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,12 @@ class Scene : public Object3D
5454
break;
5555
case ObjectType::LIGHT:
5656
m_lights.push_back(static_cast<Light*>(obj));
57+
break;
58+
default:
59+
5760
break;
5861
}
62+
5963
for (auto child : obj->get_children())
6064
classify_object(child);
6165
}

include/engine/systems/renderers/renderer.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,14 +97,11 @@ class BaseRenderer
9797
inline void set_depth_format(ColorFormatType d) {
9898
m_settings.depthFormat = d;
9999
}
100-
inline void set_enable_gui(bool op) {
101-
m_settings.enableUI = op;
102-
}
103100
inline std::vector<Core::BasePass*> get_render_passes() const {
104101
return m_passes;
105102
}
106103
inline void enable_gui_overlay(bool op) {
107-
m_settings.enableUI;
104+
m_settings.enableUI = op;
108105
}
109106
inline void set_sync_type(SyncType sync) {
110107
m_settings.screenSync = sync;

setup/build_debug_ninja.bat

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
@echo off
2+
3+
cd ..
4+
mkdir build
5+
6+
REM
7+
set BUILD_DIR=build
8+
9+
REM
10+
where ninja >nul 2>&1
11+
if %ERRORLEVEL% EQU 0 (
12+
echo ✅ Ninja found. Generating build files with Ninja...
13+
cmake -G Ninja -S . -B %BUILD_DIR%
14+
) else (
15+
echo ⚠️ Ninja not found. Falling back to Visual Studio 2022...
16+
cmake -G "Visual Studio 17 2022" -A x64 -S . -B %BUILD_DIR%
17+
)
18+
19+
cmake --build build --config Debug
20+
21+
pause>nul
22+
exit

0 commit comments

Comments
 (0)