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.
This commit is contained in:
parent
4c3049df14
commit
ea3dd204a1
5 changed files with 22 additions and 19 deletions
2
Makefile
2
Makefile
|
@ -10,7 +10,7 @@ build:
|
||||||
meson compile -j 10 -C builddir
|
meson compile -j 10 -C builddir
|
||||||
|
|
||||||
release_build:
|
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
|
meson compile -j 10 -C builddir
|
||||||
|
|
||||||
debug_build:
|
debug_build:
|
||||||
|
|
22
meson.build
22
meson.build
|
@ -1,12 +1,17 @@
|
||||||
project('raycaster', 'cpp',
|
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')
|
cc = meson.get_compiler('cpp')
|
||||||
|
|
||||||
tracy = dependency('tracy', static: true)
|
tracy = dependency('tracy', static: true)
|
||||||
catch2 = dependency('catch2-with-main')
|
catch2 = dependency('catch2-with-main')
|
||||||
fmt = dependency('fmt')
|
fmt = dependency('fmt', allow_fallback: true)
|
||||||
freetype = dependency('freetype2')
|
freetype2 = dependency('freetype2')
|
||||||
json = dependency('nlohmann_json')
|
json = dependency('nlohmann_json')
|
||||||
opengl32 = cc.find_library('opengl32', required: true)
|
opengl32 = cc.find_library('opengl32', required: true)
|
||||||
winmm = cc.find_library('winmm', required: true)
|
winmm = cc.find_library('winmm', required: true)
|
||||||
|
@ -23,17 +28,17 @@ if get_option('tracy_enable') and get_option('buildtype') != 'debugoptimized'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
fmt, json, opengl32, freetype,
|
fmt, json, opengl32, freetype2,
|
||||||
winmm, gdi32, sfml_audio, sfml_graphics,
|
winmm, gdi32, sfml_audio, sfml_graphics,
|
||||||
sfml_main, sfml_network, sfml_system,
|
sfml_main, sfml_network, sfml_system,
|
||||||
sfml_window
|
sfml_window, tracy
|
||||||
]
|
]
|
||||||
|
|
||||||
executable('runtests', [
|
executable('runtests', [
|
||||||
'dbc.cpp',
|
'dbc.cpp',
|
||||||
'matrix.cpp',
|
'matrix.cpp',
|
||||||
'tests/base.cpp',
|
'tests/base.cpp',
|
||||||
],
|
], override_options: exe_defaults,
|
||||||
dependencies: dependencies + [catch2])
|
dependencies: dependencies + [catch2])
|
||||||
|
|
||||||
executable('zedcaster', [
|
executable('zedcaster', [
|
||||||
|
@ -45,6 +50,8 @@ executable('zedcaster', [
|
||||||
'stats.cpp',
|
'stats.cpp',
|
||||||
'main.cpp'
|
'main.cpp'
|
||||||
],
|
],
|
||||||
|
cpp_args: cpp_args,
|
||||||
|
override_options: exe_defaults,
|
||||||
dependencies: dependencies)
|
dependencies: dependencies)
|
||||||
|
|
||||||
executable('amtcaster', [
|
executable('amtcaster', [
|
||||||
|
@ -53,6 +60,5 @@ executable('amtcaster', [
|
||||||
'amt/texture.cpp',
|
'amt/texture.cpp',
|
||||||
'amt/raycaster.cpp',
|
'amt/raycaster.cpp',
|
||||||
'amt/main.cpp'
|
'amt/main.cpp'
|
||||||
],
|
], override_options: exe_defaults,
|
||||||
cpp_args: ['-std=c++23'],
|
|
||||||
dependencies: dependencies)
|
dependencies: dependencies)
|
||||||
|
|
|
@ -137,8 +137,8 @@ void Raycaster::sprite_casting() {
|
||||||
int texY = ((d * textureHeight) / spriteHeight) / 256;
|
int texY = ((d * textureHeight) / spriteHeight) / 256;
|
||||||
//get current color from the texture
|
//get current color from the texture
|
||||||
// BUG: this crashes sometimes when the math goes out of bounds
|
// BUG: this crashes sometimes when the math goes out of bounds
|
||||||
size_t index = textureWidth * texY + texX;
|
int index = textureWidth * texY + texX;
|
||||||
if(index < 0 || index >= sprite_texture.size()) continue;
|
if(index < 0 || (size_t)index >= sprite_texture.size()) continue;
|
||||||
uint32_t color = sprite_texture[index];
|
uint32_t color = sprite_texture[index];
|
||||||
// poor person's transparency, get current color from the texture
|
// poor person's transparency, get current color from the texture
|
||||||
if((color & 0x00FFFFFF) != 0) {
|
if((color & 0x00FFFFFF) != 0) {
|
||||||
|
|
|
@ -1,10 +1,7 @@
|
||||||
[wrap-file]
|
[wrap-git]
|
||||||
directory = tracy-0.10
|
url=https://github.com/wolfpld/tracy.git
|
||||||
source_url = https://github.com/wolfpld/tracy/archive/refs/tags/v0.10.tar.gz
|
revision=v0.11.1
|
||||||
source_filename = tracy-0.10.tar.gz
|
depth=1
|
||||||
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
|
|
||||||
|
|
||||||
[provide]
|
[provide]
|
||||||
tracy = tracy_dep
|
tracy = tracy_dep
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue