Closed svenevs closed 7 years ago
I think using it as a third-party project instead of a child project would be easier.
You can refer to https://github.com/OpenKinect/libfreenect2/wiki/Test-Plan#build-tests for the intended usage of this as a third-party library.
The report is very good. But the issue will be closed at this time.
Hey @xlz sorry for dropping off (again). I've been involved in a lot of unexpected int{ra,er}national travel. I'm just going to maintain a fork for my purposes, but the core issues here are
libfreenect2's use of glfw
demands that anybody using a project that also links against glfw
use the exact same version.
glfw
internally, but this will affect anybody who ends up with different glfw
versions in the mix.libfreenect2 is not ABI compatible (there are some stl containers in method signatures e.g. std::string
).
clang
and libc++abi
without compiling a separate libfreenect2.These were the primary incentives for enabling compilation as a sub-project. The above diff will fix them, I added the CMAKE_*_OUTPUT_DIRECTORY
stuff for selfish obsessive reasons of liking to be able to control where build artifacts end up.
I had briefly talked about some libusb stuff, I don't have the time or understanding to investigate the appropriate changes. The libusb stuff for libfreenect2 is generally more complicated than most other projects (totally justified btw!), so users who want to use libfreenect2 as a sub-project can simply utilize the libfreenect2 setup.
In the end, you can make the reasonable assumption that anybody trying to build libfreenect2 as a sub-project knows what they are doing. I am of course happy to add some documentation explaining exactly what to do if this stuff is merged upstream, but even in those docs I'd include an admonition explaining that it is not suggested. Most people don't really worry about ABI compatibility (myself included), because in general a given user has a preferred compiler they use. In my project I have explicit benchmarking needs for various compilers, and I got sick of changing my ~/.bash_profile
:wink:
The goal: enable some flexibility when building
libfreenect2
by a parent project.There are two requested features I have implemented, and 3 is along the same line of thought
Only set the
CMAKE_*_OUTPUT_DIRECTORY
variables if they are not set yet.Protonect
show up next to the parent executables so I can coach users to try runningProtonect
to determine if it is my application or something went wrong withlibfreenect2
/etc/udev/rules.d
and disconnect / reconnectEnable the parent project to specify the location of
glfw3
.glfw3
, so I can either a) disable OpenGL forlibfreenect2
b) fail at link time because I end up with links to two separateglfw3
Since LibUSB gets kind of muddy in terms of the "right" solution (almost every project has a similar but slightly different solution), allow the parent project to specify the libusb include dirs and libraries.
libfreenect2
by doing things dubiously unworthy of describingFor 1 and 2, this is the diff:
I'm not entirely sure if this is the best approach, but it lets me in my parent project do
The assumption being that if somebody came through and hard-marked
GLFW_FOUND
, they also setGLFW3_INCLUDE_DIRS
andGLFW3_LIBRARIES
correctly.Particularly where
glfw3
is concerned, even if the parent project does not build its ownglfw3
, but instead usesfind_package
you can still potentially get conflicting versions sincelibfreenect2
is building gettings its deps withpkg-config
. But this seems too unlikely to worry about -- anybody who runs into this scenario knows enough about configurations that they could solve it with environment variables...What are your thoughts? Would you like a PR with solutions to 1-3? A subset? If you are willing to incorporate these things in the build system but want a different mechanism, what would you like?
Thanks!