- 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
Archivesection. - 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
PATHduring installation. - Verify installation:
git --version
- Download and install CMake.
- Add CMake to your system
PATHduring installation. - Verify installation:
cmake --version
- Add the following directory to your
PATHenvironment 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_64Manually 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\ProjectsUse the following commands to download the necessary components:
git clone --branch kf5 https://github.com/KDE/extra-cmake-modules kde-components\extra-cmake-modulesgit clone --branch kf5 https://github.com/KDE/kcoreaddons kde-components\kcoreaddonsgit clone --branch kf5 https://github.com/KDE/kwidgetsaddons kde-components\kwidgetsaddonsAfter cloning, your directory structure should look like this:
kde-components\
extra-cmake-modules\
kcoreaddons\
kwidgetsaddons\
Check that all repositories were successfully downloaded:
dir kde-componentsYou 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-modulesdirectory: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
kcoreaddonsdirectory 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
kwidgetsaddonsdirectory 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
builddirectory inside the repository:mkdir build cd build - Use the
qmaketool 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
windeployqtto 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.
I try again as the page: https://gist.github.com/ssweber/0519e50942926e4a32c22d49b280c0e6 ...It really make some progress. I might made mistakes at 2 place. One is use the version 5.90.0, might be too older. Current 6.1.0 vesion is for QT6. I first tried 5.90.0, it might be not ok. Second is not set path...SET QTPATH=C:\Qt\5.15.2\mingw81_64, as showed in the page. So I need to change the .pro file. But it might make some new problems. If I do as the post said, the KF5 can be install for QT5, no need to manual set lib and include path.
Now I can generate the qelectrotech.exe file, the file size is 12082KB, I have used windeployqt to get the necessary dll. But when run it, it pop up the problem 0xc000007b, the file could not run. I tried to check the QET windows binary file "qelectrotech.exe", its size 39948KB. I tried to copy the sub-folders like "bin", "elements", "examples","titleblocks" and etc, and paste into the compile folder. Your binary file can be runned, but the new compile file could not run, It still pop up the problem 0xc000007b. Could you tell me more information? Thank you very much!