Skip to content

Conversation

@owent
Copy link
Member

@owent owent commented Oct 25, 2025

Fixes #3665

Changes

  • Set dllexport_decl for proto targets and can be built as shared on windows.

For significant contributions please make sure you have completed the following items:

  • CHANGELOG.md updated for non-trivial changes
  • Unit tests have been added
  • Changes in public API reviewed

Copilot AI review requested due to automatic review settings October 25, 2025 02:45
@owent owent requested a review from a team as a code owner October 25, 2025 02:45
Copy link

Copilot AI left a 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_decl parameter 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

Comment on lines 344 to 347
if(CMAKE_SYSTEM_NAME MATCHES "Windows|MinGW|WindowsStore")
set_target_properties(opentelemetry_proto_grpc
PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON)
endif()
Copy link

Copilot AI Oct 25, 2025

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.

Copilot uses AI. Check for mistakes.
Comment on lines +247 to +250
elseif(SunPro)
set(${OUTPUT_VARNAME}
"__global"
PARENT_SCOPE)
Copy link

Copilot AI Oct 25, 2025

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.

Copilot uses AI. Check for mistakes.
""
PARENT_SCOPE)
endif()
elseif(SunPro)
Copy link

Copilot AI Oct 25, 2025

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.

Suggested change
elseif(SunPro)
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "SunPro")

Copilot uses AI. Check for mistakes.
@codecov
Copy link

codecov bot commented Oct 25, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.95%. Comparing base (70daba9) to head (c45538c).

Additional details and impacted files

Impacted file tree graph

@@            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     

see 48 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Opentelemetry windows runtime issue

1 participant