-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Use fmt library in compiled (non-header-only) mode #4692
Conversation
Thanks for submitting this pull request! The maintainers of this repository would appreciate if you could update the CHANGELOG.md based on your changes. |
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.
This PR introduces another 3rdparty library configuration and build step which (slightly) increases the Open3D build time. Given that fmt
is available as header-only I think there has to be a good reason to prefer building it. Is there no alternative to avoiding the windows.h
dependency?
Reviewed 4 of 8 files at r1, 5 of 5 files at r2, all commit messages.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @yxlao)
cpp/open3d/core/SizeVector.cpp, line 29 at r2 (raw file):
#include "open3d/core/SizeVector.h" #include <algorithm>
why did this become necessary?
cpp/open3d/core/Tensor.h, line 29 at r2 (raw file):
#pragma once #include <algorithm>
See previous comment.
cpp/open3d/utility/Logging.cpp, line 31 at r2 (raw file):
#include <fmt/core.h> #include <fmt/printf.h> #include <fmt/ranges.h>
Aren't these redundant? They are included in Logging.h
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.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @errissa)
cpp/open3d/core/SizeVector.cpp, line 29 at r2 (raw file):
During debugging, when I removed all fmt
headers, the compiler complains about missing the <algorithm>
header here.
<algorithm>
is brought in by the fmt
headers. If Logging.h
does not use fmt
headers at all, we will need to include <algorithm>
here.
I was following this documentation: https://google.github.io/styleguide/cppguide.html#Include_What_You_Use:
Do not rely on transitive inclusions. This allows people to remove no-longer-needed #include statements from their headers without breaking clients. This also applies to related headers - foo.cc should include bar.h if it uses a symbol from it even if foo.h includes bar.h.
cpp/open3d/core/Tensor.h, line 29 at r2 (raw file):
Previously, errissa (Rene) wrote…
See previous comment.
Same as above.
cpp/open3d/utility/Logging.cpp, line 31 at r2 (raw file):
Same as above.
In https://google.github.io/styleguide/cppguide.html#Include_What_You_Use :
This also applies to related headers - foo.cc should include bar.h if it uses a symbol from it even if foo.h includes bar.h.
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.
Reviewed 1 of 1 files at r3, all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @yxlao)
To anyone who met this issue again: |
Current issue
Currently,
master
branch fails to build on on Windows 11 + CUDA 11.x with the latestcub
:This is the same issue as described https://github.com/ptheywood/cub-1.15-windows.h-demo
Solution
The main idea is to avoid
winows.h
being introduced to files as much as possible. Currently,windows.h
is introduced byfmt
, whenfmt
is used as header-only mode. If we usefmt
in compiled mode, it will not propagate thewindows.h
header.References:
windows.h
: https://stackoverflow.com/a/67993640/1255535Notes
Currently, we still require #4691. In #4691, the
windows.h
is directly used inFileSystem.cpp
. To avoidwindows.h
inFileSystem.cpp
, we'll need to upgrade to C++17 and std::filesystem, which is future work.This change is