-
Notifications
You must be signed in to change notification settings - Fork 286
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
Reorganize glut (preparation for glfw) #1088
Conversation
Codecov Report
@@ Coverage Diff @@
## release-6.6 #1088 +/- ##
============================================
Coverage 56.59% 56.59%
============================================
Files 320 320
Lines 24524 24524
============================================
Hits 13879 13879
Misses 10645 10645 |
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.
I'll be pushing a few changes to this branch, if that's okay. Explanations are provided by inline comments.
dart/gui/GlutWindow.hpp
Outdated
|
||
#include "dart/gui/LoadOpengl.hpp" | ||
#include "dart/gui/RenderInterface.hpp" | ||
#warning "This file is deprecated in DART 6.6. "\ |
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.
It seems this method for warning is not portable.
We might want to add a DART_PREPROCESSOR_WARNING(X)
macro to dart/common/Deprecated.hpp
in order to have a cross-platform method for this.
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.
After some more thought, a preprocessor directive can't replaced with a macro because of the limitations of the preprocessor.
However, it seems recent versions of GCC and Clang can understand #pragma message
, so we can use that instead.
dart/gui/GraphWindow.hpp
Outdated
#include <Eigen/Dense> | ||
|
||
#include "dart/gui/Win2D.hpp" | ||
#include "dart/gui/glut/GraphWindow.hpp" | ||
|
||
namespace dart { | ||
namespace gui { | ||
|
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.
We might want to add a DART_PREPROCESSOR_WARNING(X)
to this header.
dart/gui/glut/GlutWindow.hpp
Outdated
namespace glut { | ||
|
||
/// \brief | ||
class Window { |
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.
Since the class name has changed to dart::gui::glut::Window
, we should consider changing the filename to dart/gui/glut/Window.hpp
instead of ../GlutWindow.hpp
.
@mxgrey Thanks for the changes! Merging now. Edit: This PR will go into 6.7 because I don't think the rest of changes for GUI won't be completed until 6.6 release. |
@@ -62,6 +78,25 @@ add_subdirectory(osg) | |||
|
|||
# Generate header for this namespace | |||
dart_get_filename_components(header_names "gui headers" ${hdrs}) | |||
|
|||
# Remove deprecated files from the list | |||
list(REMOVE_ITEM header_names |
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.
I stumbled across a potential issue with this. I think it's inadvertently breaking the API. If a user is depending on #include <dart/gui/gui.hpp>
to get these headers, then their code will no longer compile.
We might want to consider allowing these to remain in the master header, even if it shoots compiler messages at people who are using the master gui
header.
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.
I think it's inadvertently breaking the API.
This is a valid point.
We might want to consider allowing these to remain in the master header, even if it shoots compiler messages at people who are using the master
gui
header.
I have a concern that the user will always see the warning messages by just including the master gui
header. I can think of two possible solutions to this:
-
Remove header warnings completely
Easiest solution. The deprecated header will be removed in the next major release. The downside of this method is obviously that the user won't get a prior notice the header will be removed even when the header is included explicitly (not by the master header). -
Suppress header warning when it's included by a master header
This would require some work for us. We could use a processor of whether the deprecated header is included by the master header, and suppress the warning if so. One caveat of this is that it's possible to unintentionally suppress the warning if a deprecated header is firstly included by the master header and then included explicitly. This is because the second header inclusion would be just ignored by the header guard. One workaround would be putting the warning out side of the header guard, but this would pollute the output window too much.
Maybe there is a much cleaner way, which I cannot think of now. Let me know.
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.
I had exactly the same thoughts, plus one additional thought (which might not be the nicest):
- If people are comfortable with using a "master" header, then they're probably not interested in best practices and wouldn't be particularly bothered by the compiler message. The master headers are provided for beginner convenience, but I don't think we should be encouraging their use in the first place. Although I suspect some of our examples and/or tutorials are probably using the master headers, so we'd need to do some work on our end to change that if we simply allow the compiler messages to print out.
I'd be fine with any of these three solutions.
This PR reorganizes glut. This is a preparation for having glfw, which will eventually replace glut since glut is deprecated.
This PR shouldn't hurt any existing code except it will generate warnings if glut is included by old files.
glfw support will be followed soon.
Before creating a pull request
clang-format
Before merging a pull request
CHANGELOG.md