Config.hpp
1 //
3 // Pluma - Plug-in Management Framework
4 // Copyright (C) 2010-2012 Gil Costa (gsaurus@gmail.com)
5 //
6 // This software is provided 'as-is', without any express or implied warranty.
7 // In no event will the authors be held liable for any damages arising from the use of this software.
8 //
9 // Permission is granted to anyone to use this software for any purpose,
10 // including commercial applications, and to alter it and redistribute it freely,
11 // subject to the following restrictions:
12 //
13 // 1. The origin of this software must not be misrepresented;
14 // you must not claim that you wrote the original software.
15 // If you use this software in a product, an acknowledgment
16 // in the product documentation would be appreciated but is not required.
17 //
18 // 2. Altered source versions must be plainly marked as such,
19 // and must not be misrepresented as being the original software.
20 //
21 // 3. This notice may not be removed or altered from any source distribution.
22 //
24 
25 
27 //
28 // Based on SFML configuration header
29 // SFML Config.hpp:
30 // http://www.sfml-dev.org/documentation/2.0/Config_8hpp-source.htm
31 //
32 // Acknowledgements to Simple and Fast Multimedia Library
33 // http://www.sfml-dev.org/
34 //
36 
37 
38 #ifndef PLUMA_CONFIG_HPP
39 #define PLUMA_CONFIG_HPP
40 
41 
43 // Identify the operating system
45 #if defined(WIN32) || defined(_WIN32) || defined(__WIN32__)
46 
47  // Windows
48  #define PLUMA_SYS_WINDOWS
49  #ifndef WIN32_LEAN_AND_MEAN
50  #define WIN32_LEAN_AND_MEAN
51  #endif
52  #ifndef NOMINMAX
53  #define NOMINMAX
54  #endif
55 
56 #elif defined(linux) || defined(__linux)
57 
58  // Linux
59  #define PLUMA_SYS_LINUX
60 
61 #elif defined(__APPLE__) || defined(MACOSX) || defined(macintosh) || defined(Macintosh)
62 
63  // MacOS
64  #define PLUMA_SYS_MACOS
65 
66 #elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
67 
68  // FreeBSD
69  #define PLUMA_SYS_FREEBSD
70 
71 #else
72 
73  // Unsupported system
74  #error This operating system is not supported by this library
75 
76 #endif
77 
78 
79 
81 // Define library file extension based on OS
83 #ifdef PLUMA_SYS_WINDOWS
84  #define PLUMA_LIB_EXTENSION "dll"
85 #elif defined(PLUMA_SYS_MACOS)
86  #define PLUMA_LIB_EXTENSION "dylib"
87 #elif defined(PLUMA_SYS_LINUX) || defined(PLUMA_SYS_FREEBSD)
88  #define PLUMA_LIB_EXTENSION "so"
89 #else
90  // unknown library file type
91  #error Unknown library file extension for this operating system
92 #endif
93 
94 
96 // Define portable import / export macros
98 #if defined(PLUMA_SYS_WINDOWS)
99 
100  #ifndef PLUMA_STATIC
101 
102  // Windows platforms
103  #ifdef PLUMA_EXPORTS
104 
105  // From DLL side, we must export
106  #define PLUMA_API __declspec(dllexport)
107 
108  #else
109 
110  // From client application side, we must import
111  #define PLUMA_API __declspec(dllimport)
112 
113  #endif
114 
115  // For Visual C++ compilers, we also need to turn off this annoying C4251 warning.
116  // You can read lots ot different things about it, but the point is the code will
117  // just work fine, and so the simplest way to get rid of this warning is to disable it
118  #ifdef _MSC_VER
119 
120  #pragma warning(disable : 4251)
121 
122  #endif
123 
124  #else
125 
126  // No specific directive needed for static build
127  #define PLUMA_API
128 
129  #endif
130 
131 #else
132 
133  // Other platforms don't need to define anything
134  #define PLUMA_API
135 
136 #endif
137 
138 
139 
140 
141 #endif // PLUMA_CONFIG_HPP