Tweaking the build to turn on various debug options in GCC and enable -Wall -Werror on only our executable configs because turning them on globally causes most of the dependencies to fail. One thing to note is if you try to move the -D_GLIBCXX options from the project() to the executable() then you get segfaults inside the libc++ and other places. This is because the ABI changes when you enable these options, so you have to recompile _all_ dependencies with these options.

master
Zed A. Shaw 2 months ago
parent 4c3049df14
commit ea3dd204a1
  1. 2
      Makefile
  2. 22
      meson.build
  3. 4
      raycaster.cpp
  4. 2
      scripts/reset_build.ps1
  5. 11
      wraps/tracy.wrap

@ -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:

@ -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)

@ -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) {

@ -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

@ -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

Loading…
Cancel
Save