Skip to content

Conversation

darbyjohnston
Copy link
Contributor

@darbyjohnston darbyjohnston commented Oct 8, 2025

Fixes #1919

This is a replacement for PR #1920

These changes are based on the recommendations from @meshula for exporting symbols without using the CMake GenerateExportHeader functionality.

This PR is a WIP, I've just done the minimum amount of exporting to try out the process. With these changes my test app works OK, without them I get this exception as mentioned in the issue:

libc++abi: terminating due to uncaught exception of type std::bad_any_cast: bad any cast

To do / questions:

  • Should the export.h file be shared by the opentime and opentimelineio libraries, or should each library get it's own export.h file? (EDIT: I added a separate export.h file for opentime and opetimelineio, with some shared functionality in the opentime export.h)
  • The AnyDictionary class exposes some symbols with the using keyword; can these be exported or do they need to be replaced with function wrappers? (EDIT: It looks like this is not necessary since everything is inline)
  • For the opentimelineio defines I used OTIO_API for brevity (instead of OPENTIMELINEIO_API)

My test app for reference:

#include <opentimelineio/marker.h>
#include <opentimelineio/timeline.h>

int main(int argc, char** argv)
{
    OTIO_NS::SerializableObject::Retainer<OTIO_NS::Timeline> timeline(new OTIO_NS::Timeline);
    OTIO_NS::SerializableObject::Retainer<OTIO_NS::Track> track(new OTIO_NS::Track);
    timeline->tracks()->append_child(track);
    OTIO_NS::SerializableObject::Retainer<OTIO_NS::Marker> marker(new OTIO_NS::Marker);
    OTIO_NS::AnyDictionary md;
    md["type"] = static_cast<int64_t>(23);
    marker->metadata()["kdenlive"] = md;
    track->markers().push_back(marker);
    if (!timeline->to_json_file("test.otio"))
    {
        return 1;
    }
    return 0;
}

The CMake file:

cmake_minimum_required(VERSION 3.3)
project(test)

set(CMAKE_CXX_STANDARD 17)

find_package(OpenTimelineIO REQUIRED)

set(CMAKE_CXX_VISIBILITY_PRESET hidden)

add_executable(test test.cpp)
target_link_libraries(test OTIO::opentimelineio)

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

codecov-commenter commented Oct 8, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.00%. Comparing base (c0e97b0) to head (cd7fb4d).
⚠️ Report is 73 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    #1953      +/-   ##
==========================================
+ Coverage   84.11%   85.00%   +0.88%     
==========================================
  Files         198      181      -17     
  Lines       22241    13074    -9167     
  Branches     4687     1206    -3481     
==========================================
- Hits        18709    11113    -7596     
+ Misses       2610     1778     -832     
+ Partials      922      183     -739     
Flag Coverage Δ
py-unittests 85.00% <ø> (+0.88%) ⬆️

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.36% <ø> (-0.74%) ⬇️
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 115 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 207d69f...cd7fb4d. Read the comment docs.

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

Signed-off-by: Darby Johnston <[email protected]>
Signed-off-by: Darby Johnston <[email protected]>
@darbyjohnston darbyjohnston requested a review from meshula October 8, 2025 23:51
Signed-off-by: Darby Johnston <[email protected]>
Signed-off-by: Darby Johnston <[email protected]>
@darbyjohnston darbyjohnston added maintenance General cleanup and good code hygiene and removed time calculations labels Oct 9, 2025
@darbyjohnston darbyjohnston marked this pull request as ready for review October 9, 2025 00:56
@darbyjohnston darbyjohnston mentioned this pull request Oct 9, 2025
@jminor jminor added this to the Public Beta 18 milestone Oct 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance General cleanup and good code hygiene opentime
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Exception when using CMAKE_CXX_VISIBILITY_PRESET=hidden
3 participants