Antmicro Kmake

A KiCad build tool with some surprising features

I came across this tool recently: kicad-make and tried it out. Well it’s actually be floating around in my collection of GitHub stars I periodically extend whenever there’s a new problem to solve. I’ll let the fact that they named their repo the same as mine, kicad-make, slide for now. Antmicro has a solid track record—particularly in contributing to open-source tools for hardware development, which is something I deeply appreciate. So I had high expectations going into this.

The standout features of this tool are loclib and globlib.

kmake --help
...
loclib                      Create local project library and link
                            symbols/footprint/3D models to this library.
...
globlib                     Link symbols and footprints to global libraries.

Instead of using the KiCad API, KMake uses kiutils which directly reads and modifies the source files using native sexpressions.

loclib

I did run into a bit of trouble getting this to work initially, as the variables in the library paths weren’t being expanded as expected. After some troubleshooting and a very minor pull request, I got it working.

The loclib function copies all the symbols, footprints, and 3D models into your local directory for portability. This is something I’ve had to do manually a few times using vim macros, so this feature is definitely an improvement!

globlib

Once I fixed a broken path in my configuration, the reverse of loclib (i.e., globlib) also worked. globlib scans all the global libraries and matches a custom field labeled “MPN” (Manufacturer’s Part Number).

I can’t say I’m in love with this approach. For my projects I use the full “Manufacturer’s Part Number” field name, not just “MPN.” It would be nice if loclib maintained the existing library structure so the root of the library path could be modified, instead of matching based solely on the part number. However, this is a relatively rare use case for me– I don’t find myself needing to undo a local library often.

Conclusion

Promising tool from a capable group of people! It could use some refinment but the loclib function alone is worth checking out.