-
Couldn't load subscription status.
- Fork 501
[DRAFT] Support build proto as shared lib on Windows #3714
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
base: main
Are you sure you want to change the base?
Conversation
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.
Pull Request Overview
This PR enables building Protocol Buffer (protobuf) targets as shared libraries on Windows by implementing proper DLL export/import declarations. Previously, protobuf targets were forced to be static libraries on Windows, but this change adds the necessary infrastructure to support shared library builds across platforms.
Key changes:
- Added CMake helper functions for managing export/import declarations across different compilers and platforms
- Modified protobuf generation to include
dllexport_declparameter for proper Windows DLL support - Removed Windows-specific restriction forcing static library builds for protobuf targets
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| cmake/tools.cmake | Adds utility functions for generating platform and compiler-specific DLL export/import declarations |
| cmake/opentelemetry-proto.cmake | Integrates DLL declarations into protobuf targets, removes Windows static-only restriction, and adds formatting improvements |
| if(CMAKE_SYSTEM_NAME MATCHES "Windows|MinGW|WindowsStore") | ||
| set_target_properties(opentelemetry_proto_grpc | ||
| PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON) | ||
| endif() |
Copilot
AI
Oct 25, 2025
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.
The use of WINDOWS_EXPORT_ALL_SYMBOLS for the gRPC target differs from the explicit export declaration approach used for the base proto target. This inconsistency may cause confusion. Consider documenting why gRPC requires automatic symbol export while the base target uses manual declarations via OPENTELEMETRY_PROTO_API.
| elseif(SunPro) | ||
| set(${OUTPUT_VARNAME} | ||
| "__global" | ||
| PARENT_SCOPE) |
Copilot
AI
Oct 25, 2025
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.
The SunPro compiler check uses an undefined variable SunPro instead of checking CMAKE_CXX_COMPILER_ID. This condition will never be true. Change to elseif(CMAKE_CXX_COMPILER_ID STREQUAL \"SunPro\") to properly detect the SunPro compiler.
cmake/tools.cmake
Outdated
| "" | ||
| PARENT_SCOPE) | ||
| endif() | ||
| elseif(SunPro) |
Copilot
AI
Oct 25, 2025
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.
The SunPro compiler check uses an undefined variable SunPro instead of checking CMAKE_CXX_COMPILER_ID. This condition will never be true. Change to elseif(CMAKE_CXX_COMPILER_ID STREQUAL \"SunPro\") to properly detect the SunPro compiler.
| elseif(SunPro) | |
| elseif(CMAKE_CXX_COMPILER_ID STREQUAL "SunPro") |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3714 +/- ##
==========================================
+ Coverage 89.90% 89.95% +0.06%
==========================================
Files 225 225
Lines 7281 7103 -178
==========================================
- Hits 6545 6389 -156
+ Misses 736 714 -22 🚀 New features to boost your workflow:
|
Fixes #3665
Changes
dllexport_declfor proto targets and can be built as shared on windows.For significant contributions please make sure you have completed the following items:
CHANGELOG.mdupdated for non-trivial changes