Skip to content
This repository has been archived by the owner on Dec 8, 2021. It is now read-only.

Improve compiler and flag detection in bazel builds #294

Closed
devjgm opened this issue Aug 2, 2019 · 0 comments · Fixed by #298
Closed

Improve compiler and flag detection in bazel builds #294

devjgm opened this issue Aug 2, 2019 · 0 comments · Fixed by #298
Labels
api: spanner Issues related to the googleapis/google-cloud-cpp-spanner API. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.

Comments

@devjgm
Copy link
Contributor

devjgm commented Aug 2, 2019

In #278 @remyabel suggested the following:

If we're going to support multiple compilers, the script will probably grow larger as we detect the executable and use the appropriate switch/flags. Just spitballing, but what do you think about adopting an approach similar to this? TL;DR, compile a program in Bazel that uses compiler-specific version macros then spits out the information.

@coryan liked this idea, saying

I am starting to like @remyabel's approach, though we are repeating work that CMake does, we are doomed to repeat it to support Bazel.
And if we are detecting the compiler make and model in C++ then I suggest we change as much as we can from build_info.cc.in into a .cc and do the detection once in a lambda. Can be done if a future PR.

@devjgm devjgm added the type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. label Aug 2, 2019
coryan pushed a commit that referenced this issue Aug 4, 2019
* feat: Use macros to determine compiler version.

Fixes #294 and closes #281

The logic for determining the compiler ID and version are lifted from the CMake
v3.5 sources (the minimum we support). Only GCC, Clang and MSVC are supported
but it is trivial to support more. This breaks the logic out into a separate
file, although it is possible I misunderstood the requirements and I'm happy to
correct it.

cc: @devjgm

* Address review comments.

* Address review comments.

* Fix typo.

* Fix another typo.

* Address review comment.
@google-cloud-label-sync google-cloud-label-sync bot added the api: spanner Issues related to the googleapis/google-cloud-cpp-spanner API. label Jan 31, 2020
devjgm pushed a commit to devjgm/google-cloud-cpp that referenced this issue May 7, 2020
…oud-cpp-spanner#298)

* feat: Use macros to determine compiler version.

Fixes googleapis/google-cloud-cpp-spanner#294 and closes googleapis/google-cloud-cpp-spanner#281

The logic for determining the compiler ID and version are lifted from the CMake
v3.5 sources (the minimum we support). Only GCC, Clang and MSVC are supported
but it is trivial to support more. This breaks the logic out into a separate
file, although it is possible I misunderstood the requirements and I'm happy to
correct it.

cc: @devjgm

* Address review comments.

* Address review comments.

* Fix typo.

* Fix another typo.

* Address review comment.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
api: spanner Issues related to the googleapis/google-cloud-cpp-spanner API. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant