symforce-org / symforce

Fast symbolic computation, code generation, and nonlinear optimization for robotics
https://symforce.org
Apache License 2.0
1.41k stars 145 forks source link

c++ working standalone example #209

Open gftabor opened 2 years ago

gftabor commented 2 years ago

Is your feature request related to a problem? Please describe. Trying to link against this project in C++ (to use the optimizer) doesn't seem well supported.

Here you discuss how to build from source and add the built packages as a python library, and nothing about make installing it as a C++ library.

Then in the examples cmake you assume the examples are being compiled alongside the library and all the environment variables are already known to cmake. https://github.com/symforce-org/symforce/blob/main/symforce/examples/CMakeLists.txt#L15

Describe the solution you'd like A recommended way to install the project after building from source. (presumably sudo make install) This should provide FindSymForce.cmake etc for each separate module that might be needed by cmake. Seems like it would be

Here you talk about splitting the c++ examples into separate cmakes, which would be nice but more importantly a standalone example (maybe its own repo) of compiling an example from source using an installed symforce. (Using standard find_package(symforce REQUIRED) in cmakelists)

aaron-skydio commented 2 years ago

You should already be able to sudo make install (or the more modern cmake equivalent sudo cmake --install . as described here). This should install the C++ components of symforce, including symforce_gen and symforce_opt as you mention. We should probably mention in the build instructions that this is supported.

Agree that we should also provide a FindSymForce.cmake, we'll put that on the TODO list. Once we do that, yeah it'd be good to have some documentation or an example of how to build a project against an installed copy of symforce. If you or someone else wants to contribute any of this it would be appreciated :)