Fast RTPS  Version 2.14.1
Fast RTPS
Loading...
Searching...
No Matches
eProsima_auto_link.h
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 Expected defines.
17
18 - EPROSIMA_LIB_NAME
19 - FASTRTPS_VERSION_MAJOR
20 - FASTRTPS_VERSION_MINOR
21*/
22
23#if defined(_MSC_VER)
24 #define EPROSIMA_STRINGIZE(X) EPROSIMA_DO_STRINGIZE(X)
25 #define EPROSIMA_DO_STRINGIZE(X) #X
26
27 #if defined(_DEBUG)
28 #define EPROSIMA_LIB_DEBUG_TAG "d"
29 #else
30 #define EPROSIMA_LIB_DEBUG_TAG
31 #endif // _DEBUG
32
33 // Select linkage option.
34 #if (defined(_DLL) || defined(_RTLDLL)) && defined(EPROSIMA_DYN_LINK)
35 #define EPROSIMA_LIB_PREFIX
36 #elif defined(EPROSIMA_DYN_LINK)
37 #error "Mixing a dll eprosima library with a static runtime is a bad idea"
38 #else
39 #define EPROSIMA_LIB_PREFIX "lib"
40 #endif
41
42 // Include library
43 #if defined(EPROSIMA_LIB_NAME) \
44 && defined(EPROSIMA_LIB_PREFIX) \
45 && defined(EPROSIMA_LIB_DEBUG_TAG) \
46 && defined(FASTRTPS_VERSION_MAJOR) \
47 && defined(FASTRTPS_VERSION_MINOR)
48 #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")
49 #else
50 #error "Some required macros where not defined"
51 #endif
52
53#endif // _MSC_VER
54
55// Undef macros
56#ifdef EPROSIMA_LIB_PREFIX
57#undef EPROSIMA_LIB_PREFIX
58#endif
59
60#ifdef EPROSIMA_LIB_NAME
61#undef EPROSIMA_LIB_NAME
62#endif
63
64#ifdef EPROSIMA_LIB_DEBUG_TAG
65#undef EPROSIMA_LIB_DEBUG_TAG
66#endif