![]() Thanks to bincrafters for packaging them all. Current Conan recipe has the following:Ī graph was generated by the conan info command: $ conan info -graph opencvĪs you can see, currently it mostly depends on image libraries, such as libjpeg, libtiff, libpng, libwepb, jasper and OpenEXR.Īll these libraries are available as Conan packages in conan-center as well. OpenCV is a very complex library and has lots of various dependencies. Given that fact, usage of generated CMake config files may result in the inability to build the project, so there is a workaround for this problem in Conan. For instance, on Windows Conan directory usually located within USERPROFILE directory, which contains user name (e.g. So, if the project itself knows which files to distribute and how to properly layout them, then it doesn’t make much sense to replicate this logic in conanfile, right? Also, CMake.install method automatically points CMAKE_INSTALL_PREFIX to the package folder.īut what is cmake.patch_config_paths() and why do we need it? Well, CMake-generated config files may contain absolute paths, which something we would like to avoid, because such paths are specific to the machine where the recipe was built, and consumers usually won’t have dependencies installed in the same paths. CMake may generate special target called INSTALL, which copies project’s header, libraries, CMake configuration files, pkg-config files, other data files, like Haar Cascades in case of OpenCV. It doesn’t have typical code to copy platform-specific files, like. Moreover, package method of our recipe is also very simple: def package ( self ): cmake = self. As a counterexample, many projects still use different build systems to compile for various platforms, like Visual Studio solutions are used on Windows, and makefiles otherwise - for such projects recipes need to have several implementations of the build method, with the handling of all options, of course. This is really nice, as we don’t have to deal with platform-specific details on how to build a project. build ()Ĭmake.build() executes build tool depending on CMake generator, it might be MSBuild, GNU Make, Ninja, etc. Once CMake configuration is done, we may build the project: def build ( self ): # intentionally skipped code to patch OpenEXR hereĬmake = self. also, installation of them requires JDK, Apache ANT, etc. ![]() BUILD_opencv_java - as we’re building packages for C++, disable Java bindings as well.BUILD_opencv_apps - skip some demonstration and utility applications supplied with OpenCV.BUILD_PERF_TEST - another set of tests to skip.BUILD_TESTS - same story, as we’re not going to run these tests, skip them from build.BUILD_DOCS - skip documentation for the same reason as examples, we usually keep only things needed to link with the package, and also build of documentation may require additional tools (such as doxygen).BUILD_EXAMPLES - do not build OpenCV examples, as they are not needed to use OpenCV, but increase build times and package sizes.Some explanation for the specific variables: definitions = FalseĬfinitions is a dictionary which is translated into command line arguments passed to the cmake, for instance, finitions = False maps into -DBUILD_EXAMPLES=OFF. Here we also disable a bunch of stuff we would like to avoid: cmake. nfigure(…) detects compiler and its features, then generates platform-specific build files. There is really nothing special, besides there are lots of options to manage, that’s why code takes so many lines. The first step is to configure CMake: def _configure_cmake ( self ): cmake = CMake ( self ) # configure various OpenCV options via finitionsĬmake. The process to build a CMake-based project is typical for many recipes, and OpenCV is not an exception here. OpenCV uses CMake, therefore our recipe uses CMake build helper. you may use the following conanfile.txt to consume OpenCV 4.0.0: Īs usual, pre-built packages are available for major platforms (Windows/Linux/MacOS) and compilers (Visual Studio/GCC/Clang). 4.x - 3.x - 2.x - with Conan should be pretty straightforward, e.g.We support all major releases, so we have the following version available on Bintray: Recently, we have finally accepted OpenCV recipe into conan-center. Given the fact OpenCV is a huge library with lots of features for various use-case, it’s a good example to demonstrate some typical package challenges (and probably few more specific as well). If you’re not familiar with OpenCV yet, check out our previous blog-post about OpenCV 4.0.0.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |