OSVR/OSVR-Android-Build

Allow specifying the Boost version to use for the host binaries

Opened this issue · 4 comments

janoc commented

Right now the Boost is autodetected by the host subprojects (osvr_json_to_c). Unfortunately, if that version is not suitable (e.g. built for different compiler version, lacking static/dynamic libraries, etc), it is difficult to point CMake to the correct version, because the usual BOOST_ROOT environment variable is not taken into account and the top level defines -DBOOST_ROOT and -DBOOST_LIBRARYDIR are not passed to the subproject.

An acceptable solution for this corner case would be documenting that it is possible to edit the CMakeLists.txt file for the osvr_json_to_c project and put the following before the find_package(Boost ...) statement

set(BOOST_ROOT "path to Boost")
set(BOOST_LIBRARYDIR "path to the libraries")

It is a kludge, but it will save a lot of headscratching for people having multiple versions of Boost installed.

Would it make sense to pass any BOOST_ROOT and BOOST_LIBRARYDIR defined for the superproject to the host-platform projects?

janoc commented

I think there needs to be two sets of those variables - one for host projects and one for Android as they will likely use different Boost versions installed in different places.

I'm struggling to build this project on Visual Studio 2015 because of these variables. What Boost version am I suposed to have on my Windows machine? Should I use BOOST_ROOT or BOOST_LIBRARYDIR? I asked for help on Gitter but didn't get much attention there.

janoc commented

@aalmada Careful, this is an Android build. You need to have Crystax NDK which includes Android version of Boost, the variables are not taken into account there. You haven't said which part of your build failed, so I am only guessing you mean the Windows part.

The variables described above are used to build the host-only tools like the json descriptor pre-compiler. BOOST_ROOT specifies where did you install Boost and BOOST_LIBRARYDIR specifies where are the Boost libraries - that is usually a different folder if you are using a precompiled Boost in Windows. So yes, you should most likely set both.

BTW, Visual Studio 2015 will not compile OSVR yet, there are some template issues, so don't be surprised if things fail.

And finally, this is not really a support forum, but a bug tracker - please use the Gitter chat for support questions, otherwise it makes hard to keep track of genuine bugs.