vsg-dev / VulkanSceneGraph

Vulkan & C++17 based Scene Graph Project
http://www.vulkanscenegraph.org
MIT License
1.32k stars 212 forks source link

Master won't build on windows #318

Closed sbrkopac closed 3 years ago

sbrkopac commented 3 years ago

Describe the bug Looks like 7a4a0a06ad17027294ba4f2e1b0671c3197f9935 broke installation of VSG on windows. Looks like when VSG_MACROS_INSTALLED is enabled then the uninstall.cmake file is skipped from the installation.

Expected behavior VSG should install correctly to the target folders.

Screenshots

Build started...
1>------ Build started: Project: INSTALL, Configuration: RelWithDebInfo x64 ------
1>-- Install configuration: "RelWithDebInfo"
1>CMake Error at cmake_install.cmake:36 (file):
1>  file INSTALL cannot find
1>  "C:/Programming/libraries/VulkanSceneGraph/build/uninstall.cmake": No
1>  error.
1>
1>
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(155,5): error MSB3073: The command "setlocal
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(155,5): error MSB3073: "C:\Program Files\CMake\bin\cmake.exe" -DBUILD_TYPE=RelWithDebInfo -P cmake_install.cmake
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(155,5): error MSB3073: if %errorlevel% neq 0 goto :cmEnd
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(155,5): error MSB3073: :cmEnd
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(155,5): error MSB3073: endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(155,5): error MSB3073: :cmErrorLevel
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(155,5): error MSB3073: exit /b %1
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(155,5): error MSB3073: :cmDone
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(155,5): error MSB3073: if %errorlevel% neq 0 goto :VCEnd
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(155,5): error MSB3073: :VCEnd" exited with code 1.
1>Done building project "INSTALL.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 3 up-to-date, 0 skipped ==========

Additional context Add any other context about the problem here.

sbrkopac commented 3 years ago

@rhabacker Could you please take a look as well.

rhabacker commented 3 years ago

Before merging pr https://github.com/vsg-dev/VulkanSceneGraph/pull/313 builds were performed on Windows with MSVC, see e.g. https://github.com/vsg-dev/VulkanSceneGraph/runs/3524834865, which should have raised such issues. Unfortunately, they do not perform a "make install" step that should be added to the corresponding CI configuration.

rhabacker commented 3 years ago

Looks like when VSG_MACROS_INSTALLED is enabled then the uninstall.cmake file is skipped from the installation.

When vsgMacros.cmake is included from the top level CMakeLists.txt of the VulkanSceneGraph git repo, VSG_MACROS_INSTALLED is not set and the file uninstall.cmake is installed along with vsgMacros.cmake.

When vsgMacros.cmake is included from vsgConfig.cmake as a result of a call to find_package(vsg) in a package depending on vsg, VSG_MACROS_INSTALLED is set and uninstall.cmake must not be installed, only used.

This is known to work on linux builds, see https://build.opensuse.org/package/show/home:rhabacker:branches:games/libvsg
[  112s] /usr/bin/cmake -P cmake_install.cmake
[  112s] -- Install configuration: "RelWithDebInfo"
[  113s] -- Installing: /home/abuild/rpmbuild/BUILDROOT/libvsg-0.1.4.20210907.git+ca40fbdd-lp152.13.1.x86_64/usr/lib64/cmake/vsg/uninstall.cmake.
rhabacker commented 3 years ago

Installing that file also works with mingw builds
image

The only possibility I see is that -DVSG_MACROS_INSTALLED=1 has been added to the cmake command line for VulkanSceneGraph.

sbrkopac commented 3 years ago

Adding the -DVSG_MACROS_INSTALLED=1 to my build produces the same error. It doesn't look my uninstall.cmake is being produced at all.

sbrkopac commented 3 years ago

So it looks like what happened was I manually cleaned my build directory which is where some of the templates are sitting. When I do that - they obviously can't be found. I've created a draft pull request to put them in a more appropriate location which should prevent this from happening in the future.

sbrkopac commented 3 years ago

Snuck in a quick change to also address #319