Added support for Conan as a dependency manager#122
Closed
jellespijker wants to merge 12 commits intomasterfrom
Closed
Added support for Conan as a dependency manager#122jellespijker wants to merge 12 commits intomasterfrom
jellespijker wants to merge 12 commits intomasterfrom
Conversation
- Added conanfile.py with a build recipe - Modernize common CMake options - Declare SIP::SIP alias target in FindSIP.cmake - Upgrade CMake in build-deb-mingw64.sh otherwise it will fail to include stdlib.h: No such file or directory #include_next <stdlib.h> - mingw64 uses Protobuf 3.9.2
You can now set the following extra options (default is OFF) - ENABLE_CPPCHECK "Enable static analysis with cppcheck" - ENABLE_CLANG_TIDY "Enable static analysis with clang-tidy" - ENABLE_INCLUDE_WHAT_YOU_USE "Enable static analysis with include-what-you-use" - ENABLE_COVERAGE "Enable coverage reporting for gcc/clang" - ENABLE_SANITIZER_ADDRESS "Enable address sanitizer" - ENABLE_SANITIZER_LEAK "Enable leak sanitizer" - ENABLE_SANITIZER_UNDEFINED_BEHAVIOR "Enable undefined behavior sanitizer" - ENABLE_SANITIZER_THREAD "Enable thread sanitizer" - ENABLE_SANITIZER_MEMORY "Enable memory sanitizer" Disallow in-souce builds and added messages
Strongly discouraged but some automated systems use this method. This can be enabled by setting ALLOW_IN_SOURCE_BUILD ON
When building libSavitar as a shared DLL library on Windows it throws a lot of: unresolved external symbol __declspec(dllimport) as a workaround I now build it statically on that platform.
I really dislike including out-of-source stuff
This was referenced Aug 8, 2021
b559648 to
e0adc44
Compare
2 tasks
typo. Case sensative
This reverts commit 2f4ab00.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR is part of the following PRs:
The purpose of these changes is to set up a dependency manager for Cura and here 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. Making installing Cura from source as simple as:For 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 server that can be used by Ultimaker employees. Other developers can test this by cloning the above-mentioned repositories and performing a
conan export . ultimaker/testingin each root. That only leaves the SIP package, if you execute aconan export . riverbankingcomputing/testingin this folder https://github.com/jellespijker/conan-um/tree/main/recipes/sip it creates a Conan package for SIP 4.19.25You 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:b cura_release.jinja -pr:h 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.This PR should also (partial) fix a lot of SIP issues which I'm seeing in this repository.
I currently fail to create DLL libraries on windows, although the export-header is generated correctly and included. It still throws a lot of:
unresolved external symbol __declspec(dllimport)as a workaround I now build it statically on that platform. Maybe @konskarm or @rburema can take a closer look. To be honest I don't think we actually need to export the DLL on Windows but I'm far from a Windows exp(o/e)rt ;-)I decided to harmonize our CMakeLists.txt because often they were inconsistent, for instance how we set the
fPICorMD/MDdandMT/MTdflags. Often I had to changes these methods in one repo, while it already worked in another repo. Getting stuff to work on three different OSs in three different languages is a bit time-consuming, to say the least. These uniform methods of preparing CMake instructions can be found incmake/StandardProjectSettings.cmake. These are tried and tested methods that we already use in our Spatial plugin and are used by Json Turner in this https://github.com/lefticus/cpp_starter_project and are based on the best practices described here: https://github.com/lefticus/cppbestpracticesThe changes in CMake basically boil down to:
the build servers.
threading libraries installed.
Conan copies the source and builds from there.
-DPython_version=3.9now it will link to 3.8by default.
the system.
_CuraEngineand the relevant tests.SpatialBackend these are probably still a bit incomplete at the moment. But if we update them after each comment
during a review, it will get more and more helpful.
The above-mentioned CMake changes should keep the build interface the same for existing environments (only add extra options) Now you guys might get a bit discouraged when you see all of those warnings scroll up when building CuraEngine. We can opt to disable it. But I personally am strongly in favor of keeping these visible as a motivation to clean up our codebase each time we're working in a certain section.
Still, WIP at the moment, since I'm finalizing some last changes across all repos.