Skip to content

Assets folder not being copied to bin on build#41

Open
Mairooriam wants to merge 1 commit intoSaschaWillems:mainfrom
Mairooriam:main
Open

Assets folder not being copied to bin on build#41
Mairooriam wants to merge 1 commit intoSaschaWillems:mainfrom
Mairooriam:main

Conversation

@Mairooriam
Copy link
Copy Markdown

@Mairooriam Mairooriam commented Mar 27, 2026

Hello,

Project doesn't run correctly out of the box due to missing assets from the bin directory. Coupled with very indirect error messaging "Call returned an error" making it not so trivial to debug for beginners. I didn't modify tutorial texts due to the tutorial already skipping over much of the cmake configuration.

Not sure if makes a difference i'm using clang and ninja for generator.

NOTE: the CmakeLists.txt diff was generated with AI, which conflicts with "AI generated pull requests and issues will be rejected.".

If this will be rejected i hope someone to add proper fix. Reason for AI was due to my poor cmake skills.

Thanks for great tutorial.

@SaschaWillems
Copy link
Copy Markdown
Owner

This includes a lot of changes to the tutorial code, which seems unintentional.

@Mairooriam
Copy link
Copy Markdown
Author

Mairooriam commented Mar 28, 2026

5461e42

Is the change meant for the pull request. One of my first pull requests. Is it possible for you to merge the specific commit or do you want me revert the other changes?

I didn't know it automatically updates the pull requests when i push to the same branch.

@Mairooriam
Copy link
Copy Markdown
Author

I fixed the branch to match the initial pull request.

@mosra
Copy link
Copy Markdown

mosra commented Mar 29, 2026

Even with the change this still only works if the executable is run with the build dir as the working directory, which may not always be the case, for example when running from the terminal as ./build/HowToVulkan.

An alternative solution that doesn't need any CMake changes (and is thus more transparent to the user, I think) could be explicitly loading assets with an absolute path, such as __FILE__ "/assets/suzanne.obj" instead of "assets/suzanne.obj".

@Mairooriam
Copy link
Copy Markdown
Author

Mairooriam commented Mar 29, 2026

@mosra I wasn't aware of that. I'm not knowledged enough to judge your solution, since I haven't had such problem before. But I thought of something else that is universal for all users.

Lowest change that wouldn't need any code change would be to add a note into "Development environment" chapter or readme.md reminding of moving the assets.

Along the lines NOTE: Make sure to move assets into the binary dir after build.

Second that comes to mind is more explicit logging. Along the lines of wrapping the chk() into macro that also returns function / line number where it failed. Perhaps printing also the expression supplied to the chk().

@SaschaWillems
Copy link
Copy Markdown
Owner

I'll prob. fix this at CMake level, similar to what I do in my samples.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants