目录
文章翻译自官方说明文档,如有错误请积极发言不吝指正
CuraEngine.wiki - Building CuraEngine From Source
注意:
我们目前正在将我们的构建和管道转换为一种使用Conan
和 PIP 来管理我们的依赖关系,这些依赖关系存储在我们的 JFrog Artifactory 服务器和 pypi.org 中。
目前还不是所有的东西都完全移植了,所以请耐心等待。
系统要求
Windows
- Python 3.10 以上
- Ninja 1.10 或更高版本
- VS2022 或更高版本
- CMake 3.23 或更高版本
- nmake
MacOS
- Python 3.10 以上
- Ninja 1.10 或更高版本
- apply Clang 11 或更高版本
- CMake 3.23 或更高版本
- make
Linux
- Python 3.10 以上
- Ninja 1.10 或更高版本
- GCC 12 或更高
- CMake 3.23 或更高版本
- make
安装
我们使用 Conan 来管理我们的依赖项和构建配置。如果你从来没有使用过Conan,请阅读他们的文档,这是相当广泛和维护良好的。
有关 Windows 版本的说明
对于某些人来说,仅在 PowerShell 中遵循这些步骤并不能完全奏效。我们建议你遵循本文中的“Visual Studio ”提示(如果你无论如何都想在该程序中工作,可能会更好),或者,如果你只想使用命令行(基本上是独立的 MSVC 编译器),请首先启动“x64 Native Tools Command Prompt for VS”。然后在其中启动(子)PowerShell,_然后_按照说明操作。
1. 配置Conan
在开始之前,如果你还将 Conan 用于其他(大型)项目,最好切换 Conan-Home 和/或备份现有的 Conan 配置。
也就是说,安装我们的配置如下:
pip install conan==1.56
conan config install https://github.com/ultimaker/conan-config.git
conan profile new default --detect --force
2. 克隆 CuraEngine
git clone https://github.com/Ultimaker/CuraEngine.git
cd CuraEngine
3. 安装和构建 CuraEngine(发布或调试)
发布 - Release
conan install . --build=missing --update
# optional for a specific version: conan install . curaengine/<version>@<user>/<channel> --build=missing --update
在 Windows 上,如果你想在 Visual Studio 中工作(而不是从命令行),请跳过下面两行:
cmake --preset release
cmake --build --preset release
调试 - Debug
conan install . --build=missing --update -s build_type=Debug -o curaengine:enable_testing=True
在 Windows 上,如果你想在 Visual Studio 中工作(而不是从命令行),请跳过下面两行:
cmake --preset debug
cmake --build --preset debug
Visual Studio
对于在 Windows 上的 Visual Studio 中工作:执行上述调试和/或发布步骤,跳过相应的步骤。然后,在 VisualStudio 中打开 CuraEngine 文件夹。从 Build 菜单中选择“Build All ”(可能在界面中选择是否要构建调试或发布配置之后)。
4. 激活Conan运行环境
# For Linux/MacOS
source build/generators/conanrun.sh
# For Windows (Powershell)
.\build\generators\conanrun.sh
5. 连接到 Cura
如果你使用选项–external-backend 运行 cura_app.py,Cura 将在点击切片按钮时等待外部后端。
通过运行以下命令,你可以使用开发环境进行切片。
./build/Debug/CuraEngine connect 127.0.0.1:49674
OR
./build/Release/CuraEngine connect 127.0.0.1:49674
如果切片出现故障,则需要在下次运行此命令时增加端口号。
故障排除
一些错误消息及其潜在原因:
[Could not find a package configuration file provided by "rapidjson" (requested version 1.1.0)](https://www.google.com/search?q=Could+not+find+a+package+configuration+file+provided+by+%22rapidjson%22+%28requested+version+1.1.0%29+with+any+of+the+following+names)
–尝试构建 5.2 之前的版本时遇到此错误。请在 5.2 或更高版本上重试。Make Error: Could not read presets from : Unrecognized "version" field
–确保你使用的是 CMake 3.23 或更高版本(与 Ubuntu 22.04 捆绑的版本不够新)。- 联系 jfrog.artifactory.com 或类似网站时出错–请确保你已运行
conan remote remove cura
。
运行 CuraEngine
从Cura前端运行
你可以使用前端(如 Cura)运行 CuraEngine.你可以在上Cura wiki找到这方面的说明。
从命令行运行
要从命令行运行 CuraEngine,你需要一个设置 JSON 文件,该文件可以在 Ultimaker/Cura 存储库中找到。
运行 CuraEngine help
以获取有关如何使用 CuraEngine 工具的一般说明。