-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Add windows support for bazel build #488
Conversation
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed (or fixed any issues), please reply here with What to do if you already signed the CLAIndividual signers
Corporate signers
ℹ️ Googlers: Go here for more info. |
@googlebot I signed it! |
CLAs look good, thanks! ℹ️ Googlers: Go here for more info. |
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.
Thank you!
I noticed that the pregenerated config.h
hardcodes GOOGLE_NAMESPACE=google. Could you add a comment to the top of glog.bzl
saying Known issue: the namespace parameter is not supported on Win32.
?
|
||
native.cc_library( | ||
name = "windows_glog_headers", | ||
hdrs = ["src/glog/log_severity.h", "src/windows/config.h",] + native.glob(["src/windows/glog/*.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.
This will leak config.h into the include path, which may break targets that depend on glog and contain #include "config.h"
. Can you apply the pattern from bazelbuild/bazel#4463 to calculate the path of src/windows/
, and add "-I" + src_windows
to windows_only_copts
?
defines = [ | ||
"GOOGLE_GLOG_IS_A_DLL=1", | ||
"GOOGLE_GLOG_DLL_DECL=__declspec(dllexport)", | ||
"GOOGLE_GLOG_DLL_DECL_FOR_UNITTEST=__declspec(dllimport)", |
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 these necessary in defines
? If so, are they all necessary or can some be in copts
?
It looks to me like the public headers have an #ifndef GOOGLE_GLOG_DLL_DECL
section that should make them unnecessary, but perhaps I'm missing something.
Hi @skeptic-monkey, will you have bandwidth to take a look at the review comments? If not, just let me know, as this is a valuable change as-is, so I'd be happy to merge it and take a look at the |
I'll be able to have a look this weekend. From what I've seen after checking quickly, It's not that straightforward. Anyway. I'll check and if I don't see an easy solution I'll let you know |
You were right, it wasn't straightforward :) But I managed to find a workaround, so I took the liberty of merging this and creating a PR for the cleanups. Thanks for the contribution! |
FWIW, this breaks clients that use |
Attempt to fix #472
linux/darwnin builds are not strictly equivalent to windows build. But it seem to already be that case without bazel, as we use pre-generated glog headers, that have hardcoded namespace for example.
Also, it doesn't support static linkage, but again, that seemed to already be hardcoded that way for windows when using pre-generated headers.
Windows support is far from perfect but it is at a least a step forward.