dllexport.h.in 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /* ----------------------------------------------------------------------------
  2. * @library_name@ Copyright 2010, Georgia Tech Research Corporation,
  3. * Atlanta, Georgia 30332-0415
  4. * All Rights Reserved
  5. * Authors: Frank Dellaert, et al. (see THANKS for the full author list)
  6. * See LICENSE for the license information
  7. * -------------------------------------------------------------------------- */
  8. /**
  9. * @file dllexport.h
  10. * @brief Symbols for exporting classes and methods from DLLs
  11. * @author Richard Roberts
  12. * @date Mar 9, 2013
  13. */
  14. // Macros for exporting DLL symbols on Windows
  15. // Usage example:
  16. // In header file:
  17. // class GTSAM_EXPORT MyClass { ... };
  18. //
  19. // Results in the following declarations:
  20. // When included while compiling the GTSAM library itself:
  21. // class __declspec(dllexport) MyClass { ... };
  22. // When included while compiling other code against GTSAM:
  23. // class __declspec(dllimport) MyClass { ... };
  24. #pragma once
  25. // Whether GTSAM is compiled as static or DLL in windows.
  26. // This will be used to decide whether include __declspec(dllimport) or not in headers
  27. #cmakedefine BUILD_SHARED_LIBS
  28. #ifdef _WIN32
  29. # ifndef BUILD_SHARED_LIBS
  30. # define @library_name@_EXPORT
  31. # define @library_name@_EXTERN_EXPORT extern
  32. # else
  33. # ifdef @library_name@_EXPORTS
  34. # define @library_name@_EXPORT __declspec(dllexport)
  35. # define @library_name@_EXTERN_EXPORT __declspec(dllexport) extern
  36. # else
  37. # define @library_name@_EXPORT __declspec(dllimport)
  38. # define @library_name@_EXTERN_EXPORT __declspec(dllimport)
  39. # endif
  40. # endif
  41. #else
  42. #ifdef __APPLE__
  43. # define @library_name@_EXPORT __attribute__((visibility("default")))
  44. # define @library_name@_EXTERN_EXPORT extern
  45. #else
  46. # define @library_name@_EXPORT
  47. # define @library_name@_EXTERN_EXPORT extern
  48. #endif
  49. #endif
  50. #undef BUILD_SHARED_LIBS