Added support for Conan as a dependency manager#10535
Added support for Conan as a dependency manager#10535jellespijker wants to merge 28 commits intomasterfrom
Conversation
- conanfile.py added containing enough information to set
up a source environment.
- Two helper Classes added
- CuraVirtualRunEnv is an extension on the VirtualRunEnv
class and is self consuming. The Environment variables
set in the Layout are added to the `conanrunenv.sh/bat`
- PyCharmRunEnv is an extension on the VirtualRunEnv which
creates multiple `<run_config_name>.run.xml` These can
be used by PyCharm. In these files all environment
variables are set. You can use different jinja templates
for future use.
By creating a `CuraVersion.py` in the cura folder with the
following content you can use `conan install ...` to
switch between Enterprise and staging.
```python
import os
CuraAppDisplayName = os.getenv("CURA_APP_DISPLAY_NAME", "Cura")
CuraVersion = os.getenv("CURA_VERSION", "master")
CuraBuildType = os.getenv("CURA_BUILD_TYPE", "")
CuraDebugMode = True
CuraCloudAPIRoot = os.getenv("CURA_CLOUD_API_ROOT", "https://api.ultimaker.com")
CuraCloudAccountAPIRoot = os.getenv("CURA_CLOUD_ACCOUNT_API_ROOT", "https://account.ultimaker.com")
CuraDigitalFactoryURL = os.getenv("CURA_DIGITAL_FACTORY_URL", "https://digitalfactory.ultimaker.com")
```
Although Uranium isn't compiled it's dependency Arcus is.
The icon existed only in the UM3NetworkPrinting plugin but it was also used in the ConfigurationItem.qml in Cura, so it had to be moved to the Cura icons. CURA-8520
The `play` icon is readded to the theme and remapped to the `Play.svg`. Found by @fieldOfView. CURA-8520
Also remove the capitalization from the `viewMode`. CURA-8520
This will make it easier in the future if we deprecate icons again. And it's nice for now. Contributes to issue CURA-8520.
# Conflicts: # resources/qml/WelcomePages/CloudContent.qml # resources/themes/cura-light/icons/deprecated_icons.json
# Conflicts: # CMakeLists.txt
The translate wasn't done via an operation, so it wouldn't go back to the same state after an undo / redo Fixes #10648
|
Hi, requiring Conan to build doesn't work very well for distros so none of them have updated to Cura 5 yet. Would it be possible to re-arrange the Conan files and CMake scripts so that Conan is optional, and we can still manage dependencies by hand? (Or alternatively - would you merge pull requests that do this?) I had a play with libArcus before the pyArcus split and it didn't seem to require too many changes. Thanks, |
|
@MatthewGentoo I have an open ticket related to this, #12941. It has a partial solution that allows building with preinstalled deps, but I haven't tested it with Arcus because I build without Arcus. It should be easy to adapt though. I'd welcome input from distro folks on how to transform my hack into something Cura upstream might be able to accept. |
|
Hi @MatthewGentoo, TLDR; For the direct future I don't see us switching strategy. Ultimaker can't spare the resources to set up and maintain multiple build methods, with the current budget and teams size. Us switching to Conan and going all in on both Conan and JFrog Artifactory stems from the fact that it is a huge cost reduction (saving a yearly salary of 1fte developer) on our build servers alone. We also have reproducable builds now. This goes for all our supported OSes Windows, Linux and Mac. No longer a dependency hell, but downgraded to a dependency purgatory. But a bigger advancement is the fact that the whole process isn't one big overly complex sequential build script anymore. It is now setup in small(er) single responsibility modulair scripts, were each of our own dependencies is responsible for its own output. By deciding to go all in on Conan, we could simplify our CMakeLists.txt a lot. This ensures that more people in the team can work on build related tickets instead of 1 or 2 senior devs. You mentioned that Cura 5.x aren't distributed with the system package manager anymore. I can understand why. I worked on the switch to PyQt6 for Cura 5.0, we first tried to implement that in our "old" setup. It nearly gave me PTSD. Getting it up and running on good old Linux (or even Windows) was relatively easy, but setting it up for that #&€@&& Apple device was a huge undertaking (this statement doesn't reflect the company view and is purely personal 😉) The only way to finally get it to work was to partially switch to Conan, which ensured that all compiler, linker flags, pre process definitions, rpaths handling, the whole shebang, was taken care of in a uniform way. All of the above mentioned reasons are great but this switch also has a downside, apart from some so called teething problems and that is that we messed up workflows for all of you wonderful Linux package maintainers. For that I'm sorry. Although we won't switch our build proces to allow Conan as an optional build method ourself, we will look seriously into any PR that would help us both out. Provided that the maintenance and complexity for such a system is relatively low, and it works on all three OSes withe the same toolchains we are currently using on our GitHub runners. On a personal note I want to say that I believe Conan will be adopted by more and more projects. It has the potential to become an industry accepted "standard" such as CMake. I'm tagging our new community manager @MariMakes so she is aware of you guys needs and wants as well. |
I don't think anyone is asking you to setup and maintain another build method. What folks are asking for is just a way to bypass the Conan dependency fetching and building, and instead be able to build with these libraries already available in the search path the compiler toolchain on its own, or as instructed by CMake, is searching. If you see the patch I used in the linked issue, this is not any big ask. It's basically just doing |
|
@richfelker I understand that and we'll look into any PR that would facilitate that request without creating an extra burden on our resources. |
This PR is part of the following PRs:
The purpose of these changes is to set up a dependency manager for Cura and her repositories. Cura uses both third-party and Ultimaker maintained dependencies, written in both Python and C++ (or mixtures of both). Not all of these dependencies can be downloaded with the help of a dependency manager such as pip. This makes setting up Cura from source, a pain in the$%^#$ $%^. See the graph below for the current dependencies. Adding to the complexity is the way how we're currently consuming third-party dependencies; Some have to be present on the system/provided by the user, some are shipped within the repo, while others are downloaded by CMake.
All of the above-mentioned PRs and this one, add a
conanfile.pyto the root of this project. This is a recipe written in Python which instructs Conan (https://docs.conan.io/en/latest/) how to build and package the repository in such a way that it can be reused by other dependencies. If a required dependency has no binary for your OS and compiler it will build that dependency from scratch and store it in the cache.Installing Conan
Installing Conan clean
Reinstalling Conan
If you have already played with Conan it is good to clean it up and make sure you have the right profiles installed
Installing Cura
git clone https://github.com/ultimaker/Cura.git git checkout conan conan install . -pr cura_release.jinja -if venv --build=missingFor a more detailed description see the README.md in this repository https://github.com/jellespijker/conan-um
For testing purposes, I have set up a small home artifactory server that can be used by Ultimaker employees. The url for this server was automatically added in the
conan config install ...step. The artifactory server contains a recipe for SIP and PythonYou can use your own profiles for this, but I have personally tested and developed them with my own
jinjatemplate profiles on Linux Manjaro with a GCC compiler, Mac OS Big Sur with a Clang compiler and Windows 11 with a Visual Studio 2019 compiler.These profiles can be installed with the
conan config install https://github.com/jellespijker/conan-config. Make sure you add-pr cura_release.jinjato your install instructionsConan allows for multiple ways of working. Either the exiting package can be used from the cache, or if you want to work on multiple repositories you can put that repo in editable mode such that the xxx-config.cmake in the project that is depending on the other, will point to the paths of your repo, see https://docs.conan.io/en/latest/developing_packages/editable_packages.html
Because the best practice method to use Conan, which is also the preferred way in Conan 2.0, is to use ( https://docs.conan.io/en/latest/reference/conanfile/tools/cmake.html ) With the tools
CMakeDeps,CMakeToolchain, andCMake. TheCMakeDepsclass will generate xxx-config.cmake files per dependency, while theCMakeToolchainwill generate a toolchain to be passed to CMake-DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmakeThese two prepare the way forCMaketo actually build the project such that it won't need to change the CMakeLists.txt. Allowing Conan to be optional and not mandatory. Unfortunately, our repositories have organically grown CMakeLists.txt mixing old and modern syntax and a build system that uses CMake 3.13.Todo:
scm_to_conandatato the conan configuration repoStill, WIP at the moment, since I'm finalizing some last changes across all repos