KVIrc  4.9.2
DeveloperAPIs
kvi_settings.h
Go to the documentation of this file.
1 #ifndef _KVI_SETTINGS_H_
2 #define _KVI_SETTINGS_H_
3 
4 //=============================================================================
5 //
6 // File : kvi_settings.h
7 // Creation date : Fri Mar 19 1999 05:21:13 CEST by Szymon Stefanek
8 //
9 // This file is part of the KVIrc IRC client distribution
10 // Copyright (C) 1999-2010 Szymon Stefanek (pragma at kvirc dot net)
11 //
12 // This program is FREE software. You can redistribute it and/or
13 // modify it under the terms of the GNU General Public License
14 // as published by the Free Software Foundation; either version 2
15 // of the License, or (at your option) any later version.
16 //
17 // This program is distributed in the HOPE that it will be USEFUL,
18 // but WITHOUT ANY WARRANTY; without even the implied warranty of
19 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
20 // See the GNU General Public License for more details.
21 //
22 // You should have received a copy of the GNU General Public License
23 // along with this program. If not, write to the Free Software Foundation,
24 // Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
25 //
26 //=============================================================================
27 
37 #include <QtGlobal>
38 
39 // assume CMake build system for all systems
40 #include "kvi_sysconfig.h"
41 
51 // note: MINGW is a cmake-set variable
52 #ifdef MINGW
53 
57 #define COMPILE_ON_MINGW
58 
59 #ifdef __KVILIB__
60 #define KVILIB_API __declspec(dllexport) __attribute__((visibility("default")))
61 #define KVILIB_API_TYPEDEF __declspec(dllexport)
62 #else
63 #define KVILIB_API __declspec(dllimport) __attribute__((visibility("default")))
64 #define KVILIB_API_TYPEDEF __declspec(dllimport)
65 #endif
66 
67 #ifdef __KVIRC__
68 #define KVIRC_API __declspec(dllexport) __attribute__((visibility("default")))
69 #define KVIRC_API_TYPEDEF __declspec(dllexport)
70 #else
71 #define KVIRC_API __declspec(dllimport) __attribute__((visibility("default")))
72 #define KVIRC_API_TYPEDEF __declspec(dllimport)
73 #endif
74 
75 // note: unofficial cmake ports defines OS2
76 #elif defined(OS2)
77 
78 // os2 ports still uses mingw/gcc
79 #define COMPILE_ON_MINGW
80 
81 // visibility attribute is not supported by gcc/os2
82 #ifdef __KVILIB__
83 #define KVILIB_API __declspec(dllexport)
84 #define KVILIB_API_TYPEDEF __declspec(dllexport)
85 #else
86 #define KVILIB_API __declspec(dllimport)
87 #define KVILIB_API_TYPEDEF __declspec(dllimport)
88 #endif
89 
90 #ifdef __KVIRC__
91 #define KVIRC_API __declspec(dllexport)
92 #define KVIRC_API_TYPEDEF __declspec(dllexport)
93 #else
94 #define KVIRC_API __declspec(dllimport)
95 #define KVIRC_API_TYPEDEF __declspec(dllimport)
96 #endif
97 
98 // note: cmake defines "WIN32" but we're not using it since it includes cygwin, too
99 // we use qt's Q_OS_WIN32 instead (and its variants)
100 #elif(defined(_OS_WIN32_) || defined(Q_OS_WIN32) || defined(Q_OS_WIN32_))
101 
105 #define COMPILE_ON_WINDOWS
106 
107 #ifdef __KVILIB__
108 #define KVILIB_API __declspec(dllexport)
109 #define KVILIB_API_TYPEDEF __declspec(dllexport)
110 #else
111 #define KVILIB_API __declspec(dllimport)
112 #define KVILIB_API_TYPEDEF __declspec(dllimport)
113 #endif
114 
115 #ifdef __KVIRC__
116 #define KVIRC_API __declspec(dllexport)
117 #define KVIRC_API_TYPEDEF __declspec(dllexport)
118 #else
119 #define KVIRC_API __declspec(dllimport)
120 #define KVIRC_API_TYPEDEF __declspec(dllimport)
121 #endif
122 
123 #else
124 // we failback on unix/linux variants
125 #define KVILIB_API __attribute__((visibility("default")))
126 #define KVILIB_API_TYPEDEF
127 
128 #define KVIRC_API __attribute__((visibility("default")))
129 #define KVIRC_API_TYPEDEF
130 
131 // note: cmake defines "APPLE" but we're not using it since it includes legacy mac os version (pre-X)
132 // we use qt's Q_OS_MACX instead
133 #ifdef Q_OS_MACX
134 
138 #define COMPILE_ON_MAC
139 #endif
140 
141 #endif
142 
153 #define KVI_VERSION KVIRC_VERSION_RELEASE
154 
155 #ifndef KVIRC_VERSION_BRANCH
156 #define KVI_VERSION_BRANCH "VS_BRANCH"
157 #else
158 #define KVI_VERSION_BRANCH KVIRC_VERSION_BRANCH
159 #endif
160 
161 #define KVI_RELEASE_NAME KVIRC_VERSION_CODENAME
162 
163 // We want _GNU_SOURCE features
164 #ifndef _GNU_SOURCE
165 #define _GNU_SOURCE
166 #endif
167 
168 #if defined(__GNUC__)
169 // gcc
170 #if __GNUC__ >= 3
171 #define KVI_PTR2MEMBER(__x) &__x
172 #else
173 #define KVI_PTR2MEMBER(__x) &(__x)
174 #endif
175 #elif defined(COMPILE_ON_WINDOWS)
176 // Visual C++
177 #define KVI_PTR2MEMBER(__x) &__x
178 #elif defined(__SUNPRO_CC)
179 // Sun Forte
180 #define KVI_PTR2MEMBER(__x) (__x)
181 #else
182 // default
183 #define KVI_PTR2MEMBER(__x) &(__x)
184 #endif
185 
186 #define KVI_DEPRECATED
187 
188 // Trust Qt about the current target processor endianness
189 #if Q_BYTE_ORDER == Q_BIG_ENDIAN
190 #define BIG_ENDIAN_MACHINE_BYTE_ORDER
191 #else
192 #ifdef BIG_ENDIAN_MACHINE_BYTE_ORDER
193 #undef BIG_ENDIAN_MACHINE_BYTE_ORDER
194 #endif
195 #endif
196 
197 #endif //_KVI_SETTINGS_H_