- 使用指南
- 数字绘画基础知识
- 参考手册
- 实例教程
- 常见问题解答
- 参与者手册
- 扩展包和第三方教程
- 其他
- 显示设置
- 日志查看器
- 数位板设置
- Automated Krita builds on CI matrix
- Brush GUI Design with Lager
- Building Krita from Source
- CMake Settings for Developers
- Enable static analyzer
- How to patch Qt
- Introduction to Hacking Krita
- The Krita Palette format KPL
- Krita SVG Extensions
- Modern C++ usage guidelines for the Krita codebase
- Developing Features
- Optimize Image Processing with XSIMD
- Optimizing tips and tools for Krita
- Google Summer of Code
- Advanced Merge Request Guide
- Python Developer Tools
- Introduction to Quality Assurance
- Making a release
- Reporting Bugs
- Strokes queue
- Testing Strategy
- Triaging Bugs
- Unittests in Krita
- 矢量图层
- 常规设置
- 颜料图层
- 图层组
- 克隆图层
- 文件图层
- 填充图层
- 滤镜图层
- 笔刷引擎
- 透明度蒙版
- 滤镜笔刷引擎
- 滤镜蒙版
- 裁剪工具
- 移动工具
- 变形工具
- 变形笔刷引擎
- 变形蒙版
- 网格与参考线
- 工作区
- 笔刷预设
- 色板
- 键盘快捷键
- 设置菜单
- 性能设置
- 笔尖
- 不透明度和流量
- 常用笔刷选项
- 多路笔刷工具
- 手绘笔刷工具
- 直线工具
- 曲线工具
- 辅助尺工具
- 图层
- 矩形选区工具
- 椭圆选区工具
- 多边形选区工具
- 手绘轮廓选区工具
- 相似颜色选区工具
- 相连颜色选区工具
- 曲线选区工具
- 磁性选区工具
- 形状选择工具
- 锚点编辑工具
- 工具菜单
- 动画时间轴
- 绘图纸外观
- 动画曲线
- 分镜头脚本
- 颜色
- 色域蒙版
- 美术拾色器
- 多功能拾色器
- 智能填色蒙版工具
- *.gih
- 像素笔刷引擎
- *.kra
- SeExpr
- SeExpr 脚本
- 渐变
- 颜色涂抹笔刷引擎
- 纹理
- 拾色器工具
- LUT 色彩管理
- 小型拾色器
- 有损和无损图像压缩
- *.bmp
- *.csv
- *.exr
- *.gbr
- *.gif
- *.heif 和 *.avif
- *.jpg
- *.jxl
- *.kpl
- *.ora
- .pbm、.pgm 和 *.ppm
- *.png
- *.psd
- *.svg
- *.tiff
- *.webp
- 数学运算
- 变暗
- HSX
- 变亮
- 颜色混合
- 负片
- 其他
- 二元逻辑
- 取模运算
- 二次方
- 鬃毛笔刷引擎
- 粉笔笔刷引擎
- 克隆笔刷引擎
- 曲线笔刷引擎
- 力学笔刷引擎
- 网格笔刷引擎
- 排线笔刷引擎
- MyPaint 笔刷引擎
- 粒子轨迹笔刷引擎
- 快速笔刷引擎
- 形状笔刷引擎
- 草图笔刷引擎
- 喷雾笔刷引擎
- 切线空间法线笔刷引擎
- 笔刷选项
- 锁定笔刷选项
- 蒙版笔刷
- 传感器
- 添加形状
- 动画
- 矢量图形排列
- 笔刷预设历史
- 色彩通道
- 颜色滑动条
- 图层显示方案
- 过渡色调混合器
- 直方图
- 导航器
- 图案
- 录像工具
- 参考图像
- 形状属性
- 图像版本快照
- 量化拾色器
- 操作流程
- 触摸屏辅助按钮
- 撤销历史
- 矢量图形库
- 宽色域拾色器
- 调整颜色/图像
- 艺术效果
- 模糊
- 边缘检测
- 浮雕
- 图像增强
- 映射
- 其他
- 小波分解
- 图层样式
- 选区蒙版
- 拆分透明度通道到蒙版
- 编辑菜单
- 文件菜单
- 帮助菜单
- 图像菜单
- 图层菜单
- 选择菜单
- 视图菜单
- 窗口菜单
- 作者档案设置
- 画布快捷键设置
- 隐藏面板模式设置
- 色彩管理设置
- 拾色器设置
- G’Mic 设置
- 弹出面板设置
- Python 插件管理器
- 笔尖
- 笔刷预设
- 图案
- 文字工具
- 渐变编辑工具
- 图案编辑工具
- 西文书法工具
- 矩形工具
- 椭圆工具
- 多边形工具
- 折线工具
- 手绘路径工具
- 力学笔刷工具
- 填充工具
- 闭合填充工具/圈涂
- 渐变工具
- 智能补丁工具
- 参考图像工具
- 测量工具
- 缩放工具
- 平移工具
- Building Krita with Docker on Linux
- Building krita on host Linux system (unsupported)
- Building Krita for Android
- Working on Krita Dependencies
- 渐变
- 多维网格
- 图案
- 网点
- 单纯形法噪点
Building Krita from Source
If you want to help developing Krita, you need to know how to build Krita yourself. If you merely want to run the latest version of Krita, to test a bug or play with, you can use the nightly build for Windows the nightly build for Linux, or the nightly build for macOS.
You can build Krita on Linux, Windows, macOS and on Linux for Android. The libraries Krita needs (for instance to load and save various image types) are called dependencies.
Linux is the easiest operating system to build Krita on because all the libraries that Krita needs are available on most recent Linux distributions. For an easy guide to building Krita see Building Krita on Linux for Cats.
On macOS you can use tools like homebrew to get the dependencies, or build the dependencies manually. Building the dependencies manually is recommended because we have a number of changes to the source for libraries to make them function better with Krita.
On Windows you can either reuse the dependencies from the KDE Binary Factory, or build the dependencies yourself.
On all operating systems, you need to be familiar with using a terminal. Building Krita is a technical task and demands accuracy in following instructions and intelligence in understanding what happens.
Building on Linux
In general, there are two options for building Krita on Linux. One using the docker environment (recommended) and the other is by manually building all the Krita dependencies on the host linux system (unsupported).
Building on Windows
On Windows, you can either reuse the dependencies from the KDE Binary Factory, or build the dependencies yourself. If you decide to build all the dependencies yourself, this will take a long time. Note that you will do all your work in a CMD command window.
This is also more difficult than building Krita on Linux, so you need to pay attention to details. If you follow the guide closely, install correct dependencies and make sure your PATH doesn’t contain anything unwanted, there should be no issues.
Prerequisites
CMake 3.16.0 or later, the latest is usually fine - https://cmake.org/download/
Ninja build system - https://github.com/ninja-build/ninja/releases
Since Ninja is a single executable, you can place it in the bin folder of CMake, next to
cmake.exe
for convenience.
LLVM MinGW compiler toolchain
Can be downloaded here: https://github.com/mstorsjo/llvm-mingw/releases/download/20220906/llvm-mingw-20220906-ucrt-x86_64.zip
Unzip the archive with 7zip into a folder like
C:\llvm-mingw
; the full path must not contain any spaces.We are using the tagged release 20220906 with LLVM 15.0.0 on the Binary Factory. In theory a newer version should be compatible, but use at your own risk.
If you really want to use other compilers, see below.
You will also need a release of Python 3.10 (not 3.7, not 3.8, not 3.9, not 3.11) - https://www.python.org.
Make sure to have that version of python.exe in your path. This version of Python will be used for two things to configure Qt and to build the Python scripting module. Do not set PYTHONHOME or PYTHONPATH.
Make sure that your Python will have the correct architecture for the version you are trying to build. If building for 32-bit target, you need the 32-bit release of Python.
It is useful to install Qt Creator - https://download.qt.io/official_releases/qtcreator/
注意
Make double plus sure you do not have any other compilers or development environments or Python installation in your PATH!
Other Compilers
In the past we used mingw-w64 gcc 7.3.0 (mingw-builds). This version is no longer supported because our dependencies started requiring a more updated compiler to work.
It is possible to build Krita with a newer mingw-w64 gcc toolchain, for example gcc 11.2.0 by niXman on GitHub (mingw-builds), or the one from MSYS2.
MSYS2 can build Krita with the MINGW64, UCRT64 or CLANG64 environments.
Krita can also be built with MSVC (check the batch file in
build-tools\windows
). Krita built with MSVC has suboptimal performance due to codegen issues so we can’t use it.
注意
If you use these compilers, you must build the dependencies yourself. Trying to mix dependencies built with a different compiler may outright fail to configure, or Krita may appear to build successfully but you get random crashes wuen running it.
Preparation
After installing the Prerequisites, prepare your working directory somewhere, like C:\krita-dev
. Keep this short (30 characters in the prefix path is fine, but longer than this and you may get build errors). Makes sure the path does not contain whitespace. If you use a different path, remember to adjust the paths in the later steps.
mkdir C:\krita-dev cd /d C:\krita-dev
Set up python environment (you don’t need to hand-craft the bat file with the predefined PATH variables):
git clone https://invent.kde.org/dkazakov/krita-deps-management.git git clone https://invent.kde.org/dkazakov/ci-utilities.git krita-deps-management/ci-utilities c:\Python310\python.exe -m venv PythonEnv --upgrade-deps PythonEnv\Scripts\activate.bat python -m pip install -r krita-deps-management\requirements.txt
Getting the dependencies
Donwload the dependencies and generate the environment file. Make sure you replace the paths to llvm-mingw and ninja:
python krita-deps-management\tools\setup-env.py --full-krita-env -v PythonEnv -p c:\deps\llvm-mingw-20220906-ucrt-x86_64\bin\ -p c:\deps\llvm-mingw-20220906-ucrt-x86_64\x86_64-w64-mingw32\bin\ -p c:\deps\Ninja\
注意
If you happen to decide to hand-craft the PATH
variable, make sure your PATH
variable does not have double backslash symbols \\
. Especially as a result of multiple path variables concatenation.
If it has, ASAN symbolizer will crash when parsing error-reports.
Every time you want to build or run your home-grown Krita, open the CMD window, change to the C:\krita-dev
folder and run the env.bat
file generated by the script above:
cd /d C:\krita-dev env.bat
You will note that most command samples below contain these two lines, but the truth is you only need to run env.bat
once for each CMD window.
Then get the source code of Krita:
cd /d C:\krita-dev git clone https://invent.kde.org/graphics/krita.git
注意
If you build Krita with ASAN, make sure you don’t use prebuilt deps, or at least manually rebuild Qt with ASAN support as well (-DQT_ENABLE_ASAN=ON
). There is a know issue in LLVM’s linker, which causes Qt be loaded before ASAN and, therefore, causing some allocations confuse ASAN. Until this issue is fixed, build Qt with ASAN as a workaround.
Building Krita
Again, on the command line, configure the build:
cd /d C:\krita-dev env.bat mkdir -p C:\krita-dev\b_krita cd b_krita cmake C:\krita-dev\krita ^ -DCMAKE_INSTALL_PREFIX=C:/krita-dev/_install ^ -DBUILD_TESTING=ON ^ -DINSTALL_BENCHMARKS=ON ^ -DKRITA_ENABLE_PCH=OFF ^ -DHIDE_SAFE_ASSERTS=OFF ^ -G Ninja ^ -DCMAKE_BUILD_TYPE=RelWithDebInfo ninja -j8 install
If you are hacking on Krita, you can rebuild Krita without running the full build by entering the build directory and running mingw32-make -j8 install
or ninja -j8 install
.
cd /d C:\krita-dev env.bat cd b_krita ninja -j8 install
Running Krita
You must start Krita from the command prompt, after having run env.bat
:
cd /d C:\krita-dev env.bat _install\bin\krita :: or _install\bin\krita.exe
Building on macOS
We will build Krita on macOS with the same scripts that are used to build the nightly builds and the releases. We will NOT be building krita from within XCode, but from within the terminal.
Prequisites
You will need to install:
CMake: https://cmake.org
Python 3.10 or higher
XCode: get it from the app store
Qt Creator: https://download.qt.io/official_releases/qtcreator/
Preparation
Open Terminal.app. First you need to create buildroot folder:
export BUILDROOT=$HOME/dev mkdir -p $BUILDROOT cd $BUILDROOT
Now fetch Krita sources, build scripts and set up virtual environment for Python:
cd $BUILDROOT git clone https://invent.kde.org/graphics/krita.git # fetch environment scripts under Krita's source directory cd krita git clone https://invent.kde.org/dkazakov/krita-deps-management.git krita-deps-management --depth=1 git clone https://invent.kde.org/dkazakov/ci-utilities.git krita-deps-management/ci-utilities --depth=1 # create venv environemnt for running build scripts python3 -m venv $BUILDROOT/venv --upgrade-deps source $BUILDROOT/venv/bin/activate pip install -r krita-deps-management/requirements.txt
Install build tools (CMake, Ninja, CCache) that we use for Krita builds on CI. If you have these tools installed separately, then you can skip this step:
cd $BUILDROOT python3 $BUILDROOT/krita/build-tools/ci-scripts/download-macos-tools.py source $BUILDROOT/_krita-tools/activate
Fetching prebuilt dependencies
Now set up the environment for building Krita and download all the dependencies in a prebuilt form:
cd $BUILDROOT/krita source $BUILDROOT/venv/bin/activate source $BUILDROOT/_krita-tools/activate # if you used CI build tools python krita-deps-management/tools/setup-env.py --full-krita-env -v $BUILDROOT/venv -p $BUILDROOT/$KDECI_CRAFT_PLATFORM/dev-utils/bin/
The script will generate the following environment for you:
$BUILDROOT/krita/_install
— the install prefix for Krita with all the deps preinstalled
$BUILDROOT/krita/_build
— the build folder for Krita
$BUILDROOT/krita/env
— a script for build environment activation
$BUILDROOT/krita/env_deactivate
— a script for build environment de-activation
The steps above should be done only once when you set up the environement for the first time. Next time you open the console you should just source the env-file at $BUILDROOT/krita/env
, you don’t have to repeat all these steps with craft and python’s environment.
Building Krita
Building Krita is straightforward, just activate the environment and do the build. Everything will be activated automatically.
# go to the Krita source directory cd $BUILDROOT/krita # activate the build environment (you don't need to activate # any previous environments, like Python's venv environment; # everything is included in this ``env`` file) source $BUILDROOT/krita/env source $BUILDROOT/_krita-tools/activate # if you used CI build tools mkdir -p _build cd _build # configure Krita as usual cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo \ -DHIDE_SAFE_ASSERTS=OFF \ -DBUILD_TESTING=ON \ -DCMAKE_INSTALL_PREFIX=$BUILDROOT/krita/_install \ -DCMAKE_TOOLCHAIN_FILE=$BUILDROOT/krita/krita-deps-management/tools/macos-toolchain-krita.cmake \ $BUILDROOT/krita # build and install ninja -j8 install
This will build and install Krita to $BUILDROOT/krita/_install/bin/krita.app
Running Krita
You can run krita in the same terminal window:
$BUILDROOT/krita/_install/bin/krita.app/Contents/MacOS/krita
If you want to debug krita with lldb:
cd $BUILDROOT/krita lldb ./_install/bin/krita.app/Contents/MacOS/krita (lldb) target create "./_install/bin/krita.app/Contents/MacOS/krita" Current executable set to './_install/bin/krita.app/Contents/MacOS/krita' (x86_64). (lldb) r
Building on Android
See a dedicated page for building Krita on Android
Building Krita’s dependencies manually
See a dedicated page for building Krita’s dependencies manually
Contents:
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论