From 0c4ff16192ed892ab49ac24123aa741697c066d3 Mon Sep 17 00:00:00 2001 From: Darby Johnston Date: Mon, 27 Oct 2025 10:48:17 -0700 Subject: [PATCH 1/2] Fixes for the C++ exports Signed-off-by: Darby Johnston --- CMakeLists.txt | 7 +++++++ src/opentime/CMakeLists.txt | 2 +- src/opentime/export.h | 4 ++++ src/opentimelineio/CMakeLists.txt | 2 +- 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e5aae5a11..69a7b4da1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -36,6 +36,13 @@ option(OTIO_FIND_RAPIDJSON "Find RapidJSON using find_package" OFF) set(OTIO_PYTHON_INSTALL_DIR "" CACHE STRING "Python installation dir (such as the site-packages dir)") # Build options +# +# If you are building OpenTimelineIO as a static library you will need to +# defined OPENTIME_STATIC and OTIO_STATIC. If you use the provided CMake +# config files these will be automatically defined for you. To use the +# provided config files add `find_package(OpenTimelineIO)` to your +# CMakeLists.txt file. +# option(OTIO_SHARED_LIBS "Build shared if ON, static if OFF" ON) option(OTIO_CXX_COVERAGE "Invoke code coverage if lcov/gcov is available" OFF) option(OTIO_CXX_EXAMPLES "Build CXX examples (also requires OTIO_PYTHON_INSTALL=ON)" OFF) diff --git a/src/opentime/CMakeLists.txt b/src/opentime/CMakeLists.txt index a274ef10e..9133e4e88 100644 --- a/src/opentime/CMakeLists.txt +++ b/src/opentime/CMakeLists.txt @@ -28,7 +28,7 @@ set_target_properties(opentime PROPERTIES LIBRARY_OUTPUT_NAME "opentime" POSITION_INDEPENDENT_CODE TRUE) -if(BUILD_SHARED_LIBS) +if(OTIO_SHARED_LIBS) set_target_properties(opentime PROPERTIES SOVERSION ${OTIO_SOVERSION} VERSION ${OTIO_VERSION}) diff --git a/src/opentime/export.h b/src/opentime/export.h index a55cbb380..8ac96afd2 100644 --- a/src/opentime/export.h +++ b/src/opentime/export.h @@ -11,11 +11,13 @@ # define OPENTIMELINIO_IMPORT __attribute__((dllimport)) # define OPENTIMELINIO_HIDDEN # define OPENTIMELINIO_EXPORT_TYPE +# define OPENTIMELINIO_IMPORT_TYPE # else # define OPENTIMELINIO_EXPORT __declspec(dllexport) # define OPENTIMELINIO_IMPORT __declspec(dllimport) # define OPENTIMELINIO_HIDDEN # define OPENTIMELINIO_EXPORT_TYPE +# define OPENTIMELINIO_IMPORT_TYPE # endif #elif defined(__GNUC__) && __GNUC__ >= 4 || defined(__clang__) # define OPENTIMELINIO_EXPORT __attribute__((visibility("default"))) @@ -26,11 +28,13 @@ # else # define OPENTIMELINIO_EXPORT_TYPE __attribute__((visibility("default"))) # endif +# define OPENTIMELINIO_IMPORT_TYPE #else # define OPENTIMELINIO_EXPORT # define OPENTIMELINIO_IMPORT # define OPENTIMELINIO_HIDDEN # define OPENTIMELINIO_EXPORT_TYPE +# define OPENTIMELINIO_IMPORT_TYPE #endif #define OPENTIMELINIO_EXPORT_TEMPLATE(type, ...) #define OPENTIMELINIO_IMPORT_TEMPLATE(type, ...) \ diff --git a/src/opentimelineio/CMakeLists.txt b/src/opentimelineio/CMakeLists.txt index 7c6255616..2ca319b9f 100644 --- a/src/opentimelineio/CMakeLists.txt +++ b/src/opentimelineio/CMakeLists.txt @@ -103,7 +103,7 @@ set_target_properties(opentimelineio PROPERTIES LIBRARY_OUTPUT_NAME "opentimelineio" POSITION_INDEPENDENT_CODE TRUE) -if(BUILD_SHARED_LIBS) +if(OTIO_SHARED_LIBS) set_target_properties(opentimelineio PROPERTIES SOVERSION ${OTIO_SOVERSION} VERSION ${OTIO_VERSION}) From c34086a14125a8ca5be61e58bac955bc2a9e7d5a Mon Sep 17 00:00:00 2001 From: Darby Johnston Date: Mon, 27 Oct 2025 11:13:14 -0700 Subject: [PATCH 2/2] Fix typo Signed-off-by: Darby Johnston --- src/opentime/export.h | 66 ++++++++++++++++++------------------- src/opentimelineio/export.h | 18 +++++----- 2 files changed, 42 insertions(+), 42 deletions(-) diff --git a/src/opentime/export.h b/src/opentime/export.h index 8ac96afd2..5e05031b3 100644 --- a/src/opentime/export.h +++ b/src/opentime/export.h @@ -7,38 +7,38 @@ // https://github.com/PixarAnimationStudios/OpenUSD/blob/dev/pxr/base/arch/export.h #if defined(_WINDOWS) # if defined(__GNUC__) && __GNUC__ >= 4 || defined(__clang__) -# define OPENTIMELINIO_EXPORT __attribute__((dllexport)) -# define OPENTIMELINIO_IMPORT __attribute__((dllimport)) -# define OPENTIMELINIO_HIDDEN -# define OPENTIMELINIO_EXPORT_TYPE -# define OPENTIMELINIO_IMPORT_TYPE +# define OPENTIMELINEIO_EXPORT __attribute__((dllexport)) +# define OPENTIMELINEIO_IMPORT __attribute__((dllimport)) +# define OPENTIMELINEIO_HIDDEN +# define OPENTIMELINEIO_EXPORT_TYPE +# define OPENTIMELINEIO_IMPORT_TYPE # else -# define OPENTIMELINIO_EXPORT __declspec(dllexport) -# define OPENTIMELINIO_IMPORT __declspec(dllimport) -# define OPENTIMELINIO_HIDDEN -# define OPENTIMELINIO_EXPORT_TYPE -# define OPENTIMELINIO_IMPORT_TYPE +# define OPENTIMELINEIO_EXPORT __declspec(dllexport) +# define OPENTIMELINEIO_IMPORT __declspec(dllimport) +# define OPENTIMELINEIO_HIDDEN +# define OPENTIMELINEIO_EXPORT_TYPE +# define OPENTIMELINEIO_IMPORT_TYPE # endif #elif defined(__GNUC__) && __GNUC__ >= 4 || defined(__clang__) -# define OPENTIMELINIO_EXPORT __attribute__((visibility("default"))) -# define OPENTIMELINIO_IMPORT -# define OPENTIMELINIO_HIDDEN __attribute__((visibility("hidden"))) +# define OPENTIMELINEIO_EXPORT __attribute__((visibility("default"))) +# define OPENTIMELINEIO_IMPORT +# define OPENTIMELINEIO_HIDDEN __attribute__((visibility("hidden"))) # if defined(__clang__) -# define OPENTIMELINIO_EXPORT_TYPE __attribute__((type_visibility("default"))) +# define OPENTIMELINEIO_EXPORT_TYPE __attribute__((type_visibility("default"))) # else -# define OPENTIMELINIO_EXPORT_TYPE __attribute__((visibility("default"))) +# define OPENTIMELINEIO_EXPORT_TYPE __attribute__((visibility("default"))) # endif -# define OPENTIMELINIO_IMPORT_TYPE +# define OPENTIMELINEIO_IMPORT_TYPE #else -# define OPENTIMELINIO_EXPORT -# define OPENTIMELINIO_IMPORT -# define OPENTIMELINIO_HIDDEN -# define OPENTIMELINIO_EXPORT_TYPE -# define OPENTIMELINIO_IMPORT_TYPE +# define OPENTIMELINEIO_EXPORT +# define OPENTIMELINEIO_IMPORT +# define OPENTIMELINEIO_HIDDEN +# define OPENTIMELINEIO_EXPORT_TYPE +# define OPENTIMELINEIO_IMPORT_TYPE #endif -#define OPENTIMELINIO_EXPORT_TEMPLATE(type, ...) -#define OPENTIMELINIO_IMPORT_TEMPLATE(type, ...) \ - extern template type OPENTIMELINIO_IMPORT __VA_ARGS__ +#define OPENTIMELINEIO_EXPORT_TEMPLATE(type, ...) +#define OPENTIMELINEIO_IMPORT_TEMPLATE(type, ...) \ + extern template type OPENTIMELINEIO_IMPORT __VA_ARGS__ #if defined(OPENTIME_STATIC) # define OPENTIME_API @@ -48,19 +48,19 @@ # define OPENTIME_LOCAL #else # if defined(OPENTIME_EXPORTS) -# define OPENTIME_API OPENTIMELINIO_EXPORT -# define OPENTIME_API_TYPE OPENTIMELINIO_EXPORT_TYPE +# define OPENTIME_API OPENTIMELINEIO_EXPORT +# define OPENTIME_API_TYPE OPENTIMELINEIO_EXPORT_TYPE # define OPENTIME_API_TEMPLATE_CLASS(...) \ - OPENTIMELINIO_EXPORT_TEMPLATE(class, __VA_ARGS__) + OPENTIMELINEIO_EXPORT_TEMPLATE(class, __VA_ARGS__) # define OPENTIME_API_TEMPLATE_STRUCT(...) \ - OPENTIMELINIO_EXPORT_TEMPLATE(struct, __VA_ARGS__) + OPENTIMELINEIO_EXPORT_TEMPLATE(struct, __VA_ARGS__) # else -# define OPENTIME_API OPENTIMELINIO_IMPORT -# define OPENTIME_API_TYPE OPENTIMELINIO_IMPORT_TYPE +# define OPENTIME_API OPENTIMELINEIO_IMPORT +# define OPENTIME_API_TYPE OPENTIMELINEIO_IMPORT_TYPE # define OPENTIME_API_TEMPLATE_CLASS(...) \ - OPENTIMELINIO_IMPORT_TEMPLATE(class, __VA_ARGS__) + OPENTIMELINEIO_IMPORT_TEMPLATE(class, __VA_ARGS__) # define OPENTIME_API_TEMPLATE_STRUCT(...) \ - OPENTIMELINIO_IMPORT_TEMPLATE(struct, __VA_ARGS__) + OPENTIMELINEIO_IMPORT_TEMPLATE(struct, __VA_ARGS__) # endif -# define OPENTIME_LOCAL OPENTIMELINIO_HIDDEN +# define OPENTIME_LOCAL OPENTIMELINEIO_HIDDEN #endif diff --git a/src/opentimelineio/export.h b/src/opentimelineio/export.h index d2671d829..256bc5215 100644 --- a/src/opentimelineio/export.h +++ b/src/opentimelineio/export.h @@ -13,19 +13,19 @@ # define OTIO_LOCAL #else # if defined(OTIO_EXPORTS) -# define OTIO_API OPENTIMELINIO_EXPORT -# define OTIO_API_TYPE OPENTIMELINIO_EXPORT_TYPE +# define OTIO_API OPENTIMELINEIO_EXPORT +# define OTIO_API_TYPE OPENTIMELINEIO_EXPORT_TYPE # define OTIO_API_TEMPLATE_CLASS(...) \ - OPENTIMELINIO_EXPORT_TEMPLATE(class, __VA_ARGS__) + OPENTIMELINEIO_EXPORT_TEMPLATE(class, __VA_ARGS__) # define OTIO_API_TEMPLATE_STRUCT(...) \ - OPENTIMELINIO_EXPORT_TEMPLATE(struct, __VA_ARGS__) + OPENTIMELINEIO_EXPORT_TEMPLATE(struct, __VA_ARGS__) # else -# define OTIO_API OPENTIMELINIO_IMPORT -# define OTIO_API_TYPE OPENTIMELINIO_IMPORT_TYPE +# define OTIO_API OPENTIMELINEIO_IMPORT +# define OTIO_API_TYPE OPENTIMELINEIO_IMPORT_TYPE # define OTIO_API_TEMPLATE_CLASS(...) \ - OPENTIMELINIO_IMPORT_TEMPLATE(class, __VA_ARGS__) + OPENTIMELINEIO_IMPORT_TEMPLATE(class, __VA_ARGS__) # define OTIO_API_TEMPLATE_STRUCT(...) \ - OPENTIMELINIO_IMPORT_TEMPLATE(struct, __VA_ARGS__) + OPENTIMELINEIO_IMPORT_TEMPLATE(struct, __VA_ARGS__) # endif -# define OTIO_LOCAL OPENTIMELINIO_HIDDEN +# define OTIO_LOCAL OPENTIMELINEIO_HIDDEN #endif