![]() Cross-compiling in Visual Studio with WSL An empty window with "Hello World" caption should then open. Select a Windows configuration and press F5 to build and run the application. Visual Studio should now be showing the new multi-platform Qt Quick project. Press "Finish" to complete the project creation wizard. Add project configurations for both the Windows and the Raspberry Pi versions of Qt.The Qt Quick Application Wizard dialog will open press "Next >" for configurations setup.Press "Next" provide a name and location for the project, and then press "Create".Type "qt" in the project template search and choose "Qt Quick Application".Select File > New > Project to open the Visual Studio dialog for creating a new project.Registering Qt build for the Raspberry Pi Creating a multi-platform Qt Quick projectĪfter having registered the Qt versions that we will be using, we can now create a Qt project. Here we will provide the path to the cross-compiler. Provide a name and path to the Qt installation, and also what compiler to use (defaults to g++).(If we were using a physical build host instead of a virtual one through WSL, then we could instead select "Linux SSH".) Press "Add" again on the "Qt Versions" tab to open the "Add New Qt Version" dialog.We will now register the cross-compiled build of Qt residing in the WSL instance. Registering Qt for Windows in the Qt VS Tools Provide a name and the path to the Qt installation.Open "Qt VS Tools > Qt Options" and press "Add" on the "Qt Versions" tab.We will start by registering Qt for Windows. To use the Qt Visual Studio Tools we must first register the versions of Qt that we will be using. After re-opening VS, the Qt Visual Studio Tools should be available. Close VS and follow the installation instructions. Search for "qt": the results should show the "Qt Visual Studio Tools" extension select it and press "Download". To install the Qt Visual Studio Tools from the IDE, open Extensions > Manage Extensions. Running a Qt sample application on the Raspberry Pi Setting up the Qt Visual Studio Tools WSL Command Shell ~$ echo "#include " > ~$ echo "int main() " > ~$ echo "SOURCES += main.cpp" > ~$ ~$ make ~$ scp hello password: If all goes well, we should then be able to run a simple program on the device. We can either install a pre-built toolchain or compile our own. We can now proceed to setup the cross-compiler. ![]() Overview of the development environment Cross-compiling Qt This will also allow running the application on the development machine, for testing purposes. To use the Qt Visual Studio Tools, at least one installation of Qt for Windows must be available. It should then be possible to open a terminal window and run Linux commands. The next step in setting up the development environment is to enable WSL and install a Linux distribution. ![]() We will run the cross-compiler in an instance of the Windows Subsystem for Linux (WSL). Visual Studio 2019 must be installed, including the Desktop development and Linux development workloads. The development host will be a Windows 10 machine. Our Qt Quick embedded application running on the target device Preparing the development environment For this post we will be using a Raspberry Pi 3 Model B running Raspbian (Buster). The application will target devices running Embedded Linux. These are part of installations in lounge areas, restrooms, etc. We will be developing an application for public information display on mirrored screens. In this post we will show how to use this feature to create an embedded application with Qt Quick in Visual Studio. This is possible due to the integration of Qt/MSBuild and the Linux development VS workload. Creating an Embedded Qt Quick Application in Visual Studio (1/2)Ĭross-compilation of Qt projects is now supported in the Qt Visual Studio Tools.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |