KiCadBuildQuickRef: Difference between revisions

From Code::Blocks
Stahta01 (talk | contribs)
→Requirements: Rewrite
Stahta01 (talk | contribs)
 
(18 intermediate revisions by the same user not shown)
Line 1: Line 1:
[[Category:User Documentation]]
[[Category:User Documentation]]
== How-to build KiCad with Code::Blocks ==
== How-to build KiCad with MSys2 Code::Blocks ==
by Tim Stahlhut (stahta01)<br>
by Tim Stahlhut (stahta01)<br>[https://forums.codeblocks.org/index.php/topic,26051.msg177348/topicseen.html CB Forum Thread]
===Requirements===
====Requirements====
- KiCAD source<br>
- KiCAD source<br>
- KiCAD depends<br>
- KiCAD depends<br>
Line 8: Line 8:
- CMake<br>
- CMake<br>
- Code::Blocks<br>
- Code::Blocks<br>
- [https://www.msys2.org/wiki/MSYS2-installation/ MSys2]<br>


===MinGW GCC Compiler steps===
====MSys2 Mingw Environment package install commands====


====install "mingw".====
<syntaxhighlight lang="bash">
* [[MinGW installation]]: How to install MinGW.
pacman -S --needed git ${MINGW_PACKAGE_PREFIX}-cmake ${MINGW_PACKAGE_PREFIX}-gcc \
====Install zlib.====
  ${MINGW_PACKAGE_PREFIX}-boost \
For more zlib info see http://gnuwin32.sourceforge.net/packages/zlib.htm.<br>
  ${MINGW_PACKAGE_PREFIX}-pkgconf \
Download Developer files for Zlib from http://gnuwin32.sourceforge.net/downlinks/zlib-lib-zip.php<br>
  ${MINGW_PACKAGE_PREFIX}-codeblocks \
Extract the files from zlib-1.2.3-lib.zip into your MinGW base folder.<br>
  ${MINGW_PACKAGE_PREFIX}-make \
Download Binaries files for Zlib from http://gnuwin32.sourceforge.net/downlinks/zlib-bin-zip.php<br>
  ${MINGW_PACKAGE_PREFIX}-swig
Extract the DLL from zlib-1.2.3-bin.zip into any folder that is in your path; like your MinGW bin folder.


====Install Boost C++ Template Libraries (*.hpp files)====
pacman -S --needed ${MINGW_PACKAGE_PREFIX}-opencascade \
* [[BoostWindowsQuickRef]]: A beginner's quick reference for setting up Boost with Code::Blocks in Windows
  ${MINGW_PACKAGE_PREFIX}-glm \
  ${MINGW_PACKAGE_PREFIX}-libgit2 \
  ${MINGW_PACKAGE_PREFIX}-ngspice \
  ${MINGW_PACKAGE_PREFIX}-nng \
  ${MINGW_PACKAGE_PREFIX}-protobuf \
  ${MINGW_PACKAGE_PREFIX}-wxPython


===wxWidgets Steps===
</syntaxhighlight>
* [[Compiling wxWidgets 2.8.9 Monolithic Build with openGL for Windows]]: How to install and Build wxWidgets.


===Build KiCad using CMake and Code::Blocks Steps===
====Build KiCad using CMake and Code::Blocks Steps====
====Install the KiCad source tree.====


====Install CMAKE====
* Clone git repo<syntaxhighlight lang="bash">
Download the installation binary for windows from http://www.cmake.org.<br>
mkdir -p ~/devel && cd ~/devel && \
http://www.cmake.org/cmake/resources/software.html<br>
git clone https://github.com/KiCad/kicad-source-mirror.git kicad
http://www.cmake.org/files/v2.6/cmake-2.6.3-win32-x86.exe<br>
Install that and choose to add cmake to your path during installation.<br> 
You will have to restart and command shells for the new path to take effect.<br>
Verify that cmake is in your path by trying to run it from a command prompt.<br>


====Install Code::Blocks====
</syntaxhighlight>
====Patch CMake files to use Monolithic wxWidgets ====
* Create CB Project
In file kicad/CMakeLists.txt
<syntaxhighlight lang="bash" line="1">
change the following line
mkdir -p ~/devel/kicad/cb_build && cd ~/devel/kicad/cb_build && \
::find_package(wxWidgets COMPONENTS gl html adv core net base QUIET)
cmake -Wno-dev \
to this line below
  -DCMAKE_INSTALL_PREFIX="${MINGW_PREFIX}"/local \
::find_package(wxWidgets COMPONENTS mono gl QUIET)
  -DDEFAULT_INSTALL_PATH="${MINGW_PREFIX}"/local \
  -DOCC_INCLUDE_DIR="${MINGW_PREFIX}"/include/opencascade \
  -DKICAD_BUILD_QA_TESTS=OFF \
  -DNANODBC_DISABLE_ASYNC=ON \
  -DCMAKE_MAKE_PROGRAM="${MINGW_PREFIX}"/bin/mingw32-make.exe \
  -G"CodeBlocks - MinGW Makefiles" ..


====Use CMake to build the KiCad makefiles.====


====Use Code::Blocks to build KiCad.====
</syntaxhighlight>

Latest revision as of 02:10, 22 May 2025

How-to build KiCad with MSys2 Code::Blocks

by Tim Stahlhut (stahta01)
CB Forum Thread

Requirements

- KiCAD source
- KiCAD depends
- GCC Toolchain
- CMake
- Code::Blocks
- MSys2

MSys2 Mingw Environment package install commands

pacman -S --needed git ${MINGW_PACKAGE_PREFIX}-cmake ${MINGW_PACKAGE_PREFIX}-gcc \
  ${MINGW_PACKAGE_PREFIX}-boost \
  ${MINGW_PACKAGE_PREFIX}-pkgconf \
  ${MINGW_PACKAGE_PREFIX}-codeblocks \
  ${MINGW_PACKAGE_PREFIX}-make \
  ${MINGW_PACKAGE_PREFIX}-swig

pacman -S --needed ${MINGW_PACKAGE_PREFIX}-opencascade \
  ${MINGW_PACKAGE_PREFIX}-glm \
  ${MINGW_PACKAGE_PREFIX}-libgit2 \
  ${MINGW_PACKAGE_PREFIX}-ngspice \
  ${MINGW_PACKAGE_PREFIX}-nng \
  ${MINGW_PACKAGE_PREFIX}-protobuf \
  ${MINGW_PACKAGE_PREFIX}-wxPython

Build KiCad using CMake and Code::Blocks Steps

  • Clone git repo
    mkdir -p ~/devel && cd ~/devel && \
    git clone https://github.com/KiCad/kicad-source-mirror.git kicad
  • Create CB Project
mkdir -p ~/devel/kicad/cb_build && cd ~/devel/kicad/cb_build && \
cmake -Wno-dev \
  -DCMAKE_INSTALL_PREFIX="${MINGW_PREFIX}"/local \
  -DDEFAULT_INSTALL_PATH="${MINGW_PREFIX}"/local \
  -DOCC_INCLUDE_DIR="${MINGW_PREFIX}"/include/opencascade \
  -DKICAD_BUILD_QA_TESTS=OFF \
  -DNANODBC_DISABLE_ASYNC=ON \
  -DCMAKE_MAKE_PROGRAM="${MINGW_PREFIX}"/bin/mingw32-make.exe \
  -G"CodeBlocks - MinGW Makefiles" ..