|
| 1 | +# How to Build (Qt 6.9.0) - Windows |
| 2 | + |
| 3 | +**(Note: These instructions have not been fully tested for 6.9.0. Let us know if you encounter any issues.)** |
| 4 | + |
| 5 | +## Build Tools: |
| 6 | + |
| 7 | +The installation order here is important. While other orderings may work, this is the specific order that we have tested. And the Qt installation must be the last thing installed. |
| 8 | + |
| 9 | +1. Install Visual Studio 2022: |
| 10 | + 1. [Download Page](https://docs.microsoft.com/en-us/visualstudio/releases/2022/release-notes) |
| 11 | + 2. Make sure you select the C++ development tools. |
| 12 | +2. Install Windows Development SDK: |
| 13 | + 1. [Download Page](https://developer.microsoft.com/en-us/windows/downloads/windows-sdk/) |
| 14 | +3. Install CMake: |
| 15 | + 1. [Download Page](https://cmake.org/download/) |
| 16 | + 2. When prompted select, "Add CMake to the system PATH for all users". |
| 17 | + |
| 18 | +## Install Qt 6.9.0: |
| 19 | + |
| 20 | +Unlike with Qt 5.12, there is no offline installer for it. So you have two options here, use the online installer, or use a copy of an installation. |
| 21 | + |
| 22 | +### Official Online Installer: |
| 23 | + |
| 24 | +If you are ok with creating an account with Qt and using their online installer, then use this method. |
| 25 | + |
| 26 | +1. Download the online installer from here: https://www.qt.io/download-qt-Images/ |
| 27 | +3. Select the following options: |
| 28 | + - Qt 6.9.0 |
| 29 | + - MSVC 2022 64-bit |
| 30 | + - Sources |
| 31 | + - Additional Libraries |
| 32 | + - Qt Image Formats |
| 33 | + - Qt Multimedia |
| 34 | + - Qt Serial Port |
| 35 | + - Qt Debug Information Files |
| 36 | + |
| 37 | + |
| 38 | + |
| 39 | + |
| 40 | +If you repeatedly run into an error involving "SSL handshake failed", you will not be able to use the online installer. Please try the other option. |
| 41 | + |
| 42 | +### Unofficial Installation Copy: |
| 43 | + |
| 44 | +If you are unable or unwilling to use the online installer, the alternative is to copy an installation directly into your system. To do this, you will need to download the installation from us, and copy it into your C drive. |
| 45 | + |
| 46 | +1. Join our [Discord server](https://discord.gg/cQ4gWxN) and ask for the link to the Qt6 standalone. Someone will DM you with a link*. |
| 47 | +2. Download `Qt6.9.0.7z` and decompress it. You can use [7-zip](https://www.7-zip.org/) to decompress it. This will create a folder with the same name. |
| 48 | +3. Move this folder to `C:\`. It will probably ask you for permissions to do it. |
| 49 | +4. Navigate to: `C:\Qt6.9.0\Tools\QtCreator\bin\` and create a shortcut to `qtcreator.exe`. Copy this shortcut to somewhere convenient. (By default this shortcut is named, `Qt Creator 16.0.0 (Community)`) |
| 50 | + |
| 51 | +*This Qt6 standalone file is 3GB in size and is being hosted by our staff for our own developers. We don't want the entire world converging here and overrunning the server. |
| 52 | + |
| 53 | +## Setup: |
| 54 | + |
| 55 | +1. Clone this repo. |
| 56 | +2. Clone the [Packages Repo](https://github.com/PokemonAutomation/Packages). |
| 57 | +3. In the `Packages` repo, copy the `SerialPrograms/Resources` folder into the root of the `Arduino-Source` repo. |
| 58 | + |
| 59 | + |
| 60 | + |
| 61 | +4. Open Qt Creator. |
| 62 | +5. Click on `File` -> `Open File or Project`. |
| 63 | +6. Navigate to `SerialPrograms` and select `CMakeLists.txt`. |
| 64 | +7. It will then ask you to configure the project. Ensure `Desktop Qt 6.9.0 MSVC2022 64bit` and `Release with Debug Information` are selected. |
| 65 | + - Ensure the build directory for `Desktop_Qt_6_9_0_MSVC2022_64bit-RelWithDebInfo` is located in the root of the `Arduino-Source` repo, and not buried in subfolders (e.g. `build` or `SerialPrograms`). |
| 66 | + - Click `Configure Project`. |
| 67 | + |
| 68 | + |
| 69 | + |
| 70 | +8. At the bottom left corner, click on the little monitor and select `Release with Debug Information`. |
| 71 | + |
| 72 | + |
| 73 | + |
| 74 | +9. Still in the bottom left corner, click the upper green arrow to compile and launch the program. |
| 75 | + |
| 76 | +## Troubleshooting |
| 77 | + |
| 78 | +### Failed to open '../3rdPartyBinaries/opencv_world460d.zip', or file missing |
| 79 | + |
| 80 | +- Click `Projects` on the left sidebar. |
| 81 | +- In `Build directory`, ensure the build directory for `Desktop_Qt_6_9_0_MSVC2022_64bit-RelWithDebInfo` is located in the root of the `Arduino-Source` repo, and not buried in subfolders (e.g. `build` or `SerialPrograms`). |
| 82 | + - e.g. change the default build directory from: `Arduino-Source/SerialPrograms/build/Desktop_Qt_6_9_0_MSVC2022_64bit-RelWithDebInfo` |
| 83 | + - to: `Arduino-Source/build-SerialPrograms-Desktop_Qt_6_9_0_MSVC2022_64bit-RelWithDebInfo` |
| 84 | + |
| 85 | + |
| 86 | +## Upgrading Qt components |
| 87 | + |
| 88 | +### Installing newer Qt version |
| 89 | +If you have already have older versions of Qt installed, but need to upgrade Qt components, you can use the Maintenance tool, which comes pre-instaled with Qt (C:\Qt\MaintenanceTool.exe). |
| 90 | + |
| 91 | +- When prompted, in `Maintenance Actions`, choose `Add or remove components`. |
| 92 | +- You may select the components needed, as per the instructions above, for the newer version. And de-select old versions to remove them, if you wish. |
| 93 | +- Optional: In `Maintenance Actions`, you may also choose `Update components` as well. To update Qt Creator, and other components. |
| 94 | + |
| 95 | +### Building with the newer Qt version |
| 96 | +- Open the `SerialPrograms` project in Qt, as outlined in the "Setup" section above. |
| 97 | +- In the toolbar, click `Edit` -> `Preferences` |
| 98 | +- Under `Kits` tab, choose the newer Qt version (e.g. Desktop Qt 6.8.3) |
| 99 | +<img src="Images/QT-kits.png"> |
| 100 | + |
| 101 | +- Under `Compiler`, set it to Microsoft Visual C++ Compiler or Visual Studio, if not already set. |
| 102 | +- Click `Ok`, to save Kits preferences. |
| 103 | +- Click the Monitor symbol at the bottom left |
| 104 | +<img src="Images/QT-kit-build.png"> |
| 105 | + |
| 106 | +- Under `Kit`: choose the desired Qt version. |
| 107 | +- Under `Build`: choose `Release with Debug Information` |
| 108 | +- Click the green arrow to compile and launch the program. |
| 109 | +- Optional: Move the `UserSettings` folder from the old build folder to the new build folder, to keep your old settings, such as the dev key. |
| 110 | + |
| 111 | +### Upgrade compiler |
| 112 | +- Upgrade the compiler by installing a new version of Visual Studio. Ensure `Desktop development with C++` is checked, so the latest MSVC compiler is also installed. |
| 113 | +- Open the `SerialPrograms` project in Qt, as outlined in the "Setup" section above. |
| 114 | +- In the toolbar, click `Edit` -> `Preferences` |
| 115 | +- Click the `Kits` tab on the left. Then click the `Compilers` tab, click `Re-detect` to refresh the list of compilers. Then click `Apply` in the bottom right. |
| 116 | +- Back in the `Kits` tab, your newly installed compilers should now show up in the list of compilers. |
| 117 | + |
| 118 | +When building, if you get the error `yvals_core.h:931: error: STL1001: Unexpected compiler version, expected MSVC 19.42 or newer` (or something similar), consider deleting the old build folder, and rebuilding from scratch. |
| 119 | + |
| 120 | +<hr> |
| 121 | + |
| 122 | +**Discord Server:** |
| 123 | + |
| 124 | + |
| 125 | +[<img src="https://canary.discordapp.com/api/guilds/695809740428673034/widget.png?style=banner2">](https://discord.gg/cQ4gWxN) |
| 126 | + |
0 commit comments