Difference between revisions of "CMake"
m |
(Major cleanup) |
||
Line 1: | Line 1: | ||
Inkscape uses CMake for building. CMake is a powerful cross-platform build system. | |||
== Compiling Inkscape with CMake == | |||
See https://inkscape.org/develop/getting-started/ | |||
== Using CMake to run tests == | == Using CMake to run tests == | ||
Line 138: | Line 51: | ||
* CMAKE_BUILD_TYPE: Either Release or Debug (a string). | * CMAKE_BUILD_TYPE: Either Release or Debug (a string). | ||
* CMAKE_INSTALL_PREFIX: Path in which "make install" installs Inkscape. | * CMAKE_INSTALL_PREFIX: Path in which "make install" installs Inkscape. | ||
== Variations == | |||
=== Using CMake with Ninja to build Inkscape === | |||
Another option for building with CMake is to use it in combination with [https://ninja-build.org/ Ninja] which is a small build system with a focus on speed and replaces GNU Make. | |||
Usage of Ninja will significantly speed up incremental rebuilds (i.e. if only few code files need to be re-compiled) as the build systems overhead is greatly reduced and scanning dependencies is almost instantaneous. | |||
After following the instructions on the website to get Ninja the procedure is almost identical (only changes necessary highlighted in red): | |||
mkdir build | |||
cd build | |||
cmake <span style="color:red">-G Ninja</span> /path/to/inkscape | |||
<span style="color:red">ninja</span> | |||
<span style="color:red">ninja</span> install <span style="color:gray"># only if you want to install the distribution</span> | |||
Basically, you have to replace "make" with "ninja" in the compilation instructions. | |||
== Background == | |||
All the CMake configuration can be found in CMakeLists.txt and the CMakeScripts/ folder. See the CMake documentation for more information. https://cmake.org/cmake/help/latest/guide/tutorial/index.html |
Revision as of 14:31, 26 May 2025
Inkscape uses CMake for building. CMake is a powerful cross-platform build system.
Compiling Inkscape with CMake
See https://inkscape.org/develop/getting-started/
Using CMake to run tests
First, install Google Test framework: Preferably by getting the packaged version for your distribution, if that fails you can try to download a local copy by running download-gtest.sh in the main directory of inkscape source:
cd /path/to/inkscape bash download-gtest.sh
Then re-run cmake to detect the configuration change:
cd /path/to/buildinkscape cmake ../inkscape
Finally, run "make check" from same directory to run the tests:
make check
Configuring your build further
It is possible to change some more options of the build, e.g. whether to compile against GTK2 or GTK3 libraries. If you fiddle a lot with this, you may want to install the interactive cmake configuration tool "ccmake", like so:
sudo apt-get install cmake-curses-gui ccmake ../inkscape # In buildinkscape folder
The ccmake utility will have features to re-run cmake for you before exiting.
For example you can use CMAKE_INSTALL_PREFIX Path in which "make install" installs Inkscape and allow handle multiple Inkscape instalations.
Press enter on the line to edit.
Press again to save, when all your changes are done press c to configure, exit help and press g to generate.
After this you exit ccmake and can finish with make.
adding options to cmake
you can specify some variable on cmake invokation. i.e.
cmake .. -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Debug
Useful CMake configuration variables include
- CMAKE_BUILD_TYPE: Either Release or Debug (a string).
- CMAKE_INSTALL_PREFIX: Path in which "make install" installs Inkscape.
Variations
Using CMake with Ninja to build Inkscape
Another option for building with CMake is to use it in combination with Ninja which is a small build system with a focus on speed and replaces GNU Make.
Usage of Ninja will significantly speed up incremental rebuilds (i.e. if only few code files need to be re-compiled) as the build systems overhead is greatly reduced and scanning dependencies is almost instantaneous.
After following the instructions on the website to get Ninja the procedure is almost identical (only changes necessary highlighted in red):
mkdir build cd build cmake -G Ninja /path/to/inkscape ninja ninja install # only if you want to install the distribution
Basically, you have to replace "make" with "ninja" in the compilation instructions.
Background
All the CMake configuration can be found in CMakeLists.txt and the CMakeScripts/ folder. See the CMake documentation for more information. https://cmake.org/cmake/help/latest/guide/tutorial/index.html