Compiling and Debugging KiCad

I like the idea of being able to improve my CAD tools with features I’m interested in working on. I’m in luck with KiCad because it is written in programming languages I am familiar with. Unfortunately, most of my experience is in the embedded world, and I don’t have as much knowledge about working on larger desktop apps, especially ones with installers.

Say I make a change to some source file, do I need to rebuild the entire suite of apps, make an installer, and run that installer to see the effect of my change, or is there some other workflow?

Often I use Ubuntu, but right now I’m currently Windows.

Thanks, and sorry for my ignorance!

It’s been a while since I’ve compiled Kicad, but the needed steps are shown here: https://github.com/KiCad/kicad-source-mirror/blob/master/INSTALL.txt (and I’m sure in the launchpad site as well).

You’ll need to “apt install” the needed dependencies per that document and then compile per the same doc. Ah, I see you’re on Windows, that’s a bit more difficult because you don’t have something like apt. I used to build on Windows using https://launchpad.net/kicad-winbuilder, but it seems like I remember someone saying it’s deprecated. Either way, setting up building on Windows is kind of rough.

EDIT: Yeah, go here instead of the launchpad link for Windows: https://github.com/KiCad/kicad-winbuilder

Thanks for the info! I think the document detailing the build process that I found was a little bit out of date. This document you linked seems to have more details, even about building the individual apps separately.

Also, it seems like the development process is much easier in Ubuntu, so I think I will just boot into that when I am working on the code.

On linux it’s easy, especially if you’re the only kicad user on the machine. I just build and do a “local install” (install to user directory) and make sure that when I start a shell the PATH and LD_LIBRARY_PATH variables are set so that my locally installed software will run. For example I would do:

cd kicad_src/build
cmake -DCMAKE_INSTALL_PREFIX=/usr (… long list of options) …
make -j8 install DESTDIR=/home/myuser

For most cases, with the current design of kicad, when you change a file you will have to rebuild the affected applications. Unfortunately there is a lot of strong coupling in the code so sometimes making a trivial change to a header file can result in 30% or more of the affected application being rebuilt. The only exception to this at the moment is the 3D visualization code since that now uses a plugin system to translate model files into data for display. So if you’re making a plugin to view 3D models, life remains easy. If you need to touch any other code in kicad, compile times are often long.

With the build system, you can also rebuild and install only a particular component, for example:

cd kicad_src/build/utils/idftools
make install DESTDIR=/home/myuser

1 Like