add build option to enable or disable debugging code

This commit is contained in:
Joshua Smith 2024-10-23 13:52:36 -05:00
parent 37222bb7af
commit d43f2c4e67
4 changed files with 18 additions and 9 deletions

View File

@ -18,11 +18,13 @@ export NINJA_STATUS="[%p %f/%t] "
export MESON_RSP_THRESHOLD=16387
# Build the project
"${MESON:-meson}" configure build "-Dgdb_debugging=false"
if [ "$target" = test ]; then
"${MESON:-meson}" test -C build "$@"
elif [ "$target" = rom ]; then
"${MESON:-meson}" compile -C build "pokeplatinum.us.nds"
elif [ "$target" = debug ]; then
"${MESON:-meson}" configure build "-Dgdb_debugging=true"
"${MESON:-meson}" compile -C build "pokeplatinum.us.nds" "debug.nef" "overlay.map"
else
"${MESON:-meson}" compile -C build "$target" "$@"

View File

@ -13,10 +13,6 @@ void Overlay_UnloadByID(const FSOverlayID param0);
int Overlay_GetLoadDestination(const FSOverlayID param0);
BOOL Overlay_LoadByID(const FSOverlayID param0, int param1);
// TODO: this should integrate into build system instead of a manual define here.
// to turn off overlay debugging and build a matching ROM, undefine this.
// #define GDB_DEBUGGING
#ifdef GDB_DEBUGGING
// describes a single overlay entry, which GDB can inspect to determine which overlays are loaded.
typedef struct {

View File

@ -19,7 +19,6 @@ public_includes = include_directories('include', 'asm', 'res')
### COMPILER FLAGS ###
############################################################
c_args = [
'-O4,p',
'-proc', 'arm946e',
'-enum', 'int',
'-lang', 'c99',
@ -35,6 +34,15 @@ c_args = [
'-sym', 'on'
]
if get_option('gdb_debugging')
c_args += [
'-O1,p',
'-inline', 'off'
]
else
c_args += '-O4,p'
endif
add_global_arguments(c_args,
language: 'c',
native: false
@ -46,6 +54,10 @@ pokeplatinum_args = [
'-DGAME_LANGUAGE=ENGLISH'
]
if get_option('gdb_debugging')
pokeplatinum_args += '-DGDB_DEBUGGING'
endif
asm_args = [
'-proc', 'arm5TE',
'-16',
@ -240,8 +252,7 @@ nef_fixer = custom_target('debug.nef',
],
command : [
nef_fixer_py, '@INPUT@', '@OUTPUT@'
],
build_by_default: true
]
)
ovly_mapper = custom_target('overlay.map',
@ -253,8 +264,7 @@ ovly_mapper = custom_target('overlay.map',
],
command : [
overlay_mapper_py, '@INPUT@', '@OUTPUT@'
],
build_by_default: true
]
)

1
meson.options Normal file
View File

@ -0,0 +1 @@
option('gdb_debugging', type : 'boolean', value : false)