Skip to content
This repository has been archived by the owner on Aug 27, 2022. It is now read-only.

Initial attempt to set up build process to be usable through conan #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

rob-baily
Copy link

Hello! This will be similar to OpenBluetoothToolbox/SimpleDBus#24 which I opened for SimpleDBus. have done an initial attempt at making this library usable with a conan build and packaging. My goals were to change as little as possible in the build process so that it could continue to be built as is if desired.

In order to build via conan I am generally using docker images. In this case I used images conanio/gcc8-armv7hf and conanio/gcc10 to test. If you create a docker image using these and have access to the source you can run a command like this to build the library and create the conan package. I use VS Code which has some good support for running your code inside docker images.

conan create . simplebluez/0.4.1@ -s compiler.libcxx=libstdc++11 -o shared=False -o simpledbus:shared=False

The version number is arbitrary based on whatever version you are packaging but I chose the next version for this example. You will also notice a couple things different from the other request:

  • I did not use the "build=missing" argument here since it was run where the dependencies had already been set up. If that arg was used it could be run on a fresh setup.
  • The version for simpledbus is listed as 2.1.1 as that is the version I used to build the other library.
  • You will see here that I specified the non-shared version of the simpledbus library to be used. It currently won't work when using the shared version because other things in the build specifically link to simpledbus-static. If a true separation is done then the build should be able to use whichever version the user decides to use for their build. See the first note below as more explanation.

A few notes on general setup with Conan and what I did:

  • In the existing build both the static and shared library versions are built at once. Conan generally uses this as a setting so that users of a package pick by option used rather than by specifying the library type in the build. For this I have not changed the compilation but only the packaging so that only the appropriate library goes based on the option used (like False in the example above). Ideally in the longer term the compilation would be set up to only build one with the library type defined by the option.
  • I changed the build for conan so that the examples are always included. For now I also included them in the package so that they can be used by a "conan deploy" operation. This lets people try out the example executables without having to build if they have the appropriate setup.
  • I did not do anything with tests. Conan has the ability to include this but it looked like a bit much for now.

I changed the includes for the fmt library to include format.h instead of core.h. I believe this is the correct method and when I tried to use it without the examples were not linking because the library was including references to fmt symbols that were not already compiled in.

Please check it out and let me know if you have any questions or problems with it. Conan is a great system and it will allow you to really get dependencies set up correctly if you use the versioning as it was intended so that a version of something clearly knows what the versions of the dependencies are. Also if you use a repository to keep the packages you can keep the binaries around for frequently used items so they don't need to be rebuilt every time.

@kdewald
Copy link
Member

kdewald commented May 24, 2022

Hey @rob-baily thanks for the submission!

I'm a bit swamped right now with some work stuff, but I promise I'll get to this as soon as I can.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants