Skip to content

Commit cd7fb4d

Browse files
committed
Refactoring
Signed-off-by: Darby Johnston <[email protected]>
1 parent 57aff3f commit cd7fb4d

File tree

2 files changed

+48
-37
lines changed

2 files changed

+48
-37
lines changed

src/opentime/export.h

Lines changed: 35 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -3,35 +3,38 @@
33

44
#pragma once
55

6+
// For an explanation of how these export defines work, see:
7+
// https://github.com/PixarAnimationStudios/OpenUSD/blob/dev/pxr/base/arch/export.h
68
#if defined(_WINDOWS)
79
# if defined(__GNUC__) && __GNUC__ >= 4 || defined(__clang__)
8-
# define ARCH_EXPORT __attribute__((dllexport))
9-
# define ARCH_IMPORT __attribute__((dllimport))
10-
# define ARCH_HIDDEN
11-
# define ARCH_EXPORT_TYPE
10+
# define OPENTIMELINIO_EXPORT __attribute__((dllexport))
11+
# define OPENTIMELINIO_IMPORT __attribute__((dllimport))
12+
# define OPENTIMELINIO_HIDDEN
13+
# define OPENTIMELINIO_EXPORT_TYPE
1214
# else
13-
# define ARCH_EXPORT __declspec(dllexport)
14-
# define ARCH_IMPORT __declspec(dllimport)
15-
# define ARCH_HIDDEN
16-
# define ARCH_EXPORT_TYPE
15+
# define OPENTIMELINIO_EXPORT __declspec(dllexport)
16+
# define OPENTIMELINIO_IMPORT __declspec(dllimport)
17+
# define OPENTIMELINIO_HIDDEN
18+
# define OPENTIMELINIO_EXPORT_TYPE
1719
# endif
1820
#elif defined(__GNUC__) && __GNUC__ >= 4 || defined(__clang__)
19-
# define ARCH_EXPORT __attribute__((visibility("default")))
20-
# define ARCH_IMPORT
21-
# define ARCH_HIDDEN __attribute__((visibility("hidden")))
21+
# define OPENTIMELINIO_EXPORT __attribute__((visibility("default")))
22+
# define OPENTIMELINIO_IMPORT
23+
# define OPENTIMELINIO_HIDDEN __attribute__((visibility("hidden")))
2224
# if defined(__clang__)
23-
# define ARCH_EXPORT_TYPE __attribute__((type_visibility("default")))
25+
# define OPENTIMELINIO_EXPORT_TYPE __attribute__((type_visibility("default")))
2426
# else
25-
# define ARCH_EXPORT_TYPE __attribute__((visibility("default")))
27+
# define OPENTIMELINIO_EXPORT_TYPE __attribute__((visibility("default")))
2628
# endif
2729
#else
28-
# define ARCH_EXPORT
29-
# define ARCH_IMPORT
30-
# define ARCH_HIDDEN
31-
# define ARCH_EXPORT_TYPE
30+
# define OPENTIMELINIO_EXPORT
31+
# define OPENTIMELINIO_IMPORT
32+
# define OPENTIMELINIO_HIDDEN
33+
# define OPENTIMELINIO_EXPORT_TYPE
3234
#endif
33-
#define ARCH_EXPORT_TEMPLATE(type, ...)
34-
#define ARCH_IMPORT_TEMPLATE(type, ...) extern template type ARCH_IMPORT __VA_ARGS__
35+
#define OPENTIMELINIO_EXPORT_TEMPLATE(type, ...)
36+
#define OPENTIMELINIO_IMPORT_TEMPLATE(type, ...) \
37+
extern template type OPENTIMELINIO_IMPORT __VA_ARGS__
3538

