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(_MSC_VER)
14 # if 0
15  /* This is a static component and has no need for exports
16  elf based static libraries are able to have hidden/default visibility
17  controls on symbols so we should propagate this information in that
18  use case
19  */
20 # define VTKM_SOURCE_EXPORT_DEFINE
21 # define VTKM_SOURCE_IMPORT_DEFINE
22 # define VTKM_SOURCE_NO_EXPORT_DEFINE
23 # else
24 # define VTKM_SOURCE_EXPORT_DEFINE __declspec(dllexport)
25 # define VTKM_SOURCE_IMPORT_DEFINE __declspec(dllimport)
26 # define VTKM_SOURCE_NO_EXPORT_DEFINE
27 # endif
28 #else
29 # define VTKM_SOURCE_EXPORT_DEFINE __attribute__((visibility("default")))
30 # define VTKM_SOURCE_IMPORT_DEFINE __attribute__((visibility("default")))
31 # define VTKM_SOURCE_NO_EXPORT_DEFINE __attribute__((visibility("hidden")))
32 #endif
33 
34 #ifndef VTKM_SOURCE_EXPORT
35 # if defined(vtkm_source_EXPORTS)
36  /* We are building this library */
37 # define VTKM_SOURCE_EXPORT VTKM_SOURCE_EXPORT_DEFINE
38 # else
39  /* We are using this library */
40 # define VTKM_SOURCE_EXPORT VTKM_SOURCE_IMPORT_DEFINE
41 # endif
42 #endif
43 
44 #ifndef VTKM_SOURCE_TEMPLATE_EXPORT
45 # if defined(vtkm_source_EXPORTS) && defined(_MSC_VER)
46  /* Warning C4910 on windows state that extern explicit template can't be
47  labeled with __declspec(dllexport). So that is why we use a new custom
48  define. But when other modules ( e.g. rendering ) include this header
49  we need them to see that the extern template is actually being imported.
50  */
51  /* We are building this library with MSVC */
52 # define VTKM_SOURCE_TEMPLATE_EXPORT
53 # elif defined(vtkm_source_EXPORTS)
54  /* We are building this library */
55 # define VTKM_SOURCE_TEMPLATE_EXPORT VTKM_SOURCE_EXPORT_DEFINE
56 # else
57  /* We are using this library */
58 # define VTKM_SOURCE_TEMPLATE_EXPORT VTKM_SOURCE_IMPORT_DEFINE
59 # endif
60 #endif
61 
62 #ifndef VTKM_SOURCE_NO_EXPORT
63  #define VTKM_SOURCE_NO_EXPORT VTKM_SOURCE_NO_EXPORT_DEFINE
64 #endif
65 
66 #endif
67