Switch to using a meson generator instead of a custom_target.

This commit is contained in:
Fries 2024-04-23 22:24:16 -07:00
parent 2fc701723a
commit 15b16071c9
2 changed files with 5 additions and 3 deletions

3
src/flappyBird/generateAssets.py Normal file → Executable file
View file

@ -1,3 +1,4 @@
#!/usr/bin/env python3
import argparse import argparse
from pathlib import Path from pathlib import Path
from PIL import Image from PIL import Image
@ -14,7 +15,7 @@ input = Path(args.input)
output = Path(args.output) output = Path(args.output)
if not input.exists(): if not input.exists():
print("Input " + str(path.absolute()) + " not found.") print("Input " + str(input.absolute()) + " not found.")
raise SystemExit(1) raise SystemExit(1)
hexList = list() hexList = list()

View file

@ -5,8 +5,9 @@ flappy_sources = [
'MainMenu.cc' 'MainMenu.cc'
] ]
python3 = find_program('python3') assets = find_program('generateAssets.py')
bird = custom_target('bird', output: 'birdSprite.cc', input: ['generateAssets.py', 'assets/yellowbird-downflap.png'], command: [python3, '@INPUT0@', 'bird', '@INPUT1@', '@OUTPUT@']) asset_gen = generator(assets, output: '@BASENAME@.cc', arguments: ['@EXTRA_ARGS@', '@INPUT@', '@OUTPUT@'])
bird = asset_gen.process('assets/yellowbird-downflap.png', extra_args: ['bird'])
flappy_bird = static_library('flappyBird', [flappy_sources, bird], dependencies: deps, include_directories: incdirs) flappy_bird = static_library('flappyBird', [flappy_sources, bird], dependencies: deps, include_directories: incdirs)
flappy_dep = declare_dependency(link_with: [flappy_bird], include_directories: incdirs) flappy_dep = declare_dependency(link_with: [flappy_bird], include_directories: incdirs)