Skip to content

Commit 684fde2

Browse files
committed
Update pcl_exports to handle static build by defining PCL_EXPORTS as empty.
Unify the check for WIN32.
1 parent c1b9beb commit 684fde2

File tree

3 files changed

+33
-22
lines changed

3 files changed

+33
-22
lines changed

cmake/pcl_targets.cmake

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,9 @@ function(PCL_ADD_LIBRARY _name)
232232
DEFINE_SYMBOL "PCLAPI_EXPORTS")
233233
endif()
234234

235+
target_compile_definitions(
236+
${_name} PUBLIC "$<IF:$<BOOL:${PCL_SHARED_LIBS}>,PCLAPI_EXPORTS,PCL_STATIC_DEFINE>")
237+
235238
set_target_properties(${_name} PROPERTIES
236239
VERSION ${PCL_VERSION}
237240
SOVERSION ${PCL_VERSION_MAJOR}.${PCL_VERSION_MINOR})

common/include/pcl/pcl_exports.h

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,20 @@
4040
// Header 'pcl_macros' is not suitable since it includes <Eigen/Core>,
4141
// which can't be eaten by nvcc (it's too weak)
4242

43-
#if defined _WIN32 || defined WINCE || defined __MINGW32__
44-
#ifdef PCLAPI_EXPORTS
45-
#define PCL_EXPORTS __declspec(dllexport)
46-
#else
47-
#define PCL_EXPORTS __declspec(dllimport)
48-
#endif
43+
#ifdef PCL_STATIC_DEFINE
44+
#define PCL_EXPORTS
4945
#else
50-
#ifdef PCL_SYMBOL_VISIBILITY_HIDDEN
51-
#define PCL_EXPORTS __attribute__ ((visibility ("default")))
52-
#else
53-
#define PCL_EXPORTS
54-
#endif
46+
#if defined WIN32 || defined _WIN32 || defined WINCE || defined __MINGW32__
47+
#ifdef PCLAPI_EXPORTS
48+
#define PCL_EXPORTS __declspec(dllexport)
49+
#else
50+
#define PCL_EXPORTS __declspec(dllimport)
51+
#endif
52+
#else
53+
#ifdef PCL_SYMBOL_VISIBILITY_HIDDEN
54+
#define PCL_EXPORTS __attribute__ ((visibility ("default")))
55+
#else
56+
#define PCL_EXPORTS
57+
#endif
58+
#endif
5559
#endif

common/include/pcl/pcl_macros.h

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -315,18 +315,22 @@ pcl_round (float number)
315315
#endif
316316
#endif
317317

318-
#if defined WIN32 || defined _WIN32 || defined WINCE || defined __MINGW32__
319-
#ifdef PCLAPI_EXPORTS
320-
#define PCL_EXPORTS __declspec(dllexport)
321-
#else
322-
#define PCL_EXPORTS __declspec(dllimport)
323-
#endif
318+
#ifdef PCL_STATIC_DEFINE
319+
#define PCL_EXPORTS
324320
#else
325-
#ifdef PCL_SYMBOL_VISIBILITY_HIDDEN
326-
#define PCL_EXPORTS __attribute__ ((visibility ("default")))
327-
#else
328-
#define PCL_EXPORTS
329-
#endif
321+
#if defined WIN32 || defined _WIN32 || defined WINCE || defined __MINGW32__
322+
#ifdef PCLAPI_EXPORTS
323+
#define PCL_EXPORTS __declspec(dllexport)
324+
#else
325+
#define PCL_EXPORTS __declspec(dllimport)
326+
#endif
327+
#else
328+
#ifdef PCL_SYMBOL_VISIBILITY_HIDDEN
329+
#define PCL_EXPORTS __attribute__ ((visibility ("default")))
330+
#else
331+
#define PCL_EXPORTS
332+
#endif
333+
#endif
330334
#endif
331335

332336
#if defined WIN32 || defined _WIN32

0 commit comments

Comments
 (0)