Skip to content

Commit 60171a4

Browse files
Fixes for the C++ exports (#1959)
* Fixes for the C++ exports Signed-off-by: Darby Johnston <[email protected]>
1 parent 8fe0e05 commit 60171a4

File tree

5 files changed

+51
-40
lines changed

5 files changed

+51
-40
lines changed

CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,13 @@ option(OTIO_FIND_RAPIDJSON "Find RapidJSON using find_package" OFF)
3636
set(OTIO_PYTHON_INSTALL_DIR "" CACHE STRING "Python installation dir (such as the site-packages dir)")
3737

3838
# Build options
39+
#
40+
# If you are building OpenTimelineIO as a static library you will need to
41+
# defined OPENTIME_STATIC and OTIO_STATIC. If you use the provided CMake
42+
# config files these will be automatically defined for you. To use the
43+
# provided config files add `find_package(OpenTimelineIO)` to your
44+
# CMakeLists.txt file.
45+
#
3946
option(OTIO_SHARED_LIBS "Build shared if ON, static if OFF" ON)
4047
option(OTIO_CXX_COVERAGE "Invoke code coverage if lcov/gcov is available" OFF)
4148
option(OTIO_CXX_EXAMPLES "Build CXX examples (also requires OTIO_PYTHON_INSTALL=ON)" OFF)

src/opentime/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ set_target_properties(opentime PROPERTIES
2828
LIBRARY_OUTPUT_NAME "opentime"
2929
POSITION_INDEPENDENT_CODE TRUE)
3030

31-
if(BUILD_SHARED_LIBS)
31+
if(OTIO_SHARED_LIBS)
3232
set_target_properties(opentime PROPERTIES
3333
SOVERSION ${OTIO_SOVERSION}
3434
VERSION ${OTIO_VERSION})

src/opentime/export.h

Lines changed: 33 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -7,34 +7,38 @@
77
// https://github.com/PixarAnimationStudios/OpenUSD/blob/dev/pxr/base/arch/export.h
88
#if defined(_WINDOWS)
99
# if defined(__GNUC__) && __GNUC__ >= 4 || defined(__clang__)
10-
# define OPENTIMELINIO_EXPORT __attribute__((dllexport))
11-
# define OPENTIMELINIO_IMPORT __attribute__((dllimport))
12-
# define OPENTIMELINIO_HIDDEN
13-
# define OPENTIMELINIO_EXPORT_TYPE
10+
# define OPENTIMELINEIO_EXPORT __attribute__((dllexport))
11+
# define OPENTIMELINEIO_IMPORT __attribute__((dllimport))
12+
# define OPENTIMELINEIO_HIDDEN
13+
# define OPENTIMELINEIO_EXPORT_TYPE
14+
# define OPENTIMELINEIO_IMPORT_TYPE
1415
# else
15-
# define OPENTIMELINIO_EXPORT __declspec(dllexport)
16-
# define OPENTIMELINIO_IMPORT __declspec(dllimport)
17-
# define OPENTIMELINIO_HIDDEN
18-
# define OPENTIMELINIO_EXPORT_TYPE
16+
# define OPENTIMELINEIO_EXPORT __declspec(dllexport)
17+
# define OPENTIMELINEIO_IMPORT __declspec(dllimport)
18+
# define OPENTIMELINEIO_HIDDEN
19+
# define OPENTIMELINEIO_EXPORT_TYPE
20+
# define OPENTIMELINEIO_IMPORT_TYPE
1921
# endif
2022
#elif defined(__GNUC__) && __GNUC__ >= 4 || defined(__clang__)
21-
# define OPENTIMELINIO_EXPORT __attribute__((visibility("default")))
22-
# define OPENTIMELINIO_IMPORT
23-
# define OPENTIMELINIO_HIDDEN __attribute__((visibility("hidden")))
23+
# define OPENTIMELINEIO_EXPORT __attribute__((visibility("default")))
24+
# define OPENTIMELINEIO_IMPORT
25+
# define OPENTIMELINEIO_HIDDEN __attribute__((visibility("hidden")))
2426
# if defined(__clang__)
25-
# define OPENTIMELINIO_EXPORT_TYPE __attribute__((type_visibility("default")))
27+
# define OPENTIMELINEIO_EXPORT_TYPE __attribute__((type_visibility("default")))
2628
# else
27-
# define OPENTIMELINIO_EXPORT_TYPE __attribute__((visibility("default")))
29+
# define OPENTIMELINEIO_EXPORT_TYPE __attribute__((visibility("default")))
2830
# endif
31+
# define OPENTIMELINEIO_IMPORT_TYPE
2932
#else
30-
# define OPENTIMELINIO_EXPORT
31-
# define OPENTIMELINIO_IMPORT
32-
# define OPENTIMELINIO_HIDDEN
33-
# define OPENTIMELINIO_EXPORT_TYPE
33+
# define OPENTIMELINEIO_EXPORT
34+
# define OPENTIMELINEIO_IMPORT
35+
# define OPENTIMELINEIO_HIDDEN
36+
# define OPENTIMELINEIO_EXPORT_TYPE
37+
# define OPENTIMELINEIO_IMPORT_TYPE
3438
#endif
35-
#define OPENTIMELINIO_EXPORT_TEMPLATE(type, ...)
36-
#define OPENTIMELINIO_IMPORT_TEMPLATE(type, ...) \
37-
extern template type OPENTIMELINIO_IMPORT __VA_ARGS__
39+
#define OPENTIMELINEIO_EXPORT_TEMPLATE(type, ...)
40+
#define OPENTIMELINEIO_IMPORT_TEMPLATE(type, ...) \
41+
extern template type OPENTIMELINEIO_IMPORT __VA_ARGS__
3842

3943
#if defined(OPENTIME_STATIC)
4044
# define OPENTIME_API
@@ -44,19 +48,19 @@
4448
# define OPENTIME_LOCAL
4549
#else
4650
# if defined(OPENTIME_EXPORTS)
47-
# define OPENTIME_API OPENTIMELINIO_EXPORT
48-
# define OPENTIME_API_TYPE OPENTIMELINIO_EXPORT_TYPE
51+
# define OPENTIME_API OPENTIMELINEIO_EXPORT
52+
# define OPENTIME_API_TYPE OPENTIMELINEIO_EXPORT_TYPE
4953
# define OPENTIME_API_TEMPLATE_CLASS(...) \
50-
OPENTIMELINIO_EXPORT_TEMPLATE(class, __VA_ARGS__)
54+
OPENTIMELINEIO_EXPORT_TEMPLATE(class, __VA_ARGS__)
5155
# define OPENTIME_API_TEMPLATE_STRUCT(...) \
52-
OPENTIMELINIO_EXPORT_TEMPLATE(struct, __VA_ARGS__)
56+
OPENTIMELINEIO_EXPORT_TEMPLATE(struct, __VA_ARGS__)
5357
# else
54-
# define OPENTIME_API OPENTIMELINIO_IMPORT
55-
# define OPENTIME_API_TYPE OPENTIMELINIO_IMPORT_TYPE
58+
# define OPENTIME_API OPENTIMELINEIO_IMPORT
59+
# define OPENTIME_API_TYPE OPENTIMELINEIO_IMPORT_TYPE
5660
# define OPENTIME_API_TEMPLATE_CLASS(...) \
57-
OPENTIMELINIO_IMPORT_TEMPLATE(class, __VA_ARGS__)
61+
OPENTIMELINEIO_IMPORT_TEMPLATE(class, __VA_ARGS__)
5862
# define OPENTIME_API_TEMPLATE_STRUCT(...) \
59-
OPENTIMELINIO_IMPORT_TEMPLATE(struct, __VA_ARGS__)
63+
OPENTIMELINEIO_IMPORT_TEMPLATE(struct, __VA_ARGS__)
6064
# endif
61-
# define OPENTIME_LOCAL OPENTIMELINIO_HIDDEN
65+
# define OPENTIME_LOCAL OPENTIMELINEIO_HIDDEN
6266
#endif

src/opentimelineio/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ set_target_properties(opentimelineio PROPERTIES
103103
LIBRARY_OUTPUT_NAME "opentimelineio"
104104
POSITION_INDEPENDENT_CODE TRUE)
105105

106-
if(BUILD_SHARED_LIBS)
106+
if(OTIO_SHARED_LIBS)
107107
set_target_properties(opentimelineio PROPERTIES
108108
SOVERSION ${OTIO_SOVERSION}
109109
VERSION ${OTIO_VERSION})

src/opentimelineio/export.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,19 @@
1313
# define OTIO_LOCAL
1414
#else
1515
# if defined(OTIO_EXPORTS)
16-
# define OTIO_API OPENTIMELINIO_EXPORT
17-
# define OTIO_API_TYPE OPENTIMELINIO_EXPORT_TYPE
16+
# define OTIO_API OPENTIMELINEIO_EXPORT
17+
# define OTIO_API_TYPE OPENTIMELINEIO_EXPORT_TYPE
1818
# define OTIO_API_TEMPLATE_CLASS(...) \
19-
OPENTIMELINIO_EXPORT_TEMPLATE(class, __VA_ARGS__)
19+
OPENTIMELINEIO_EXPORT_TEMPLATE(class, __VA_ARGS__)
2020
# define OTIO_API_TEMPLATE_STRUCT(...) \
21-
OPENTIMELINIO_EXPORT_TEMPLATE(struct, __VA_ARGS__)
21+
OPENTIMELINEIO_EXPORT_TEMPLATE(struct, __VA_ARGS__)
2222
# else
23-
# define OTIO_API OPENTIMELINIO_IMPORT
24-
# define OTIO_API_TYPE OPENTIMELINIO_IMPORT_TYPE
23+
# define OTIO_API OPENTIMELINEIO_IMPORT
24+
# define OTIO_API_TYPE OPENTIMELINEIO_IMPORT_TYPE
2525
# define OTIO_API_TEMPLATE_CLASS(...) \
26-
OPENTIMELINIO_IMPORT_TEMPLATE(class, __VA_ARGS__)
26+
OPENTIMELINEIO_IMPORT_TEMPLATE(class, __VA_ARGS__)
2727
# define OTIO_API_TEMPLATE_STRUCT(...) \
28-
OPENTIMELINIO_IMPORT_TEMPLATE(struct, __VA_ARGS__)
28+
OPENTIMELINEIO_IMPORT_TEMPLATE(struct, __VA_ARGS__)
2929
# endif
30-
# define OTIO_LOCAL OPENTIMELINIO_HIDDEN
30+
# define OTIO_LOCAL OPENTIMELINEIO_HIDDEN
3131
#endif

0 commit comments

Comments
 (0)