VTK-m  2.2
vtkm_source_export.h
Go to the documentation of this file.
1 //============================================================================
2 // Copyright (c) Kitware, Inc.
3 // All rights reserved.
4 // See LICENSE.txt for details.
5 //
6 // This software is distributed WITHOUT ANY WARRANTY; without even
7 // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
8 // PURPOSE. See the above copyright notice for more information.
9 //============================================================================
10 #ifndef VTKM_SOURCE_EXPORT_H
11 #define VTKM_SOURCE_EXPORT_H
12 
13 #if defined(VTKM_DOXYGEN_ONLY)
14 # define VTKM_SOURCE_EXPORT_DEFINE
15 # define VTKM_SOURCE_IMPORT_DEFINE
16 # define VTKM_SOURCE_NO_EXPORT_DEFINE
17 #elif defined(_MSC_VER)
18 # if 0
19  /* This is a static component and has no need for exports
20  elf based static libraries are able to have hidden/default visibility
21  controls on symbols so we should propagate this information in that
22  use case
23  */
24 # define VTKM_SOURCE_EXPORT_DEFINE
25 # define VTKM_SOURCE_IMPORT_DEFINE
26 # define VTKM_SOURCE_NO_EXPORT_DEFINE
27 # else
28 # define VTKM_SOURCE_EXPORT_DEFINE __declspec(dllexport)
29 # define VTKM_SOURCE_IMPORT_DEFINE __declspec(dllimport)
30 # define VTKM_SOURCE_NO_EXPORT_DEFINE
31 # endif
32 #else
33 # define VTKM_SOURCE_EXPORT_DEFINE __attribute__((visibility("default")))
34 # define VTKM_SOURCE_IMPORT_DEFINE __attribute__((visibility("default")))
35 # define VTKM_SOURCE_NO_EXPORT_DEFINE __attribute__((visibility("hidden")))
36 #endif
37 
38 #ifndef VTKM_SOURCE_EXPORT
39 # if defined(vtkm_source_EXPORTS)
40  /* We are building this library */
41 # define VTKM_SOURCE_EXPORT VTKM_SOURCE_EXPORT_DEFINE
42 # else
43  /* We are using this library */
44 # define VTKM_SOURCE_EXPORT VTKM_SOURCE_IMPORT_DEFINE
45 # endif
46 #endif
47 
48 #ifndef VTKM_SOURCE_TEMPLATE_EXPORT
49 # if defined(vtkm_source_EXPORTS) && defined(_MSC_VER)
50  /* Warning C4910 on windows state that extern explicit template can't be
51  labeled with __declspec(dllexport). So that is why we use a new custom
52  define. But when other modules ( e.g. rendering ) include this header
53  we need them to see that the extern template is actually being imported.
54  */
55  /* We are building this library with MSVC */
56 # define VTKM_SOURCE_TEMPLATE_EXPORT
57 # elif defined(vtkm_source_EXPORTS)
58  /* We are building this library */
59 # define VTKM_SOURCE_TEMPLATE_EXPORT VTKM_SOURCE_EXPORT_DEFINE
60 # else
61  /* We are using this library */
62 # define VTKM_SOURCE_TEMPLATE_EXPORT VTKM_SOURCE_IMPORT_DEFINE
63 # endif
64 #endif
65 
66 #ifndef VTKM_SOURCE_NO_EXPORT
67  #define VTKM_SOURCE_NO_EXPORT VTKM_SOURCE_NO_EXPORT_DEFINE
68 #endif
69 
70 #endif
71