Skip to content
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

Merged
merged 3 commits into from
Nov 20, 2019
Merged

Conversation

skeptic-monkey
Copy link
Contributor

@skeptic-monkey skeptic-monkey commented Nov 4, 2019

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.

@googlebot
Copy link
Collaborator

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 @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

@skeptic-monkey
Copy link
Contributor Author

@googlebot I signed it!

@googlebot
Copy link
Collaborator

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.

@googlebot googlebot added cla: yes and removed cla: no labels Nov 4, 2019
@sergiud sergiud requested a review from drigz November 4, 2019 11:33
Copy link
Member

@drigz drigz left a 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"]),
Copy link
Member

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)",
Copy link
Member

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.

@drigz
Copy link
Member

drigz commented Nov 9, 2019

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 config.h issue myself.

@skeptic-monkey
Copy link
Contributor Author

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

@drigz drigz merged commit 925858d into google:master Nov 20, 2019
@drigz
Copy link
Member

drigz commented Nov 20, 2019

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!

@shahms
Copy link

shahms commented Oct 27, 2020

FWIW, this breaks clients that use features = ["layering_check"] because the public glog library no longer exports any headers directly.

@sergiud sergiud added this to the 0.5 milestone Mar 30, 2021
@sergiud sergiud mentioned this pull request May 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bazel support for windows
5 participants