MongoDB C++ Driver legacy-1.1.2
Loading...
Searching...
No Matches
autolib.h
1/* Copyright 2014 MongoDB Inc.
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#pragma once
17
18#if defined(_MSC_VER) && !defined(LIBMONGOCLIENT_NO_AUTOLIB)
19#
20#pragma push_macro("LIBMONGOCLIENT_LIB_PREFIX")
21#undef LIBMONGOCLIENT_LIB_PREFIX
22#
23#pragma push_macro("LIBMONGOCLIENT_ABI_ADORNMENT")
24#undef LIBMONGOCLIENT_ABI_ADORNMENT
25#
26#pragma push_macro("LIBMONGOCLIENT_LIB_SUFFIX")
27#undef LIBMONGOCLIENT_LIB_SUFFIX
28#
29#if defined(STATIC_LIBMONGOCLIENT)
30#// Our static libraries start with an extra 'lib' to separate from DLLs.
31#define LIBMONGOCLIENT_LIB_PREFIX "lib"
32#if defined(_DEBUG)
33#if defined(_DLL)
34#// This is a static client lib linking to the debug DLL runtime
35#define LIBMONGOCLIENT_ABI_ADORNMENT "-gd"
36#else
37#// This is a static client lib linking to the debug static runtime
38#define LIBMONGOCLIENT_ABI_ADORNMENT "-sgd"
39#endif
40#else
41#if defined(_DLL)
42#// This is a static client lib linking to the retail DLL runtime
43#define LIBMONGOCLIENT_ABI_ADORNMENT ""
44#else
45#// This is a static client lib linking to the retail static runtime
46#define LIBMONGOCLIENT_ABI_ADORNMENT "-s"
47#endif
48#endif
49#else
50#// Our DLL doesn't have a 'lib' prefix, unlike our static lib
51#define LIBMONGOCLIENT_LIB_PREFIX ""
52#if defined(_DEBUG)
53#// This is a DLL libmongoclient linking to the debug DLL runtime
54#define LIBMONGOCLIENT_ABI_ADORNMENT "-gd"
55#else
56#// This is a DLL libmongoclient linking to the retail DLL runtime
57#define LIBMONGOCLIENT_ABI_ADORNMENT ""
58#endif
59#endif
60#
61#// We always link to either the static library, or the stub for DLLs.
62#define LIBMONGOCLIENT_LIB_SUFFIX ".lib"
63#
64#// Tack together the pieces in the right order
65#pragma comment(lib, \
66 LIBMONGOCLIENT_LIB_PREFIX \
67 "mongoclient" LIBMONGOCLIENT_ABI_ADORNMENT LIBMONGOCLIENT_LIB_SUFFIX)
68#
69#pragma pop_macro("LIBMONGOCLIENT_LIB_PREFIX")
70#pragma pop_macro("LIBMONGOCLIENT_ABI_ADORNMENT")
71#pragma pop_macro("LIBMONGOCLIENT_LIB_SUFFIX")
72#
73#endif