how do i include a non-code data/resources directory into my project so that SDL can see it? #16082
|
hi! sorry in advance if this question is silly, i haven't been able to make it work by myself using the documentation... i am making a project using SDL (and SDL_image), and i need to load an image from that project, to render it on the screen. it is located in how would i accomplish this using Meson? i've tried using |
Replies: 1 comment 1 reply
|
For this case, If your program is going to open For one or a few files, put a small # data/meson.build
configure_file(
input: 'image.png',
output: 'image.png',
copy: true,
)and from the top-level subdir('data')
exe = executable('mygame', 'src/main.c', dependencies: [sdl2_dep, sdl2_image_dep])Because this runs in the That matches your For more assets, the same idea scales by listing/copying the files from Two caveats:
If this gets SDL loading the asset from the Meson build dir, please mark it as answered so the next |
For this case,
install_data()/install_subdir()are the wrong layer unless you are testing the installed app. They affectmeson install; they do not make files appear next to your executable in the build tree while you run frombuild/.If your program is going to open
data/image.pngwhile its current directory is the build directory, make Meson createbuild/data/image.png.For one or a few files, put a small
meson.buildinsidedata/:and from the top-level
meson.build:Because this runs in the
data…