Skip to content

Commit 2b52609

Browse files
committed
Redo opennurbs_defines to match PCLs structure for both windows and linux. But still use OPENNURBS_EXPORTS as it was used multiple places.
1 parent bdd8ae4 commit 2b52609

1 file changed

Lines changed: 28 additions & 40 deletions

File tree

surface/include/pcl/surface/3rdparty/opennurbs/opennurbs_defines.h

Lines changed: 28 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -61,63 +61,51 @@
6161
//
6262
*/
6363

64-
#if defined(OPENNURBS_EXPORTS)
65-
// OPENNURBS_EXPORTS is Microsoft's prefered defined for building an opennurbs DLL.
66-
#if !defined(ON_DLL_EXPORTS)
67-
#define ON_DLL_EXPORTS
68-
#endif
69-
#if !defined(ON_COMPILING_OPENNURBS)
70-
#define ON_COMPILING_OPENNURBS
71-
#endif
72-
#endif
73-
74-
#if defined(OPENNURBS_IMPORTS)
75-
// OPENNURBS_EXPORTS is Microsoft's prefered defined for linking with an opennurbs DLL.
76-
#if !defined(ON_DLL_IMPORTS)
77-
#define ON_DLL_IMPORTS
78-
#endif
79-
#endif
80-
81-
#if defined(ON_DLL_EXPORTS) && defined(ON_DLL_IMPORTS)
82-
#error At most one of ON_DLL_EXPORTS and ON_DLL_IMPORTS can be defined.
83-
#endif
64+
#ifdef PCL_STATIC_DEFINE
8465

85-
/* export/import */
86-
#if defined(ON_DLL_EXPORTS)
66+
/* compiling or using OpenNurbs as a static library */
67+
#define ON_CLASS
68+
#define ON_DECL
69+
#define ON_EXTERN_DECL
8770

88-
#if !defined(ON_COMPILING_OPENNURBS)
89-
#error When compiling an OpenNURBS DLL, ON_DLL_EXPORTS must be defined
71+
#if defined(ON_DLL_TEMPLATE)
72+
#undef ON_DLL_TEMPLATE
9073
#endif
9174

92-
/* compiling OpenNurbs as a Windows DLL - export classes, functions, templates, and globals */
75+
#else
76+
#if defined WIN32 || defined _WIN32 || defined WINCE || defined __MINGW32__
77+
#ifdef OPENNURBS_EXPORTS
78+
/* compiling OpenNurbs as a Windows DLL - export classes, functions, templates, and
79+
* globals */
9380
#define ON_CLASS __declspec(dllexport)
9481
#define ON_DECL __declspec(dllexport)
9582
#define ON_EXTERN_DECL __declspec(dllexport)
9683
#define ON_DLL_TEMPLATE
97-
98-
#elif defined(ON_DLL_IMPORTS)
99-
100-
#if defined(ON_COMPILING_OPENNURBS)
101-
#error When compiling an OpenNURBS DLL, ON_DLL_IMPORTS must NOT be defined
102-
#endif
103-
104-
/* using OpenNurbs as a Windows DLL - import classes, functions, templates, and globals */
84+
#define ON_DLL_EXPORTS
85+
#else
86+
/* using OpenNurbs as a Windows DLL - import classes, functions, templates, and globals
87+
*/
10588
#define ON_CLASS __declspec(dllimport)
10689
#define ON_DECL __declspec(dllimport)
10790
#define ON_EXTERN_DECL __declspec(dllimport)
10891
#define ON_DLL_TEMPLATE extern
109-
92+
#define ON_DLL_IMPORTS
93+
#endif
94+
#else
95+
#ifdef PCL_SYMBOL_VISIBILITY_HIDDEN
96+
#define ON_CLASS __attribute__((visibility("default")))
97+
#define ON_DECL __attribute__((visibility("default")))
98+
#define ON_EXTERN_DECL __attribute__((visibility("default")))
99+
#define ON_DLL_TEMPLATE
100+
#define ON_DLL_EXPORTS
110101
#else
111-
112-
/* compiling or using OpenNurbs as a static library */
113102
#define ON_CLASS
114103
#define ON_DECL
115104
#define ON_EXTERN_DECL
116-
117-
#if defined(ON_DLL_TEMPLATE)
118-
#undef ON_DLL_TEMPLATE
105+
#define ON_DLL_TEMPLATE
106+
#define ON_DLL_EXPORTS
107+
#endif
119108
#endif
120-
121109
#endif
122110

123111

0 commit comments

Comments
 (0)