meson: Add appropriate depends clauses to script compilers

This commit is contained in:
Rachel
2026-08-12 11:54:20 -07:00
committed by scbroede
parent 1e9905c2ff
commit f941eb5089
7 changed files with 58 additions and 120 deletions

View File

@@ -1,6 +1,6 @@
project('pokeplatinum', ['c', 'cpp', 'nasm'],
version: '1.0',
meson_version: '>=1.10.0',
meson_version: '>=1.12.0',
default_options : [
'buildtype=plain',
'warning_level=0'

View File

@@ -65,9 +65,16 @@ anim_subscripts_narc = custom_target(anim_subscripts_narc_name,
anim_subscripts_narc_name,
anim_subscripts_naix_name,
],
input: battle_anim_script_bin_gen.process(
input: script_bin_gen.process(
anim_subscript_files,
extra_args: [ '--out-dir', anim_subscripts_private_dir, ]
extra_args: [ '--out-dir', anim_subscripts_private_dir, ],
depends: [
battle_particles_narc,
anim_ncer_narc_files,
anim_nanr_narc_files,
anim_ncgr_narc_files,
anim_nclr_narc_files,
],
),
command: [
nitroarc_exe,

View File

@@ -19,7 +19,8 @@ be_seq_narc = custom_target(be_seq_target_name,
output: be_seq_target_name,
input: script_bin_gen.process(
effect_script_files,
extra_args: ['--out-dir', be_seq_private_dir]
extra_args: ['--out-dir', be_seq_private_dir],
depends: [text_banks],
),
command: [
nitroarc_exe,
@@ -36,7 +37,8 @@ sub_seq_narc = custom_target(sub_seq_narc_name,
],
input: script_bin_gen.process(
subscript_files,
extra_args: ['--out-dir', sub_seq_private_dir]
extra_args: ['--out-dir', sub_seq_private_dir],
depends: [text_banks],
),
command: [
nitroarc_exe,
@@ -56,6 +58,7 @@ waza_seq_narc = custom_target(waza_seq_target_name,
'--out-dir', waza_seq_private_dir,
'--parent-dir',
],
depends: [text_banks],
preserve_path_from: move_script_srcdir,
),
command: [

View File

@@ -1,32 +1,4 @@
relative_build_dir = fs.relative_to(meson.current_build_dir(), meson.project_build_root())
#
# NOTE: This is a functional copy of script_bin_gen, which is separated from the
# base generator due to an additional dependency on headers generated for
# events IDs. Meson unfortunately does not have a clean way to copy an existing
# object and tweak a single property.
# WARN: If you update this generator, you should also consider updating its parent
# in res/meson.build
frontier_script_bin_gen = generator(make_script_bin_sh,
arguments: [
'-i', relative_source_root / 'include',
'-i', relative_source_root / 'asm',
'-i', '.',
'--depfile', '@DEPFILE@',
'--enumproc', enumproc_exe.full_path(),
'--assembler', arm_none_eabi_gcc_exe.full_path(),
'--objcopy', arm_none_eabi_objcopy_exe.full_path(),
'@EXTRA_ARGS@',
'@INPUT@',
],
depends: [
enumproc_exe,
c_consts_generators,
frontier_particles_narc[1],
text_banks,
],
output: '@BASENAME@',
depfile: '@BASENAME@.d',
)
fr_script_target_name = 'fr_script.narc'
fr_script_private_dir = relative_build_dir / fr_script_target_name + '.p'
@@ -37,23 +9,28 @@ fr_script_narc = custom_target('fr_script.narc',
'fr_script.naix',
],
input: [
frontier_script_bin_gen.process(files(
'frontier_scripts_battle_castle.s',
'frontier_scripts_battle_factory.s',
'frontier_scripts_battle_hall.s',
'frontier_scripts_battle_arcade.s',
), extra_args: ['--out-dir', fr_script_private_dir]),
script_bin_gen.process(
files(
'frontier_scripts_battle_castle.s',
'frontier_scripts_battle_factory.s',
'frontier_scripts_battle_hall.s',
'frontier_scripts_battle_arcade.s',
'frontier_scripts_battle_tower_corridor.s',
'frontier_scripts_battle_tower_corridor_multi.s',
'frontier_scripts_battle_tower_battle_room.s',
'frontier_scripts_battle_tower_multi_battle_room.s',
'frontier_scripts_unknown_10.s',
),
extra_args: ['--out-dir', fr_script_private_dir],
depends: [
frontier_particles_narc,
text_banks,
],
),
copy_gen.process(files(
'frontier_scripts_unused_04.bin',
'frontier_scripts_unused_05.bin',
)),
script_bin_gen.process(files(
'frontier_scripts_battle_tower_corridor.s',
'frontier_scripts_battle_tower_corridor_multi.s',
'frontier_scripts_battle_tower_battle_room.s',
'frontier_scripts_battle_tower_multi_battle_room.s',
'frontier_scripts_unknown_10.s',
), extra_args: ['--out-dir', fr_script_private_dir]),
],
command: [
nitroarc_exe,

View File

@@ -1,34 +1,5 @@
relative_build_dir = fs.relative_to(meson.current_build_dir(), meson.project_build_root())
# NOTE: This is a functional copy of script_bin_gen, which is separated from the
# base generator due to an additional dependency on headers generated for
# events IDs. Meson unfortunately does not have a clean way to copy an existing
# object and tweak a single property.
# WARN: If you update this generator, you should also consider updating its parent
# in res/meson.build
field_script_bin_gen = generator(make_script_bin_sh,
arguments: [
'-i', relative_source_root / 'include',
'-i', relative_source_root / 'asm',
'-i', '.',
'--depfile', '@DEPFILE@',
'--enumproc', enumproc_exe.full_path(),
'--assembler', arm_none_eabi_gcc_exe.full_path(),
'--objcopy', arm_none_eabi_objcopy_exe.full_path(),
'@EXTRA_ARGS@',
'@INPUT@',
],
depends: [
enumproc_exe,
text_banks,
c_consts_generators,
h_headers,
events_headers,
],
output: '@BASENAME@',
depfile: '@BASENAME@.d',
)
scr_seq_target_name = 'scr_seq.narc'
scr_seq_private_dir = relative_build_dir / scr_seq_target_name + '.p'
@@ -1164,9 +1135,13 @@ scr_seq_narc = custom_target('scr_seq.narc',
'scr_seq.narc',
'scr_seq.naix',
],
input: field_script_bin_gen.process(
input: script_bin_gen.process(
scr_seq_files,
extra_args: ['--out-dir', scr_seq_private_dir]
extra_args: ['--out-dir', scr_seq_private_dir],
depends: [
events_headers,
text_banks,
],
),
command: [
nitroarc_exe,

View File

@@ -93,17 +93,6 @@ npctrade_text_banks = npctrade_data[1]
relative_source_root = fs.relative_to(meson.project_source_root(), meson.project_build_root())
### DECOMPILED DATA DIRECTORIES ###
# These subpaths are listed because the result of some build-rule inside them
# is a dependency of some later build-rule.
subdir('pokemon')
subdir('trainers')
subdir('items')
subdir('graphics')
subdir('moves')
subdir('town_map')
subdir('text')
# Common generator for "scripting" files, i.e. field and battle scripts
# NOTE: The members of the `depends` clause below will always be modified by the
# postconf script to be order-only dependencies. This means that this generator
@@ -111,8 +100,6 @@ subdir('text')
# *breaks* the dependency-chain if any of these files are edited. However, because
# this generator produces a depfile, the build back-end will still see the correct
# granular headers on which each input source file depends.
# WARN: If you update this generator, you should also consider updating its child
# in res/field/scripts/meson.build
script_bin_gen = generator(make_script_bin_sh,
arguments: [
'-i', relative_source_root / 'include',
@@ -127,7 +114,6 @@ script_bin_gen = generator(make_script_bin_sh,
],
depends: [
enumproc_exe,
text_banks,
c_consts_generators,
h_headers,
],
@@ -135,6 +121,17 @@ script_bin_gen = generator(make_script_bin_sh,
depfile: '@BASENAME@.d',
)
### DECOMPILED DATA DIRECTORIES ###
# These subpaths are listed because the result of some build-rule inside them
# is a dependency of some later build-rule.
subdir('pokemon')
subdir('trainers')
subdir('items')
subdir('graphics')
subdir('moves')
subdir('town_map')
subdir('text')
subdir('battle')
subdir('field')
subdir('fonts')

View File

@@ -46,45 +46,24 @@ foreach move : move_consts
endif
endforeach
# This generator is shared by both move-specific animations (in this directory)
# and common animations (in the `battle/scripts/common_anims` directory).
battle_anim_script_bin_gen = generator(make_script_bin_sh,
arguments: [
'-i', relative_source_root / 'include',
'-i', relative_source_root / 'asm',
'-i', '.',
'--depfile', '@DEPFILE@',
'--enumproc', enumproc_exe.full_path(),
'--assembler', arm_none_eabi_gcc_exe.full_path(),
'--objcopy', arm_none_eabi_objcopy_exe.full_path(),
'@EXTRA_ARGS@',
'@INPUT@',
],
depends: [
enumproc_exe,
c_consts_generators,
h_headers,
battle_particles_narc[1],
anim_ncer_narc_files[1],
anim_nanr_narc_files[1],
anim_ncgr_narc_files[1],
anim_nclr_narc_files[1],
],
output: '@BASENAME@',
depfile: '@BASENAME@.d',
)
relative_build_dir = fs.relative_to(meson.current_build_dir(), meson.project_build_root())
anim_scripts_narc = custom_target('anim_scripts.narc',
output: 'anim_scripts.narc',
input: battle_anim_script_bin_gen.process(
input: script_bin_gen.process(
anim_script_srcs,
extra_args: [
'--out-dir', relative_build_dir / 'anim_scripts.narc.p',
'--parent-dir',
],
preserve_path_from: meson.current_source_dir(),
depends: [
battle_particles_narc,
anim_ncer_narc_files,
anim_nanr_narc_files,
anim_ncgr_narc_files,
anim_nclr_narc_files,
],
),
command: [
nitroarc_exe,