|
| 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 | +/** |
| 16 | + * @file fastdds_dll.hpp |
| 17 | + * |
| 18 | + */ |
| 19 | + |
| 20 | +#ifndef FASTDDS_FASTDDS_DLL_H |
| 21 | +#define FASTDDS_FASTDDS_DLL_H |
| 22 | + |
| 23 | +#include <fastdds/config.hpp> |
| 24 | + |
| 25 | +// normalize macros |
| 26 | +#if !defined(FASTDDS_DYN_LINK) && !defined(FASTDDS_STATIC_LINK) \ |
| 27 | + && !defined(EPROSIMA_ALL_DYN_LINK) && !defined(EPROSIMA_ALL_STATIC_LINK) |
| 28 | +#define FASTDDS_STATIC_LINK |
| 29 | +#endif // if !defined(FASTDDS_DYN_LINK) && !defined(FASTDDS_STATIC_LINK) && !defined(EPROSIMA_ALL_DYN_LINK) && !defined(EPROSIMA_ALL_STATIC_LINK) |
| 30 | + |
| 31 | +#if defined(EPROSIMA_ALL_DYN_LINK) && !defined(FASTDDS_DYN_LINK) |
| 32 | +#define FASTDDS_DYN_LINK |
| 33 | +#endif // if defined(EPROSIMA_ALL_DYN_LINK) && !defined(FASTDDS_DYN_LINK) |
| 34 | + |
| 35 | +#if defined(FASTDDS_DYN_LINK) && defined(FASTDDS_STATIC_LINK) |
| 36 | +#error Must not define both FASTDDS_DYN_LINK and FASTDDS_STATIC_LINK |
| 37 | +#endif // if defined(FASTDDS_DYN_LINK) && defined(FASTDDS_STATIC_LINK) |
| 38 | + |
| 39 | +#if defined(EPROSIMA_ALL_NO_LIB) && !defined(FASTDDS_NO_LIB) |
| 40 | +#define FASTDDS_NO_LIB |
| 41 | +#endif // if defined(EPROSIMA_ALL_NO_LIB) && !defined(FASTDDS_NO_LIB) |
| 42 | + |
| 43 | +// enable dynamic linking |
| 44 | + |
| 45 | +#if defined(_WIN32) |
| 46 | +#if defined(EPROSIMA_ALL_DYN_LINK) || defined(FASTDDS_DYN_LINK) |
| 47 | +#if defined(MINGW_COMPILER) |
| 48 | + #if defined(fastdds_EXPORTS) |
| 49 | + #define FASTDDS_EXPORTED_API __declspec( dllexport ) |
| 50 | + #else |
| 51 | + #define FASTDDS_EXPORTED_API __attribute__((visibility("default"))) |
| 52 | + #endif // FASTDDS_SOURCE |
| 53 | +#else |
| 54 | + #if defined(fastdds_EXPORTS) |
| 55 | + #define FASTDDS_EXPORTED_API __declspec( dllexport ) |
| 56 | + #else |
| 57 | + #define FASTDDS_EXPORTED_API __declspec( dllimport ) |
| 58 | + #endif // FASTDDS_SOURCE |
| 59 | +#endif // if defined(MINGW_COMPILER) |
| 60 | +#else |
| 61 | +#define FASTDDS_EXPORTED_API |
| 62 | +#endif // if defined(EPROSIMA_ALL_DYN_LINK) || defined(FASTDDS_DYN_LINK) |
| 63 | +#else |
| 64 | +#define FASTDDS_EXPORTED_API |
| 65 | +#endif // _WIN32 |
| 66 | + |
| 67 | +// Auto linking. |
| 68 | + |
| 69 | +#if !defined(FASTDDS_SOURCE) && !defined(EPROSIMA_ALL_NO_LIB) \ |
| 70 | + && !defined(FASTDDS_NO_LIB) |
| 71 | + |
| 72 | +// Set properties. |
| 73 | +#define EPROSIMA_LIB_NAME fastdds |
| 74 | + |
| 75 | +#if defined(EPROSIMA_ALL_DYN_LINK) || defined(FASTDDS_DYN_LINK) |
| 76 | +#define EPROSIMA_DYN_LINK |
| 77 | +#endif // if defined(EPROSIMA_ALL_DYN_LINK) || defined(FASTDDS_DYN_LINK) |
| 78 | + |
| 79 | +#include <fastdds/fastdds_auto_link.hpp> |
| 80 | +#endif // auto-linking disabled |
| 81 | + |
| 82 | +#endif // FASTDDS_FASTDDS_DLL_H |
0 commit comments