A project template at first for projects using c++ for core logic and the qt library with html, css and javascript for the interface along with postgres for the database.
The projects tech stack and structure └── MyApp/ ├── CMakeLists.txt │ ├── src/ │ ├── main.cpp │ ├── backend.cpp │ └── backend.h │ ├── qml/ │ └── main.qml ← creates window + Qt WebView │ └── web/ ├── index.html ← UI structure ├── styles.css ← UI design └── app.js ← UI logic
Install the following before building:
- Git
- CMake
- GCC / MinGW-w64
mingw32-make- vcpkg
Verify:
git --version
cmake --version
gcc --version
g++ --version
mingw32-make --versionvcpkg only needs to be installed once:
cd C:\dev
git clone https://github.com/microsoft/vcpkg.git
cd vcpkg
.\bootstrap-vcpkg.batSet the VCPKG_ROOT environment variable to:
C:\dev\vcpkg
Verify:
vcpkg versiongit clone <repository-url>
cd MyAppC++ dependencies are declared in:
vcpkg.json
Currently:
qtbase
qtdeclarative
These provide Qt Core, GUI, QML, Qt Quick and Qt Quick Controls required by the application.
From the project root:
vcpkg install --triplet x64-mingw-dynamicvcpkg installs the dependencies into the project's:
vcpkg_installed/
Alternatively, when using the provided CMake preset, CMake can automatically ask vcpkg to install missing dependencies during configuration.
cmake --preset gccThe project uses:
Compiler: GCC / MinGW-w64
Generator: MinGW Makefiles
vcpkg: x64-mingw-dynamic
cmake --build buildAfter a successful build:
.\build\MyApp.exeAfter initially setting up the project, the normal workflow is simply:
cmake --preset gcc
cmake --build build
.\build\MyApp.exeIf vcpkg.json changes, install/update the dependencies with:
vcpkg install --triplet x64-mingw-dynamic