eProsima_auto_link.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. // Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima).
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. /*
  15. Expected defines.
  16. - EPROSIMA_LIB_NAME
  17. - FASTRTPS_VERSION_MAJOR
  18. - FASTRTPS_VERSION_MINOR
  19. */
  20. #if defined(_MSC_VER)
  21. #define EPROSIMA_STRINGIZE(X) EPROSIMA_DO_STRINGIZE(X)
  22. #define EPROSIMA_DO_STRINGIZE(X) #X
  23. #if defined(_DEBUG)
  24. #define EPROSIMA_LIB_DEBUG_TAG "d"
  25. #else
  26. #define EPROSIMA_LIB_DEBUG_TAG
  27. #endif // _DEBUG
  28. // Select linkage option.
  29. #if (defined(_DLL) || defined(_RTLDLL)) && defined(EPROSIMA_DYN_LINK)
  30. #define EPROSIMA_LIB_PREFIX
  31. #elif defined(EPROSIMA_DYN_LINK)
  32. #error "Mixing a dll eprosima library with a static runtime is a bad idea"
  33. #else
  34. #define EPROSIMA_LIB_PREFIX "lib"
  35. #endif
  36. // Include library
  37. #if defined(EPROSIMA_LIB_NAME) \
  38. && defined(EPROSIMA_LIB_PREFIX) \
  39. && defined(EPROSIMA_LIB_DEBUG_TAG) \
  40. && defined(FASTRTPS_VERSION_MAJOR) \
  41. && defined(FASTRTPS_VERSION_MINOR)
  42. #pragma comment(lib, EPROSIMA_LIB_PREFIX EPROSIMA_STRINGIZE(EPROSIMA_LIB_NAME) EPROSIMA_LIB_DEBUG_TAG "-" EPROSIMA_STRINGIZE(FASTRTPS_VERSION_MAJOR) "." EPROSIMA_STRINGIZE(FASTRTPS_VERSION_MINOR) ".lib")
  43. #else
  44. #error "Some required macros where not defined"
  45. #endif
  46. #endif // _MSC_VER
  47. // Undef macros
  48. #ifdef EPROSIMA_LIB_PREFIX
  49. #undef EPROSIMA_LIB_PREFIX
  50. #endif
  51. #ifdef EPROSIMA_LIB_NAME
  52. #undef EPROSIMA_LIB_NAME
  53. #endif
  54. #ifdef EPROSIMA_LIB_DEBUG_TAG
  55. #undef EPROSIMA_LIB_DEBUG_TAG
  56. #endif