进行KIACD开发的第一步编译KICAD

这篇博客详细介绍了在Windows和Linux环境下编译开源电子设计自动化软件KICAD的步骤。从安装必要的工具,如msys和mingw,到配置和编译wxWidgets、zlib、CMAKE等依赖库,再到使用CMAKE创建和构建KICAD的makefiles,最后通过make命令完成编译和安装。文章特别强调了在编译过程中遇到的问题和解决方法,适合想要深入了解KICAD开发或自定义构建的读者。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

如果你还不清楚什么是KICAD,那还是先google一下去吧,研究了好久都没有成功,原因主要是没有从事过这么复杂的编译(以前用vs 的用习惯了),

其实熟悉linux 的用户早就应该知道一个密密那就是 如何安装都在源码包里面的,如:KICAD它的编译方法也不外外:

 

--== How to build kicad using CMAKE ==--
First Written: 19-Dec-2007
Last Revised: 12-Mar-2008


Kicad needs wxWidgets, the multi platform G.U.I.

Perform these steps in sequence. (Platform specific details are given in
sections below.)


1)  If windows, then install "msys" and "mingw".
2)  If linux, then install "mesa".
3)  Make sure g++ and "make" are in your path.
4)  Install wxWidgets [and build it if on windows].
5)  Install zlib [and build it if on windows].
6)  Install CMAKE
7)  Install Boost C++ Template Libraries (*.hpp files)
8)  Install the kicad source tree.
9)  Use cmake to build the kicad makefiles.
10) Use make to build and install kicad.
11) Making a "Debug" build.
12) Variables for fine-tuning the build process.


===== Step Details ====================================================

1)  If windows, then install "msys" and "mingw".
Skip this step if on a Unix box.  Get msys and mingw here:
http://mingw.org/
msys sets up a development environment that allows the bash shell to run.
mingw are a set of tools that run on windows or under msys.  You will need
at least the following mingw packages: make, gcc, g++, binutils, autoconf, and
automake.

-----------------------------------------------------------------------------

2)  If linux, install "mesa".  Use your package manager to install the development
libaries.

-----------------------------------------------------------------------------

3)  Make sure g++ and "make" are in your path.
If windows, then try running g++ and make from within your msys bash shell.

-----------------------------------------------------------------------------

4)  Install wxWidgets [and build it if on windows].
If on windows, download
http://prdownloads.sourceforge.net/wxwindows/wxMSW-2.8.8.zip or a newer version.
Start msys so you have a bash shell.  Decide where your wxWidgets build directory
will be.  It must be where you can access it from within the msys environment,
such as home/<user>.   Edit your msys/1.0/etc/fstab file if needed to provide
access to this build directory from msys.  (Note that if you want you can build
a "debug" version of the wxWidgets library at this point, instead of the release
version, or in addition to the the release version.)
Unzip the wmMWS zip file into the build directory.  Change directories into there,
and then:

    mkdir build-release
    mkdir build-debug

-- release
    cd build-release
    ../configure --enable-unicode --enable-monolithic --disable-shared --with-msw --with-opengl
    make
    make install

-- debug
    cd build-debug
    ../configure --enable-unicode --enable-monolithic --enable-debug --enable-debug_gdb --disable-shared --with-msw --with-opengl
    make
    make install

I think the default is to install into /usr/local/wxMSW-2.8.8.  You can probably
pass --prefix=<wxInstallDir> to configure above to change where "make install"
puts everything.  We will refer to <wxInstallDir> again below.  Without the
--prefix=<wxInstallDir> passed to configure, <wxInstallDir> will likely be
    /usr/local/wxMSW-2.8.8

Verify that wx-config is in your path.  Modify your PATH environment variable
if need be so you can run wx-confi

### 编译环境准备 为了在 Windows 10 上成功编译 KiCad 源码,需要先准备好必要的开发工具和依赖库。推荐使用 CMake 和 Ninja 构建系统来简化构建过程[^2]。 #### 安装 Visual Studio Visual Studio 是 Microsoft 提供的强大集成开发环境 (IDE),支持多种编程语言和技术框架。对于 KiCad编译来说,至少要安装以下组件: - MSVC v142 - VS 2019 C++ x64/x86 build tools (最新) - Windows 10 SDK (最新) 可以通过访问 [Microsoft官方网站](https://visualstudio.microsoft.com/) 下载并安装适合的版本。 #### 设置 Git 版本控制系统 Git 是分布式版本控制软件,可以从 GitHub 获取最新的 KiCad 源代码仓库。前往 [git-scm官网](https://git-scm.com/download/win) 进行下载安装。 #### 配置 Python 解释器 Python 对于运行某些脚本文件至关重要。建议安装 Python 3.x 系列,并确保 `pip` 工具也一同被安装。可从 [python.org](https://www.python.org/downloads/release/python-397/) 获得稳定版。 ```bash # 使用 pip 安装所需 python 库 pip install wheel setuptools virtualenv ``` ### 开始编译流程 完成上述准备工作之后,就可以正式进入 KiCad 源码的获取与编译阶段了。 #### 克隆远程仓库到本地机器 打开命令提示符窗口,在目标目录下执行如下 git 命令克隆官方 ki cad 主分支至当前路径: ```bash git clone https://github.com/KiCad/kicad.git kicad-source cd kicad-source ``` #### 创建独立的工作空间 为了避免污染原始源代码树结构,应该创建一个新的子目录作为工作区来进行后续操作。 ```bash mkdir build && cd build ``` #### 执行 cmake 配置指令 通过指定合适的参数调用 CMake 来配置项目属性以及生成对应的 makefile 文件或其他平台特定格式的工程描述文档。 ```bash cmake .. -G "Ninja" \ -DCMAKE_BUILD_TYPE=Release \ -DKICAD_SCRIPTING_WXPYTHON=OFF \ -DPYTHON_EXECUTABLE=$(which python.exe) ``` > 注意:如果遇到任何错误消息,请仔细阅读报错信息中的提示内容加以解决后再继续下一步骤。 #### 启动 ninja 实际编译进程 当所有前置条件都满足以后,则可以直接启动 ninja 或者其他由前面步骤产生的 IDE 方式开启真正的编译环节。 ```bash ninja ``` 等待一段时间直至整个编译顺利完成即可获得完整的 KiCad 可执行程序集。
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值