Skip to content

Building CuraEngine From Source

Jelle Spijker edited this page Jun 11, 2023 · 19 revisions

Note:
We are currently in the process of switch our builds and pipelines to an approach which uses Conan and pip to manage our dependencies, which are stored on our JFrog Artifactory server and in the pypi.org. At the moment not everything is fully ported yet, so bear with us.

System Requirements

Windows

  • Python 3.10 or higher
  • Ninja 1.10 or higher
  • VS2022 or higher
  • CMake 3.23 or higher
  • nmake

MacOs

  • Python 3.10 or higher
  • Ninja 1.10 or higher
  • apply clang 11 or higher
  • CMake 3.23 or higher
  • make

Linux

  • Python 3.10 or higher
  • Ninja 1.10 or higher
  • gcc 12 or higher
  • CMake 3.23 or higher
  • make

Installation

We are using conan to manage our dependencies and build configuration. If you have never used Conan read their documentation which is quite extensive and well maintained.

Notes on builds for Windows

For some people, following these steps in powershell alone don't work all the way. We advice you to either follow the 'Visual Studio' hints in this writeup (probably better if you want to work within that program anyway), or, if you want to use the command-line only (MSVC compiler as standalone, basically), first start 'x64 Native Tools Command Prompt for VS', then start a (sub) powershell in that, then follow the instructions.

1. Configure Conan

Before you start, if you use conan for other (big) projects as well, it's a good idea to either switch conan-home and/or backup your existing conan configuration(s).

That said, installing our config goes as follows:

pip install conan==1.56
conan config install https://github.com/ultimaker/conan-config.git
conan profile new default --detect --force

2. Clone CuraEngine

git clone https://github.com/Ultimaker/CuraEngine.git
cd CuraEngine

3. Install & Build CuraEngine (Release OR Debug)

Release

conan install . --build=missing --update
# optional for a specific version: conan install . curaengine/<version>@<user>/<channel> --build=missing --update

Skip these next two lines when on Windows, if you want to work in Visual Studio (as opposed to from the command line):

cmake --preset release
cmake --build --preset release

Debug

conan install . --build=missing --update -s build_type=Debug -o curaengine:enable_testing=True

Skip these next two lines when on Windows, if you want to work in Visual Studio (as opposed to from the command line):

cmake --preset debug
cmake --build --preset debug

Visual Studio

For working within Visual Studio, on Windows: Perform the debug and/or release steps as above, skipping the appropriate steps. Then, open the CuraEngine folder in VisualStudio. Select 'Build All' from the build menu (possibly after selecting whether you want to build the debug or release configuration, in the interface).

4. Activate Conan Run Environment

# For Linux/MacOS
source build/generators/conanrun.sh
# For Windows (Powershell)
.\build\generators\conanrun.sh

5. Connecting to Cura

If you run cura_app.py with the option --external-backend, Cura will wait for an external backend when hitting the slice button.

You can slice using your development environment by running the following command.

./build/Debug/CuraEngine connect 127.0.0.1:49674
OR
./build/Release/CuraEngine connect 127.0.0.1:49674

If a slice fails you will need to increment the port number the next time you run this command.

Troubleshooting

Some error messages and their potential causes:

  • [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) – this error has been encountered when trying to build a version prior to 5.2. Try again on version 5.2 or later.
  • Make Error: Could not read presets from : Unrecognized "version" field – Make sure that you're using CMake 3.23 or later (the version bundled with Ubuntu 22.04 is not new enough).
  • Errors contacting jfrog.artifactory.com or similar – make sure you've run conan remote remove cura.

Running CuraEngine

From Cura

You can run CuraEngine using a frontend, such as Cura. You can find intructions for this on the Cura wiki.

From Command Line

To run CuraEngine from the command line you need a settings JSON file, which can be found in the Ultimaker/Cura repository.

Run CuraEngine help for a general description of how to use the CuraEngine tool.