-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Running Cura from Source
Note: We're currently still in the process of updating our workflow how to run Cura from source. Although most of the workflow has been determined already, there are bound to be some changes along the way. If you run into any issues, please feel free to to open an issue on our Cura repository.
Note: Most notable changes compared to the previous workflow is the deprecation of
cura-build
andcura-build-environment
.
Cura consists of a Python module in this repository and multiple other dependencies (C++, C++ Python bindings, Python modules) either owned by Ultimaker or third-parties. Ultimaker owned repositories which are party of Cura will be build or exported with a GitHub Action on a certain repository events, such as a push to a branch. These exported packages and/or binaries can then be used by other repositories when required. This workflow greatly reduces complexity, maintenance and build time. The figure below shows the sequence diagram for an individual repository.
C++ and C++ Python binding dependencies are now managed by Conan, while the Python modules are managed by Pip. Conan is the orchestrator for the complete installation and setting up the development environment. All dependencies are build, stored and used in such away that interaction and 'pollution' of the global system should be non-existing. Installing dependencies for Cura and initializing a Virtual Python environment should be as simple as executing a single command in the end.
For the above workflow to actually work, the following system requirements must first be met.
_Make sure that the binaries for the system dependencies can be found on the PATH
- Windows 10 or higher
- Visual Studio with MSVC 2019 or higher
- Python 3.6 or higher
- venv
- CMake 3.20 or higher
- Ninja 1.10 or higher
- Conan 1.48 or higher
Executing from the Powershell is preferred.
- macOS 10.15 or higher
- xcode 11.4 or higher
- apple-clang-9.0 or higher
- Python 3.6 or higher
- venv
- CMake 3.20 or higher
- Ninja 1.10 or higher
- Conan 1.48 or higher
- Ubuntu/Debian/Arch/Manjaro (glibc 2.28 or higher)
- gcc-9 or higher
- Python 3.6 or higher
- venv
- CMake 3.20 or higher
- Ninja 1.10 or higher
- Conan 1.48 or higher
- autoreconf
pip install conan --upgrade
conan config install https://github.com/ultimaker/conan-config.git
conan profile new default --detect --force
Community developers would have to remove the Conan cura
repository because that one requires credentials.
conan remote remove cura
Note: The way we handle versions will probably change in the future. For now it has to be explicitly set.
Install the dependencies for the development environment and initialize a Virtual Python environment. Execute the following command in the root directory of the Cura repository.
conan install . cura/5.1.0-beta@ultimaker/stable --build=missing --update -o cura:devtools=True -g VirtualPythonEnv
FIXME: remove the cura/5.1.0-beta@ultimaker/stable once merged to main
if you have PyCharm as an IDE you can append the last command with -g PyCharmRunEnv
this will create a run/debug configuration for PyCharm.
Activate the virtual environment by executing the following command in the root directory of the Cura repository.
# For Linux/MacOS
source venv/bin/activate
# For Windows (Powershell)
.\venv\Scripts\activate.ps1
Then execute the following command to start Cura.
python cura_app.py
Note: This is a work in progress and largely untested at the moment.
When you're working on Cura it could be needed to work on other repositories such as Uranium and/or CuraEngine in parallel. Conan allows you to put a package into editable mode Instead of pointing to a Conan package in the local Conan cache it will point to the working directory of the other repository.
You can find out which version of a package is used by Cura by examining the conandata.yml
file in the root directory of the Cura
repository. The specific data, including the version of a requirment is stored per version key, e.q.: cura/5.1.0-beta+1234
will use
curaengine/latest@ultimaker/stable
Make sure Cura and her dependencies are cloned locally and are located in the same workspace directory.
workspace_root
|
└─ Cura
└─ CuraEngine
└─ Uranium
└─ libSavitar
└─ libArcus
└─ libNest2D
└─ pynest2d
You can put a dependency, such as CuraEngine into editable mode by executing the following command in the root directory of the CuraEngine
conan editable add . curaengine/latest@ultimaker/stable
If you then perform a new conan install
command as usual (See: Initializing a Virtual Python Development Environment (All OSes)) the correct
paths should be set for the CuraEngine dependency, and you should be able to develop for Cura and CuraEngine simultaneously.
Since the above described methods isn't fully tested yet you can also set things up the 'old fashion method'. Keep in mind that the following steps are workarounds and intended as a temporary solution. At least until we have implemented to full cross dependency development method. as described above.
Make sure Cura and CuraEngine are both cloned locally and are located in the same directory.
workspace_root | └─ Cura └─ CuraEngine
Set up the development environment by executing the following command in the root directory of the Cura repository.
conan install . --build=missing --update -o cura:devtools=True -g VirtualPythonEnv
Do the same for CuraEngine, by executing the following command in the root directory of the CuraEngine repository.
conan install . --build=missing --update
If you want to run CuraEngine in debug mode you can append the last command with
-s build_type=Debug
, this will create the debug configuration for CuraEngine.The CMake configuration and the binaries will be build in
cmake-build-release
orcmake-build-debug
you can build CuraEngine by executing the following command in the build directory of the CuraEngine repository.cmake --toolchain=conan/conan_toolchain.cmake ..and build it with
cmake --build .
If you start up Cura (make sure you have activated the Virtual Python Environment) with the following command.
# For Linux/MacOS source venv/bin/activate python cura_app.py --external-backend# For Windows (Powershell) .\venv\Scripts\activate.ps1 python cura_app.py --external-backendYou can try to slice a model. While Cura waits till CuraEngine connects to the process. Run CuraEngine (from the CuraEngine build folder) with the following command or from the IDE. Make sure you add the
connect 127.0.0.1:49674
as an argument to the run/debug configuration# For Linux/MacOS ./CuraEngine connect 127.0.0.1:49674
# For Windows (Powershell) .\CuraEngine\CuraEngine.exe connect 127.0.0.1:49674Make sure Cura and Uranium are both cloned locally and are located in the same directory.
workspace_root | └─ Cura └─ Uranium
Set up the development environment by executing the following command in the root directory of the Cura repository.
conan install . --build=missing --update -o cura:devtools=True -g VirtualPythonEnv
Do the same for Uranium, by executing the following command in the root directory of the Uranium repository.
conan install . --build=missing --update
Because the previous
conan install
command for also installed Uranium in thesite-packages
folder of the Cura virtual environment. You will first have to remove that. Do so by activating the virtual Python environment in Cura and executing the following command.# For Linux/MacOS source venv/bin/activate pip uninstall Uranium# For Windows (Powershell) source venv/bin/activate pip uninstall UraniumYou can now start Cura with the Uranium (from source) dependency by prepending the root of Uranium to the PYTHONPATH environment variable.
# For Linux/MacOS export PYTHONPATH=<path_to_root_of_uranium>:$PYTHONPATH python cura_app.py# For Windows (Powershell) $Env:PYTHONPATH=<path_to_root_of_uranium>;$Env:PYTHONPATH python cura_app.py
- Welcome
- Getting Started
- Reporting An Issue
- Core Development
- Plugins & Material Packages
- Printers
- Translations
- Best Practices
- Settings
- 3D Scene
- Profiling
- Cura User Files
- GitHub Actions