charmedlabs / pixy2

Other
131 stars 98 forks source link

Discussion: Move to CMake? #12

Open robobenklein opened 5 years ago

robobenklein commented 5 years ago

My Robotics team (UTK IEEE) decided to buy a Pixy 2 to do colored object recognition for this year's SoutheastCon challenge, and we've found it somewhat difficult to integrate this library into other projects.

We're working with a large C++ codebase in which we extensively use CMake for inter-repo dependencies and to improve platform interoperability.

We hacked together a fork just so that we could use the libpixyusb2 sources, but it's very much a hack. If there's interest, we'd like to contribute some work back to upstream to perhaps reorganize the source code here to make it easier to include and use.

Would changes moving almost all of the source code be welcome? It'd probably restructure all of the current directory layout to make it clearer how the dependency tree works out, and to provide better organization for including specific sub-libraries via CMake usage.

Forked (hackish) version: https://gitlab.com/utk-robotics/forks/pixy2

richlegrand commented 5 years ago

Hi Ben, Libpixyusb2 uses the code from the Arduino to keep the API's the same -- I'm guessing this is part of what makes it difficult to integrate. yes?

Please briefly describe your problems and modifications.

thanks!

robobenklein commented 5 years ago

Yeah, the CMake setup would involve a lot of cross-dependencies, but that would make it easier to use in the future.

For example, we use most libraries as git submodules, and just do add_subdirectory in CMake to add targets. Using this repo's build script didn't really integrate with our build system, having problems ensuring all the required include directories were in the path and available where needed, and the different procedures for different systems made it difficult to write reusable build code.

For proper CMake usage I'd create a central CMake that includes all the sub-projects and allows users to specify which libraries they want build or made available to their software.

richlegrand commented 5 years ago

Hi Ben, libpixyusb2 uses libusb, and cmake would help with that. We used cmake for the previous libpixyusb and only had good things to say as developers. We got away from it because it added some hurdles for newer developers, for example "how do I take this cmake'd thing and use it in my program?"

There are some competing goals for us when it comes to making things simple. "simple" depends on the audience.