diff --git a/Makefile b/Makefile index f0bcaa8..eca5801 100644 --- a/Makefile +++ b/Makefile @@ -10,7 +10,7 @@ build: meson compile -j 10 -C builddir release_build: - meson --wipe builddir -Dcpp_args=-DNDEBUG=1 --buildtype release + meson --wipe builddir -Db_ndebug=true --buildtype release meson compile -j 10 -C builddir debug_build: diff --git a/meson.build b/meson.build index 566403e..02731b5 100644 --- a/meson.build +++ b/meson.build @@ -1,12 +1,17 @@ project('raycaster', 'cpp', - default_options: ['cpp_std=c++20']) + version: '0.1.0', + default_options: [ + 'cpp_std=c++20', + 'cpp_args=-D_GLIBCXX_DEBUG=1 -D_GLIBCXX_DEBUG_PEDANTIC=1', + ]) +exe_defaults = ['warning_level=2', 'werror=true'] cc = meson.get_compiler('cpp') tracy = dependency('tracy', static: true) catch2 = dependency('catch2-with-main') -fmt = dependency('fmt') -freetype = dependency('freetype2') +fmt = dependency('fmt', allow_fallback: true) +freetype2 = dependency('freetype2') json = dependency('nlohmann_json') opengl32 = cc.find_library('opengl32', required: true) winmm = cc.find_library('winmm', required: true) @@ -23,17 +28,17 @@ if get_option('tracy_enable') and get_option('buildtype') != 'debugoptimized' endif dependencies = [ - fmt, json, opengl32, freetype, + fmt, json, opengl32, freetype2, winmm, gdi32, sfml_audio, sfml_graphics, sfml_main, sfml_network, sfml_system, - sfml_window + sfml_window, tracy ] executable('runtests', [ 'dbc.cpp', 'matrix.cpp', 'tests/base.cpp', - ], + ], override_options: exe_defaults, dependencies: dependencies + [catch2]) executable('zedcaster', [ @@ -45,6 +50,8 @@ executable('zedcaster', [ 'stats.cpp', 'main.cpp' ], + cpp_args: cpp_args, + override_options: exe_defaults, dependencies: dependencies) executable('amtcaster', [ @@ -53,6 +60,5 @@ executable('amtcaster', [ 'amt/texture.cpp', 'amt/raycaster.cpp', 'amt/main.cpp' - ], - cpp_args: ['-std=c++23'], + ], override_options: exe_defaults, dependencies: dependencies) diff --git a/raycaster.cpp b/raycaster.cpp index a1034a1..a8432e3 100644 --- a/raycaster.cpp +++ b/raycaster.cpp @@ -137,8 +137,8 @@ void Raycaster::sprite_casting() { int texY = ((d * textureHeight) / spriteHeight) / 256; //get current color from the texture // BUG: this crashes sometimes when the math goes out of bounds - size_t index = textureWidth * texY + texX; - if(index < 0 || index >= sprite_texture.size()) continue; + int index = textureWidth * texY + texX; + if(index < 0 || (size_t)index >= sprite_texture.size()) continue; uint32_t color = sprite_texture[index]; // poor person's transparency, get current color from the texture if((color & 0x00FFFFFF) != 0) { diff --git a/scripts/reset_build.ps1 b/scripts/reset_build.ps1 index af8305b..975852d 100644 --- a/scripts/reset_build.ps1 +++ b/scripts/reset_build.ps1 @@ -4,4 +4,4 @@ mkdir subprojects mv .\packagecache .\subprojects\ mkdir builddir cp wraps\*.wrap subprojects\ -meson setup --default-library=static --prefer-static builddir +meson setup --default-library=static --prefer-static builddir diff --git a/wraps/tracy.wrap b/wraps/tracy.wrap index d143185..3e1bda5 100644 --- a/wraps/tracy.wrap +++ b/wraps/tracy.wrap @@ -1,10 +1,7 @@ -[wrap-file] -directory = tracy-0.10 -source_url = https://github.com/wolfpld/tracy/archive/refs/tags/v0.10.tar.gz -source_filename = tracy-0.10.tar.gz -source_hash = a76017d928f3f2727540fb950edd3b736caa97b12dbb4e5edce66542cbea6600 -source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/tracy_0.10-1/tracy-0.10.tar.gz -wrapdb_version = 0.10-1 +[wrap-git] +url=https://github.com/wolfpld/tracy.git +revision=v0.11.1 +depth=1 [provide] tracy = tracy_dep