/vscode-qt-qml-vcpkg-template

VSCode Qt (QML) vcpkg template with CI integration

Primary LanguageCMake

vscode-qt-qml-vcpkg-template

Windows Build

Template usage

We use the manifest mode vcpkg.json to declare dependencies, just like package.json for npm. Clone the repo with vcpkg submodules using:

git clone --recurse-submodules https://github.com/upupming/vscode-qt-qml-vcpkg-template.git

Or run the following command after cloned the repo:

git submodule update --init

Advantages

  • Debugging, Intelligence & Code formatting on VSCode is much more faster
  • Run windeployqt on the fly.
  • Automatically build Release zip with GitHub Actions.
  • Cache all packages and get faster package installing speed on CI.
  • Use Ninja generator for faster build time, just as faster as the Qt Creator.

Disadvantages

  • No QML intelligence on VSCode, you can still use Qt Creator to write QML files.

Getting started

  1. Clone the repo.

    git clone --recurse-submodules https://github.com/upupming/vscode-qt-qml-vcpkg-template.git
  2. Install latest visual studio 2019 with msvc compiler.

  3. Download Qt Installer and install latest Qt (current is 5.15.2 & msvc2019_64). qt5 installed with vcpkg cannot build QML app now, so we manually install Qt.

  4. Global search vscode-qt-qml-vcpkg-template, C:/Qt/5.15.2/msvc2019_64 and Microsoft Visual Studio/2019/Community etc., ans replace them according your own condition.

  5. Run the CMake Configure task or CMake Tools' Configure command.

  6. If you build the exe for the first time, you must run Run windeployqt task to copy all necessary Qt libraries to the exe folder. Or the exe will crash on launch!

  7. Change the main.cpp and use F5 or debug button on the left side bar to see the results. VSCode will run CMake to build the exe on each debug session.

    • We use CMake Build task to build the exe. CMake Tools' Build command (F7) is the same.
  8. Run the release.bat to build and get a release zip file at any time.