humbletim / setup-vulkan-sdk

github action that provisions the Vulkan SDK and configures VULKAN_SDK environment variable
MIT License
48 stars 12 forks source link

`VULKAN_SDK` path issue on Windows+CMake #4

Closed Wunkolo closed 3 years ago

Wunkolo commented 3 years ago

The current way the VULKAN_SDK is resolved on Windows causes a cmake find_package to fail when using this action. It is seemingly resolving a windows path into a linux-style path for my vkfetch project.

So it is resolving into /d/a/vkfetch/vkfetch/VULKAN_SDK rather than D:/a/vkfetch/vkfetch/VULKAN_SDK https://github.com/Wunkolo/vkfetch/runs/3226556501?check_suite_focus=true#step:3:191

causing find_package( Vulkan) to fail later on, since it cannot resolve these folders:

https://github.com/Wunkolo/vkfetch/runs/3226556501?check_suite_focus=true#step:4:20

This seems to be due to the $PWD command on Windows resolving windows paths in this way.

https://github.com/humbletim/setup-vulkan-sdk/blob/7e109d470a891857460d814727d3eb70fc141918/install_vulkan_sdk.sh#L87-L90

$ echo $PWD
/c/Users/wunk

The fix would be that on Windows, the additional -W flag must be used.

$ echo $(pwd -W)
C:/Users/wunk
humbletim commented 3 years ago

thank you for the bug report and suggestion!

i was able to replicate by adding a vulkan C test app and attempting to build in windows runners. note that invoking cmake from shell: bash seems to automatically translate paths, but from shell: cmd and shell: powershell the build fails to locate VULKAN_SDK (when using /d/sub/dir style paths).

in any event, your suggestion of using $(pwd -W) appears to do the trick and has been incorporated into #5 and updated release v1.0.3

thanks! :)

Wunkolo commented 3 years ago

Thank you very much for the fix! I can confirm it works now!