-
Notifications
You must be signed in to change notification settings - Fork 287
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Protect dart-gui-osg and check more rigorously for the presence of OSG #898
Conversation
dart/gui/osg/CMakeLists.txt
Outdated
@@ -8,11 +8,10 @@ if(DART_BUILD_GUI_OSG) | |||
|
|||
find_package(OpenSceneGraph 3.0 QUIET | |||
COMPONENTS osg osgViewer osgManipulator osgGA osgDB) | |||
if(OPENSCENEGRAPH_FOUND) | |||
if(OPENSCENEGRAPH_FOUND AND OSG_FOUND) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are both of these variables set to true when OSG is found? It seems OPENSCENEGRAPH_FOUND
is defined only when FindOpenSceneGraph.cmake
is used, while OSG_FOUND
is defined only when FindOSG.cmake
is used. Shouldn't this to be OPENSCENEGRAPH_FOUND OR OSG_FOUND
? Also, if FindOSG.cmake
is used, it looks like we need to use OSG_LIBRARY
instead of OPENSCENEGRAPH_LIBRARIES
. Am I missing something here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, you already mentioned about this in the post. Sorry, wasn't paying sufficient attention. 😓 I think it would be much great if we add a simple comment why we check both of them.
I only noticed the
|
Codecov Report
@@ Coverage Diff @@
## master #898 +/- ##
=========================================
+ Coverage 50.63% 50.7% +0.07%
=========================================
Files 299 299
Lines 23411 23476 +65
Branches 3016 3030 +14
=========================================
+ Hits 11854 11904 +50
- Misses 10226 10241 +15
Partials 1331 1331
|
This PR has two related (but independent) purposes:
Prevent
dart-gui-osg
from being built when OSG is not detected.This is done by wrapping the second half ofThis is done by returning immediately if OpenSceneGraph cmake variables cannot be found. This was not needed in the past because the call todart/gui/osg/CMakeLists.txt
in an if-block.add_subdirectory(osg)
used to be wrapped in an if-statement.More rigorously check whether OSG exists. In the process of fixing this, I discovered that the version of
FindOpenSceneGraph.cmake
that is provided withcmake-3.5
will setOPENSCENEGRAPH_FOUND
to true if it finds libopenthreads, even if libopenscenegraph isn't actually installed. I believe this is a bug on the part of either CMake or OpenSceneGraph, because this behavior contradicts the variable's description provided byFindOpenSceneGraph.cmake
, but I found a workaround by checking bothOPENSCENEGRAPH_FOUND
andOSG_FOUND
. The latter seems to correctly return false when OpenSceneGraph is not available.Note that the vast majority of the diff is due to white space from indenting the content inside the if-statement.