Development Tools
Essential Tools
Version Control
- Git - Version control system
- GitLab account - For hosting your fork and submitting merge requests
Build System
- CMake 3.22+ (3.28.1+ for MSVC ARM)
- Make or Ninja build system
- ccache (optional) - Speeds up recompilation
- distcc (optional) - Distributed compilation
Compilers
KiCad requires C++20 support:- GCC 10+ (Linux)
- Clang 11+ (macOS, Linux)
- MSVC 2019+ (Windows)
Recommended Development Tools
Code Editors and IDEs
Visual Studio Code- C/C++ extension
- CMake Tools extension
- GitLens extension
- clang-format extension
- Full CMake integration
- Built-in debugger
- Code analysis tools
- CMake support
- Good C++ support
- YouCompleteMe or coc.nvim for code completion
- vim-cmake plugin
Debugging Tools
- GDB (Linux)
- LLDB (macOS, Linux)
- Visual Studio Debugger (Windows)
- Valgrind - Memory debugging and profiling
- Address Sanitizer (ASan) - Memory error detection
- Thread Sanitizer (TSan) - Data race detection
Setting Up Your Environment
Fork and Clone the Repository
-
Fork the repository on GitLab:
- Navigate to https://gitlab.com/kicad/code/kicad
- Click “Fork”
-
Clone your fork:
-
Add upstream remote:
Configure Your GitLab Fork
Configure your personal fork with the following settings:-
Settings → General → Visibility
- CI/CD should be enabled and set to “Everyone with access”
-
Settings → CI/CD → General pipelines
- Timeout should be set to 3 hours or longer
-
When creating merge requests
- Check “Allow commits from members who can merge to the target branch” at the bottom of your merge request
Build Directory Structure
Recommended directory layout:Initial Build Setup
Debug Build
CMAKE_EXPORT_COMPILE_COMMANDS=ON option generates compile_commands.json, which many IDEs and language servers use for code intelligence.
Release Build for Testing
Development Workflow
Keeping Your Fork Updated
Creating a Feature Branch
Incremental Builds
After making code changes:Running Tests
Debugging
Using GDB (Linux)
Using Sanitizers
Address Sanitizer
- Use-after-free
- Heap/stack/global buffer overflow
- Use-after-scope
- Memory leaks
Thread Sanitizer
- Data races
- Deadlocks
Using Valgrind
Code Intelligence and Formatting
compile_commands.json
CMake generatescompile_commands.json in your build directory (when CMAKE_EXPORT_COMPILE_COMMANDS=ON is set). Many tools use this:
- clangd language server
- VSCode C++ extension
- CLion
- vim-clang
Code Formatting
KiCad uses clang-format for code formatting. The configuration is in_clang-format at the repository root.
Format a file:
Performance Optimization
Using ccache
ccache speeds up recompilation by caching previous compilations:Using Precompiled Headers
KiCad uses precompiled headers by default to speed up builds:Parallel Builds
Always use parallel builds:Platform-Specific Notes
Linux
GTK3 Development Files Required:macOS
Xcode Command Line Tools:Windows
MSVC with parallel compilation:Troubleshooting
Build Cache Issues
If you encounter strange build errors:IDE Not Finding Headers
- Ensure
compile_commands.jsonis generated and symlinked - Rebuild the project to update the compile commands
- Restart your IDE/language server
Library Version Conflicts
Use the exact library versions that CI uses. Check.gitlab-ci.yml in the repository for reference.
Additional Resources
- Developer Docs: https://dev-docs.kicad.org
- GitLab CI Pipeline: Check CI configuration for build examples
- Doxygen Documentation: Generated from source code comments
- Developers Mailing List: https://groups.google.com/a/kicad.org/g/devlist
Next Steps
- Review the code style guidelines
- Start with a starter issue
- Learn how to submit merge requests