Skip to content

Instantly share code, notes, and snippets.

@ssweber
Last active August 14, 2025 11:12
Show Gist options
  • Select an option

  • Save ssweber/0519e50942926e4a32c22d49b280c0e6 to your computer and use it in GitHub Desktop.

Select an option

Save ssweber/0519e50942926e4a32c22d49b280c0e6 to your computer and use it in GitHub Desktop.

Table of Contents

  1. Introduction
  2. Prerequisites
  3. Environment Setup
  4. Download KDE Components
  5. Build KDE Components
  6. SQLite Configuration
  7. Build QElectroTech

1. Introduction

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.

2. Prerequisites

Before starting the build process, ensure the following tools and dependencies are installed and properly configured:

2.1 Install Qt

  1. Download the Qt Online Installer.
  2. During installation:
    • Select Custom Installation.
    • See Qt 5 by checking 'Archive' and clicking 'Filter' button
    • Enable Qt 5.15.2MinGW 8.1.0 64-bit under the Archive section.
    • Enable Build ToolsMinGW 8.1.0 64-bit.
  3. 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.

2.2 Install Git

  1. Download and install Git for Windows.
  2. Add Git to your system PATH during installation.
  3. Verify installation:
    git --version

2.3 Install CMake

  1. Download and install CMake.
  2. Add CMake to your system PATH during installation.
  3. Verify installation:
    cmake --version

2.4 Add MinGW to PATH

  1. Add the following directory to your PATH environment variable:
    C:\Qt\Tools\mingw810_64\bin
    
  2. Verify installation:
    mingw32-make --version

3. Environment Setup

To ensure a smooth build process, configure the following environment variables:

3.1 Set the QTPATH Variable

Set the QTPATH environment variable to point to your Qt installation directory. For example:

SET QTPATH=C:\Qt\5.15.2\mingw81_64

⚠️ Tip: Adding these variables temporarily works for the current session. To make them permanent, update your system’s environment variables through the Control Panel or Command Prompt.

4. Download KDE Components

Manually download the required KDE repositories using Git. This process involves cloning specific branches of the repositories into a local directory.

4.1 Create a Base Directory

Decide on a directory where you want to store the KDE components. For example:

cd C:\Path\To\Your\Projects

4.2 Clone the Repositories

Use the following commands to download the necessary components:

Download extra-cmake-modules:

git clone --branch kf5 https://github.com/KDE/extra-cmake-modules kde-components\extra-cmake-modules

Download kcoreaddons:

git clone --branch kf5 https://github.com/KDE/kcoreaddons kde-components\kcoreaddons

Download kwidgetsaddons:

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\

4.3 Verify the Download

Check that all repositories were successfully downloaded:

dir kde-components

You should see directories for extra-cmake-modules, kcoreaddons, and kwidgetsaddons.


5. Build KDE Components

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.


5.1 Build extra-cmake-modules

  1. Navigate to the extra-cmake-modules directory:
    cd kde-components\extra-cmake-modules
  2. Configure and build the component:
    cmake -DCMAKE_INSTALL_PREFIX=%QTPATH% -G "MinGW Makefiles"
    mingw32-make install

5.2 Build kcoreaddons

  1. Navigate to the kcoreaddons directory and create a build folder:
    cd kde-components\kcoreaddons
    mkdir build
    cd build
  2. 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

5.3 Build kwidgetsaddons

  1. Navigate to the kwidgetsaddons directory and create a build folder:
    cd kde-components\kwidgetsaddons
    mkdir build
    cd build
  2. 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

⚠️ Note: Ensure the %QTPATH% environment variable is correctly set before building these components.

6. SQLite Configuration

Follow these steps to download and set up SQLite for use with QElectroTech.


6.1 Download SQLite Files

  1. Download the source and x64 DLL files from the SQLite Download Page.

  2. Extract both archives to the same directory.


6.2 Generate sqlite3.lib

  1. Open a command prompt and navigate to the directory where you extracted the files.
  2. Run the following command to generate the library file:
    dlltool --def sqlite3.def --output-lib sqlite3.lib --dllname sqlite3.dll

6.3 Update qelectrotech.pro

Modify the qelectrotech.pro file to properly link SQLite:

  1. Locate and remove the following line (line 257):

    unix|win32: PKGCONFIG += sqlite3
    
  2. 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
    

⚠️ Note: Ensure the paths in the replacement lines point to the correct location of your SQLite files.

7. Build QElectroTech

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.


7.1 Clone the QElectroTech Repository

  1. Open Git Bash.
  2. Clone the QElectroTech source code:
    git clone https://github.com/qelectrotech/qelectrotech-source-mirror.git
  3. Navigate to the repository and initialize submodules:
    cd qelectrotech-source-mirror
    git submodule update --init --recursive

7.2 Configure the Build

  1. Create a build directory inside the repository:
    mkdir build
    cd build
  2. 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

7.3 Compile the Application

Run the following command in Git Bash to build the project:

mingw32-make -j8

7.4 Deploy QElectroTech

  1. Use windeployqt to prepare the application for execution:

    /c/Qt/5.15.2/mingw81_64/bin/windeployqt.exe ./release/qelectrotech.exe
  2. Place the deployment files in the same directory as the qelectrotech.exe.


7.5 Launch QElectroTech

To properly launch the application:

  1. Download Launch QET.bat.
  2. Place the batch script in the QElectroTech main folder.
  3. Run the batch file to start QElectroTech.

@freestyle12358
Copy link

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!

@Int-Circuit
Copy link

Hey @ssweber I am responsible for the QET Docs update, could I add your gist instructions on the wiki? I will of course credit you accordingly.

Thx for the response

@ssweber
Copy link
Author

ssweber commented Aug 4, 2025

Sure @Int-Circuit ! Write back with the wiki link, and I’ll empty out this gist and link to it instead.

@freestyle12358 sorry. These instructions were just documenting how I got it to work, but I don’t know much further. If you just need a windows binary, they have them built from the latest source on the QET website.

@freestyle12358
Copy link

Thanks for your reply, I might try again.

@Int-Circuit
Copy link

Int-Circuit commented Aug 11, 2025

Hey @ssweber Little question, if I only want to compile the app can I skip step 7.4 and 7.5 and successfully launch it from the CLI or are they required to open the app?

Also in the step 6.3, would adding sqlite to the path be enough and allow to use the .pro file as-it-is?.

You can here find the work in progress in the wiki

@ssweber
Copy link
Author

ssweber commented Aug 11, 2025

@Int-Circuit I just wrote down step-by-step of how I got it to work (Building on Windows with MinGW). I didn’t add anything unless I hit a problem. So probably all these steps are needed, unless you can build it without one of these steps 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment