-
Notifications
You must be signed in to change notification settings - Fork 27
Miscellaneous google header insulation #346
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
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,89 @@ | ||
| #pragma once | ||
|
|
||
| #cmakedefine VIAMCPPSDK_GRPCXX_LEGACY_FWD | ||
|
|
||
| // Forward declaration file grpc client and server types. | ||
| // This file provides includes for recent (>= 1.32.0) versions of grpc or older | ||
| // versions, depending on if `VIAMCPPSDK_GRPCXX_LEGACY_FWD` is defined. | ||
| // The default behavior is for the variable to be undefined, providing the behavior for recent | ||
| // versions. If you are experiencing compilation errors in an installed version of the SDK it may be | ||
| // due to a mismatch with the configured version of this header and the grpc version found by the | ||
| // compiler. You may wish to comment/uncomment the define above as needed, or add the definition | ||
| // with `-D` to the compiler. | ||
| #ifndef VIAMCPPSDK_GRPCXX_LEGACY_FWD | ||
|
|
||
| namespace grpc { | ||
|
|
||
| class Channel; | ||
|
|
||
| class ClientContext; | ||
|
|
||
| template <typename> | ||
| class ClientReaderInterface; | ||
|
|
||
| class Server; | ||
|
|
||
| class ServerBuilder; | ||
|
|
||
| class ServerCredentials; | ||
|
|
||
| } // namespace grpc | ||
|
|
||
| namespace viam { | ||
| namespace sdk { | ||
|
|
||
| using GrpcChannel = ::grpc::Channel; | ||
|
|
||
| using GrpcClientContext = ::grpc::ClientContext; | ||
|
|
||
| template <typename T> | ||
| using GrpcClientReaderInterface = ::grpc::ClientReaderInterface<T>; | ||
|
|
||
| using GrpcServer = ::grpc::Server; | ||
|
|
||
| using GrpcServerBuilder = ::grpc::ServerBuilder; | ||
|
|
||
| using GrpcServerCredentials = ::grpc::ServerCredentials; | ||
|
|
||
| } // namespace sdk | ||
| } // namespace viam | ||
|
|
||
| #else | ||
|
|
||
| namespace grpc_impl { | ||
|
|
||
| class Channel; | ||
|
|
||
| class ClientContext; | ||
|
|
||
| template <typename> | ||
| class ClientReaderInterface; | ||
|
|
||
| class Server; | ||
|
|
||
| class ServerBuilder; | ||
|
|
||
| class ServerCredentials; | ||
|
|
||
| } // namespace grpc_impl | ||
|
|
||
| namespace viam { | ||
| namespace sdk { | ||
|
|
||
| using GrpcChannel = ::grpc_impl::Channel; | ||
|
|
||
| using GrpcClientContext = ::grpc_impl::ClientContext; | ||
|
|
||
| template <typename T> | ||
| using GrpcClientReaderInterface = ::grpc_impl::ClientReaderInterface<T>; | ||
|
|
||
| using GrpcServer = ::grpc_impl::Server; | ||
|
|
||
| using GrpcServerBuilder = ::grpc_impl::ServerBuilder; | ||
|
|
||
| using GrpcServerCredentials = ::grpc_impl::ServerCredentials; | ||
|
|
||
| } // namespace sdk | ||
| } // namespace viam | ||
|
|
||
| #endif | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
(q) just to confirm, is this a standard practice we'd expect people to be comfortable with/know how to do? Specifically, the idea (and syntax) of defining the variable for the compiler, and also the fact that we don't care how it's defined just so long as it is defined? I think the latter is probably pretty clear, but for the former I'd definitely be running to the internet to get more advice on how to proceed. That could just be my ignorance though!
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 so yes! This is CMake's version of Make/autoconf-generated
config.htype headers, where a bunch of stuff will be#define'd or commented out.The default case which I tried to expand on here is that we expect the variable to not be defined, because that corresponds to some pretty ancient grpc versions.
The other thing I tried to expand on was that this is a configured file which will then be installed with
make install, so it's possible but a little weird that the user configures it with one version of grpc, doesmake install, and then later wants to use that installed version with a different grpc version, in which case they can manipulate the macro definitions with commetning/uncommenting or-Dto make it work