- Introduction
- Prerequisites
- Environment Setup
- Download KDE Components
- Build KDE Components
- SQLite Configuration
- Build QElectroTech
This guide provides a comprehensive walkthrough for setting up and building QElectroTech, along with its required KDE components (extra-cmake-modules
, kcoreaddons
, and kwidgetsaddons
) using MinGW on Windows. It covers everything from installing necessary tools and dependencies to downloading source code, configuring the build environment, and compiling the application.
By following this guide, you'll:
- Set up prerequisites like Qt, Git, and CMake.
- Download and configure KDE components.
- Compile QElectroTech and its dependencies.
- Deploy the application for use on Windows.
For a smooth experience, ensure your antivirus software is temporarily disabled, as it can interfere with the build and linking processes.
Before starting the build process, ensure the following tools and dependencies are installed and properly configured:
- Download the Qt Online Installer.
- During installation:
- Select Custom Installation.
- See Qt 5 by checking 'Archive' and clicking 'Filter' button
- Enable Qt 5.15.2 → MinGW 8.1.0 64-bit under the
Archive
section. - Enable Build Tools → MinGW 8.1.0 64-bit.
- After installation:
- Qt will be installed at:
C:\Qt\5.15.2\mingw81_64
. - MinGW will be available at:
C:\Qt\Tools\mingw810_64\bin
.
- Qt will be installed at:
- Download and install Git for Windows.
- Add Git to your system
PATH
during installation. - Verify installation:
git --version
- Download and install CMake.
- Add CMake to your system
PATH
during installation. - Verify installation:
cmake --version
- Add the following directory to your
PATH
environment variable:C:\Qt\Tools\mingw810_64\bin
- Verify installation:
mingw32-make --version
To ensure a smooth build process, configure the following environment variables:
Set the QTPATH
environment variable to point to your Qt installation directory. For example:
SET QTPATH=C:\Qt\5.15.2\mingw81_64
Manually download the required KDE repositories using Git. This process involves cloning specific branches of the repositories into a local directory.
Decide on a directory where you want to store the KDE components. For example:
cd C:\Path\To\Your\Projects
Use the following commands to download the necessary components:
git clone --branch kf5 https://github.com/KDE/extra-cmake-modules kde-components\extra-cmake-modules
git clone --branch kf5 https://github.com/KDE/kcoreaddons kde-components\kcoreaddons
git clone --branch kf5 https://github.com/KDE/kwidgetsaddons kde-components\kwidgetsaddons
After cloning, your directory structure should look like this:
kde-components\
extra-cmake-modules\
kcoreaddons\
kwidgetsaddons\
Check that all repositories were successfully downloaded:
dir kde-components
You should see directories for extra-cmake-modules
, kcoreaddons
, and kwidgetsaddons
.
This section explains how to build each required KDE component (extra-cmake-modules
, kcoreaddons
, and kwidgetsaddons
). These steps involve configuring the build environment, running cmake
, and compiling with mingw32-make
.
- Navigate to the
extra-cmake-modules
directory:cd kde-components\extra-cmake-modules
- Configure and build the component:
cmake -DCMAKE_INSTALL_PREFIX=%QTPATH% -G "MinGW Makefiles" mingw32-make install
- Navigate to the
kcoreaddons
directory and create a build folder:cd kde-components\kcoreaddons mkdir build cd build
- Configure and build the component:
cmake .. -DCMAKE_INSTALL_PREFIX=%QTPATH% -DCMAKE_PREFIX_PATH=%QTPATH% -G "MinGW Makefiles" -DBUILD_SHARED_LIBS=OFF -DZLIB_LIBRARY:FILEPATH=C:\Qt\Tools\mingw810_64\x86_64-w64-mingw32\lib\libz.a mingw32-make mingw32-make install
- Navigate to the
kwidgetsaddons
directory and create a build folder:cd kde-components\kwidgetsaddons mkdir build cd build
- Configure and build the component:
cmake .. -DCMAKE_INSTALL_PREFIX=%QTPATH% -DCMAKE_PREFIX_PATH=%QTPATH% -G "MinGW Makefiles" -DBUILD_SHARED_LIBS=OFF -DZLIB_LIBRARY:FILEPATH=C:\Qt\Tools\mingw810_64\x86_64-w64-mingw32\lib\libz.a mingw32-make mingw32-make install
%QTPATH%
environment variable is correctly set before building these components.
Follow these steps to download and set up SQLite for use with QElectroTech.
-
Download the source and x64 DLL files from the SQLite Download Page.
- Example source: sqlite-amalgamation-3470200.zip
- Example binary: sqlite-dll-win-x64-3470200.zip
-
Extract both archives to the same directory.
- Open a command prompt and navigate to the directory where you extracted the files.
- Run the following command to generate the library file:
dlltool --def sqlite3.def --output-lib sqlite3.lib --dllname sqlite3.dll
Modify the qelectrotech.pro
file to properly link SQLite:
-
Locate and remove the following line (line 257):
unix|win32: PKGCONFIG += sqlite3
-
Replace it with:
unix: PKGCONFIG += sqlite3 win32:LIBS += "C:/Path/To/Sqlite/sqlite3.lib" win32:INCLUDEPATH += "C:/Path/To/Sqlite/sqlite" # Path to sqlite3.h header file
The QElectroTech build process requires Git Bash for certain steps. It will not work in Window's cmd.exe. Ensure all prerequisites and dependencies are set up before proceeding.
- Open Git Bash.
- Clone the QElectroTech source code:
git clone https://github.com/qelectrotech/qelectrotech-source-mirror.git
- Navigate to the repository and initialize submodules:
cd qelectrotech-source-mirror git submodule update --init --recursive
- Create a
build
directory inside the repository:mkdir build cd build
- Use the
qmake
tool from your Qt installation to generate a Makefile:/c/Qt/5.15.2/mingw81_64/bin/qmake.exe -o Makefile ../qelectrotech.pro
Run the following command in Git Bash to build the project:
mingw32-make -j8
-
Use
windeployqt
to prepare the application for execution:/c/Qt/5.15.2/mingw81_64/bin/windeployqt.exe ./release/qelectrotech.exe
-
Place the deployment files in the same directory as the
qelectrotech.exe
.
To properly launch the application:
- Download Launch QET.bat.
- Place the batch script in the QElectroTech main folder.
- Run the batch file to start QElectroTech.