3639
#if defined(OPENTIME_STATIC)
3740
# define OPENTIME_API
@@ -41,15 +44,19 @@
4144
# define OPENTIME_LOCAL
4245
#else
4346
# if defined(OPENTIME_EXPORTS)
44-
# define OPENTIME_API ARCH_EXPORT
45-
# define OPENTIME_API_TYPE ARCH_EXPORT_TYPE
46-
# define OPENTIME_API_TEMPLATE_CLASS(...) ARCH_EXPORT_TEMPLATE(class, __VA_ARGS__)
47-
# define OPENTIME_API_TEMPLATE_STRUCT(...) ARCH_EXPORT_TEMPLATE(struct, __VA_ARGS__)
47+
# define OPENTIME_API OPENTIMELINIO_EXPORT
48+
# define OPENTIME_API_TYPE OPENTIMELINIO_EXPORT_TYPE
49+
# define OPENTIME_API_TEMPLATE_CLASS(...) \
50+
OPENTIMELINIO_EXPORT_TEMPLATE(class, __VA_ARGS__)
51+
# define OPENTIME_API_TEMPLATE_STRUCT(...) \
52+
OPENTIMELINIO_EXPORT_TEMPLATE(struct, __VA_ARGS__)
4853
# else
49-
# define OPENTIME_API ARCH_IMPORT
50-
# define OPENTIME_API_TYPE ARCH_IMPORT_TYPE
51-
# define OPENTIME_API_TEMPLATE_CLASS(...) ARCH_IMPORT_TEMPLATE(class, __VA_ARGS__)
52-
# define OPENTIME_API_TEMPLATE_STRUCT(...) ARCH_IMPORT_TEMPLATE(struct, __VA_ARGS__)
54+
# define OPENTIME_API OPENTIMELINIO_IMPORT
55+
# define OPENTIME_API_TYPE OPENTIMELINIO_IMPORT_TYPE
56+
# define OPENTIME_API_TEMPLATE_CLASS(...) \
57+
OPENTIMELINIO_IMPORT_TEMPLATE(class, __VA_ARGS__)
58+
# define OPENTIME_API_TEMPLATE_STRUCT(...) \
59+
OPENTIMELINIO_IMPORT_TEMPLATE(struct, __VA_ARGS__)
5360
# endif
54-
# define OPENTIME_LOCAL ARCH_HIDDEN
61+
# define OPENTIME_LOCAL OPENTIMELINIO_HIDDEN
5562
#endif

src/opentimelineio/export.h

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,19 @@
1313
# define OTIO_LOCAL
1414
#else
1515
# if defined(OTIO_EXPORTS)
16-
# define OTIO_API ARCH_EXPORT
17-
# define OTIO_API_TYPE ARCH_EXPORT_TYPE
18-
# define OTIO_API_TEMPLATE_CLASS(...) ARCH_EXPORT_TEMPLATE(class, __VA_ARGS__)
19-
# define OTIO_API_TEMPLATE_STRUCT(...) ARCH_EXPORT_TEMPLATE(struct, __VA_ARGS__)
16+
# define OTIO_API OPENTIMELINIO_EXPORT
17+
# define OTIO_API_TYPE OPENTIMELINIO_EXPORT_TYPE
18+
# define OTIO_API_TEMPLATE_CLASS(...) \
19+
OPENTIMELINIO_EXPORT_TEMPLATE(class, __VA_ARGS__)
20+
# define OTIO_API_TEMPLATE_STRUCT(...) \
21+
OPENTIMELINIO_EXPORT_TEMPLATE(struct, __VA_ARGS__)
2022
# else
21-
# define OTIO_API ARCH_IMPORT
22-
# define OTIO_API_TYPE ARCH_IMPORT_TYPE
23-
# define OTIO_API_TEMPLATE_CLASS(...) ARCH_IMPORT_TEMPLATE(class, __VA_ARGS__)
24-
# define OTIO_API_TEMPLATE_STRUCT(...) ARCH_IMPORT_TEMPLATE(struct, __VA_ARGS__)
23+
# define OTIO_API OPENTIMELINIO_IMPORT
24+
# define OTIO_API_TYPE OPENTIMELINIO_IMPORT_TYPE
25+
# define OTIO_API_TEMPLATE_CLASS(...) \
26+
OPENTIMELINIO_IMPORT_TEMPLATE(class, __VA_ARGS__)
27+
# define OTIO_API_TEMPLATE_STRUCT(...) \
28+
OPENTIMELINIO_IMPORT_TEMPLATE(struct, __VA_ARGS__)
2529
# endif
26-
# define OTIO_LOCAL ARCH_HIDDEN
30+
# define OTIO_LOCAL OPENTIMELINIO_HIDDEN
2731
#endif

0 commit comments

Comments
 (0)