Skip to content

Export C++ symbols #1920

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

darbyjohnston
Copy link
Contributor

Fixes #1919

This change uses the CMake GenerateExportHeader functionality to explicitly export C++ symbols. In addition to fixing #1919, this can also potentially make the use of OTIO shared libraries more efficient.

Signed-off-by: Darby Johnston <[email protected]>
@codecov-commenter
Copy link

codecov-commenter commented Aug 14, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 84.86%. Comparing base (c0e97b0) to head (5ed86fe).
⚠️ Report is 63 commits behind head on main.

❌ Your changes status has failed because you have indirect coverage changes. Learn more about Unexpected Coverage Changes and reasons for indirect coverage changes.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1920      +/-   ##
==========================================
+ Coverage   84.11%   84.86%   +0.74%     
==========================================
  Files         198      181      -17     
  Lines       22241    13054    -9187     
  Branches     4687     1206    -3481     
==========================================
- Hits        18709    11078    -7631     
+ Misses       2610     1790     -820     
+ Partials      922      186     -736     
Flag Coverage Δ
py-unittests 84.86% <ø> (+0.74%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/opentime/errorStatus.h 100.00% <ø> (ø)
src/opentime/rationalTime.h 95.83% <ø> (+1.15%) ⬆️
src/opentime/timeRange.h 98.30% <ø> (-0.79%) ⬇️
src/opentime/timeTransform.h 100.00% <ø> (+8.33%) ⬆️
src/opentimelineio/anyDictionary.h 96.92% <ø> (+5.39%) ⬆️
src/opentimelineio/anyVector.h 91.42% <ø> (+7.55%) ⬆️
src/opentimelineio/color.h 41.66% <ø> (ø)
src/opentimelineio/composable.h 100.00% <ø> (ø)
src/opentimelineio/composition.h 83.87% <ø> (+18.35%) ⬆️
src/opentimelineio/effect.h 83.33% <ø> (-16.67%) ⬇️
... and 16 more

... and 114 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 639f57c...5ed86fe. Read the comment docs.

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

@jlskuz
Copy link
Contributor

jlskuz commented Aug 14, 2025

LGTM.

I wonder if [CMAKE_]CXX_VISIBILITY_PRESET should be set to hidden now so that everything that is not explicitly marked as exported will be hidden.

Copy link
Collaborator

@ssteinbach ssteinbach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple of questions! Thanks for putting this together though. Did you check to see if the DSO sizes or load times change at all after this?

Comment on lines 26 to 27
OPENTIME_EXPORT constexpr double
fabs(double val) noexcept
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to export the fabs symbol?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, @darbyjohnston I suspect this is a question for another PR, but is this still true?

#1047 (comment)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, we should probably remove it from the public API entirely. @meshula thought it was a worthwhile optimization, and when we upgrade to C++ 23 we can replace it with the std library version.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed - @meshula let us know if you think it should stay in this public header and be exported

@darbyjohnston
Copy link
Contributor Author

Did you check to see if the DSO sizes or load times change at all after this?

I checked and the sizes were the same, but I exported all of the symbols so I didn't expect any difference. Hopefully it's a feature we can take more advantage of in the future, for example the C++ OTIOZ PR has some code that might not need to be part of the public API.

darbyjohnston and others added 2 commits August 15, 2025 10:21
Co-authored-by: Stephan Steinbach <[email protected]>
Signed-off-by: Darby Johnston <[email protected]>
Signed-off-by: Darby Johnston <[email protected]>
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.

Exception when using CMAKE_CXX_VISIBILITY_PRESET=hidden
4 participants