Skip to content
Discussion options

You must be logged in to vote

For this case, install_data() / install_subdir() are the wrong layer unless you are testing the installed app. They affect meson install; they do not make files appear next to your executable in the build tree while you run from build/.

If your program is going to open data/image.png while its current directory is the build directory, make Meson create build/data/image.png.

For one or a few files, put a small meson.build inside data/:

# data/meson.build
configure_file(
  input: 'image.png',
  output: 'image.png',
  copy: true,
)

and from the top-level meson.build:

subdir('data')

exe = executable('mygame', 'src/main.c', dependencies: [sdl2_dep, sdl2_image_dep])

Because this runs in the data

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@carotteatomique
Comment options

Answer selected by carotteatomique
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants