-
Notifications
You must be signed in to change notification settings - Fork 49
Visual Studio Build #165
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Visual Studio Build #165
Conversation
…dd project CMakeLists.txt to root directory to run cmake from root directory.
…MSBuild warning (MSB8065/MSB8064) and add post-build commands to move shaders/models/textures to correct executable directory for Visual Studio
|
Sorry for the late reply. This does look good to, but has some merge conflicts due to recent changes. Can you fix those so we can review this? |
|
Sorry It being long time since I worked on this project. I found out that after I fixed the conflict between my old CMakeLists.txt and the latest Github copy that there an issue in asset location. I correct the location of asset in CMakeList.txt and Now it is working. Please verify it and let me know if still there any further problem. |
|
I change the source directory from ${CMAKE_SOURCE_DIR}/attachments/assets/ to ${CMAKE_CURRENT_SOURCE_DIR}/assets/. This will work with cmake sourced from project root directory or from project attachments directory. Now CMakeLists.txt is prefect to work from anywhere. |
|
Almost there. Shader compilation fails for me when building outside of the attachments folder. |
|
Outside attachments folder? You meant the root project directory? or build directory inside in root directory (I never tried this from inside build directory)? For me Outside attachments folder meant the project root directory. cmake --fresh -S . -B your-build-directory -DCMAKE_TOOLCHAIN_FILE="$env:VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake" |
|
Build directory inside root. I then open the Visual Studio solution in that build folder, and that's where CMake fails to build shaders. |
Removed commands to remove shader, model, and texture directories after copying them to the executable directory. This allows Visual Studio to keep working correctly on subprojects (shader, model and texture) without failures.
|
The shaders were built by CMake. The problem was after post-build tasks in CMakeLists.txt which they cleaned up and removed the shaders build directory after copying them to executable directory. I removed these clean-up commands since they caused compilation issues when running the solution from inside the Visual Studio and Everything is working now as it is supposed to be. Please try and let me know if you facing further issues. |
SaschaWillems
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. Can confirm this works for me now, both from a build folder under root as well as a build folder under attachments. 👍🏻
I can only test on Windows so I'll wait for others to test on different platforms.
|
Okay no problem. Note: Ninja is in single-configuration generator. |

This contribution allows to build from project root directory without switching to attachments folder. Also refactor the shaders target functions in attachments directory CMakeLists.txt to fix MSBuild warning messages (MSB8065/MSB8064). Also provide post-build targets to move the shaders/models/textures to correct executable directory for Visual Studio.