-
Notifications
You must be signed in to change notification settings - Fork 10
Debugging with Visual Studio 2022
At a high level, the process will require the following steps.
- Install aqt
- Use aqt to install Qt
- Add Qt bin directory to PATH
- Set CMake variables
To install aqt, you can visit https://github.com/miurahr/aqtinstall and download aqt.exe
from the latest release.
Note that you may need to fight Windows Defender to get this application to run. It should be safe, but if you have any doubts, you can try running the executable through VirusTotal and analyzing the results.
To install version 6.2.4 of Qt to the C:\Qt
directory, you can run aqt using the following command.
aqt install-qt windows desktop 6.2.4 win64_msvc2019_64 -m all -O C:\Qt
Before opening Visual Studio, add the following path to your PATH environment variable.
C:\Qt\6.2.4\msvc2019_64\bin
In Visual Studio, open the project using File > Open > CMake...
and selecting the CMakeLists.txt
file in the root directory of the d1-graphics-tool
repository. Then go to Project > Configure Cache
. This will generate an error, but it will also create the CMakeCache.txt
file. Next, go to Project > View CMakeCache.txt
and locate the following entry.
//The directory containing a CMake configuration file for QT.
QT_DIR:PATH=QT_DIR-NOTFOUND
Replace that entry with the following list of entries.
//The directory containing a CMake configuration file for QT.
QT_DIR:PATH=C:/Qt/6.2.4/msvc2019_64/lib/cmake/Qt6
//The directory containing a CMake configuration file for Qt6CoreTools.
Qt6CoreTools_DIR:PATH=C:/Qt/6.2.4/msvc2019_64/lib/cmake/Qt6CoreTools
//The directory containing a CMake configuration file for Qt6Core.
Qt6Core_DIR:PATH=C:/Qt/6.2.4/msvc2019_64/lib/cmake/Qt6Core
//The directory containing a CMake configuration file for Qt6EntryPointPrivate.
Qt6EntryPointPrivate_DIR:PATH=C:/Qt/6.2.4/msvc2019_64/lib/cmake/Qt6EntryPointPrivate
//The directory containing a CMake configuration file for Qt6GuiTools.
Qt6GuiTools_DIR:PATH=C:/Qt/6.2.4/msvc2019_64/lib/cmake/Qt6GuiTools
//The directory containing a CMake configuration file for Qt6Gui.
Qt6Gui_DIR:PATH=C:/Qt/6.2.4/msvc2019_64/lib/cmake/Qt6Gui
//The directory containing a CMake configuration file for Qt6WidgetsTools.
Qt6WidgetsTools_DIR:PATH=C:/Qt/6.2.4/msvc2019_64/lib/cmake/Qt6WidgetsTools
//The directory containing a CMake configuration file for Qt6Widgets.
Qt6Widgets_DIR:PATH=C:/Qt/6.2.4/msvc2019_64/lib/cmake/Qt6Widgets
//The directory containing a CMake configuration file for Qt6.
Qt6_DIR:PATH=C:/Qt/6.2.4/msvc2019_64/lib/cmake/Qt6
Complete the CMake configuration step by going back to Project > Configure Cache
. It should complete successfully this time. After this, you can build and debug the d1-graphics-tool
project in Visual Studio.
Note that you will need to revisit this step any time you use Project > Delete Cache and Reconfigure
. Visual Studio will sometimes delete your CMake cache automatically after installing a Visual Studio update.