Building Kicad with QT Creator on Windows/Msys2

Building Kicad with QT Creator on Windows/Msys2

I have been working towards integrating RenumKicadPCB functionality (i.e. geographic back-annotation) into Kicad for some time. Actually, to be accurate I have been hoping to do that. A major roadblock has been an IDE which allows me to edit, build, and debug the code. I had experimented with Eclipse and Microsoft Visual Studio Community Edition but I couldn’t import the official cmake files as there was always something missing. I am, after all, a former hardware guy not a modern programmer.

Recently back-annotation came up in a Kicad developer’s thread and I made contact with Alexander Shuklin, who is not only a more advanced software guy but he has already contributed to Kicad. We agreed to collaborate on the project – a development which I am very happy with. Alexander uses QT-Creator and, while I was initially hoping he could help me get Kicad working on MSVC I realized it would probably be easier for me to get QT-Creator working since at least I know you can build Kicad on that IDE.

After several days of failure interspersed with a near success (I was so tired I forgot to document what I had done) I managed to get things going. Here is the procedure to build Kicad on Windows with QT-Creator. Note that this only seems to work with the Msys2 version of QT-Creator, not the Windows version of QT-Creator even if Msys2 is installed. Unfortunately this took a day and a half to figure out. I almost succeed with the QT-Creator on Windows (I actually got about 33% through the compile) but, as I mentioned I forgot to document what I done.

First install Msys2 (see http://repo.msys2.org/distrib/x86_64/msys2-x86_64-20161025.exe )

Everything below is from a mingw64 terminal window. It does not seem to work if you pick from the Msys2 pop-up. I show 64 bit development because that is what is recommended. Similar steps would apply to a 32 bit development environment.

There may be redundant or unnecessary steps in this recipe. I completely deleted Msys2 a few times and re-ran this procedure but there are only so many hours in a day.

From the Mingw64 terminal (comments marked by //)

pacman -Syuu //Answer yes to remove conflicts close the window via task manager when done

pacman -Syuu //Takes a long time close the window via task manager when done

pacman -Syuu //To make sure all is up to date

Copy and paste the following lines into your Mingw64 terminal (all the way from pacman -S to the blank line)

pacman -S base-devel \
git \
mingw-w64-x86_64-cmake \
mingw-w64-x86_64-doxygen \
mingw-w64-x86_64-gcc \
mingw-w64-x86_64-python2 \
mingw-w64-x86_64-pkg-config \
mingw-w64-x86_64-swig \
mingw-w64-x86_64-boost \
mingw-w64-x86_64-cairo \
mingw-w64-x86_64-glew \
mingw-w64-x86_64-curl \
mingw-w64-x86_64-wxPython \
mingw-w64-x86_64-wxWidgets \
mingw-w64-x86_64-toolchain \
mingw-w64-x86_64-glm \
mingw-w64-x86_64-oce \
mingw-w64-x86_64-ngspice
mercurial \
cvs \
p7zip \
ruby \
mingw-w64-i686-toolchain mingw-w64-x86_64-toolchain

Now copy these lines one at a time (it may be possible to combine these with the above)

pacman -S mingw-w64-i686-qt-creator mingw-w64-x86_64-qt-creator

pacman -S mingw-w64-x86_64-clang

pacman -Syuu

Run qtcreator to make sure it works then exit qtcreator.

qtcreator

Download source files eg kicad-5.1.4.tar.xz into a suitable location such as /home source files can be found at http://kicad-pcb.org/download/source/ then

tar -xaf kicad-5.1.4.tar.xz

Run qtcreator from the ming64 terminal (for some reason, it doesn’t work if you pin it to the taskbar)

qtcreator

Select Open File or Project and open the Kicad source directory. Wait for it to parse

Note that QT will make its own build directory. This doesn’t seem to matter.

Select Build, rebuild project. On my machine it takes about 2 hours to compile Kicad

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s