dcourtois / premake-qt

Premake module adding support for Qt to actions (Visual Studio, makefiles, etc.)
Do What The F*ck You Want To Public License
45 stars 11 forks source link

Compile issue: QTVulkan #29

Closed YouthImagination closed 1 year ago

YouthImagination commented 1 year ago

Hi, I want to build a VS project with QTVulkan. QT6 will find VULKAN_SDK automatically when I build project with CMake, like this

-- Building for: Visual Studio 17 2022                                                         
-- Selecting Windows SDK version 10.0.22000.0 to target Windows 10.0.19044.                    
-- The CXX compiler identification is MSVC 19.35.32215.0                                       
-- Detecting CXX compiler ABI info                                                             
-- Detecting CXX compiler ABI info - done                                                      
-- Check for working CXX compiler: D:/software/Visual Studio/VS2022/VC/Tools/MSVC/14.35.32215/b
in/Hostx64/x64/cl.exe - skipped                                                                
-- Detecting CXX compile features                                                              
-- Detecting CXX compile features - done                                                       
-- Looking for C++ include pthread.h                                                           
-- Looking for C++ include pthread.h - not found                                               
-- Found Threads: TRUE                                                                         
-- Performing Test HAVE_STDATOMIC                                                              
-- Performing Test HAVE_STDATOMIC - Success                                                    
-- Found WrapAtomic: TRUE                                                                      
-- Found WrapVulkanHeaders: D:/software/VulkanSDK/1.3.204.1/Include                            
-- Configuring done                                                                            
-- Generating done                                                                             

But premake-qt will not automatically find the VULKAN_SDK path, QT6 will disable vulkan(vulkan == 0, QT_CONFIG divide by zero). Is there any solution?

dcourtois commented 1 year ago

Hey, sorry for replying so late. This is something you'll have to setup yourself in your Premake file. It's not the goal of this addon to handle this, nore is it Premake's goal to provide all the "find_package" utilities that CMake and equivalent are doing. https://premake.github.io/community/modules has a list of available Premade modules. Maybe one of those provides helpers to find packages. But my advice would just be to write a few helper functions in your project .lua file to help find the Vulkan SDK in case it's installed in the usaul places, and allow users to overwrite that using env var or whatever other method.

A bit like the qtpath mechanism work in this addon: if the QTDIR (or QT_DIR) env var is setup, the addon will use this, otherwise it's up to the user to use the command to set the path manually. Also maybe Vulkan SDK installers already create some env vars that you could use.

And I'm closing this issue since this is more like a general Premake question (you might also have some help on the Premake's community forums/pages because I think lots of people coming from CMake have already had that same kind of problems, and answers might already be there :))