1 #ifndef _KVI_SETTINGS_H_
2 #define _KVI_SETTINGS_H_
3 //=============================================================================
4 //
5 //   File : kvi_settings.h
6 //   Creation date : Fri Mar 19 1999 05:21:13 CEST by Szymon Stefanek
7 //
8 //   This file is part of the KVIrc IRC client distribution
9 //   Copyright (C) 1999-2010 Szymon Stefanek (pragma at kvirc dot net)
10 //
11 //   This program is FREE software. You can redistribute it and/or
12 //   modify it under the terms of the GNU General Public License
13 //   as published by the Free Software Foundation; either version 2
14 //   of the License, or (at your option) any later version.
15 //
16 //   This program is distributed in the HOPE that it will be USEFUL,
17 //   but WITHOUT ANY WARRANTY; without even the implied warranty of
18 //   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
19 //   See the GNU General Public License for more details.
20 //
21 //   You should have received a copy of the GNU General Public License
22 //   along with this program. If not, write to the Free Software Foundation,
23 //   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24 //
25 //=============================================================================
26 
27 /**
28 * \file kvi_settings.h
29 * \author Szymon Stefanek
30 * \brief This file contains compile time settings
31 *
32 * They are either set by configure or non-customizable defaults
33 * Better to not touch this
34 */
35 
36 #include <QtGlobal>
37 
38 // assume CMake build system for all systems
39 #include "kvi_sysconfig.h"
40 
41 /**
42  * \def KVILIB_API This prefix before a class name or function enables the export of its symbols outside kvilib; needed for win32/visual studio, win32/mingw, linux/gcc.
43  * \def KVILIB_API_TYPEDEF This prefix before a typedef enables the export of its symbol outside kvilib; needed for win32/visual studio, win32/mingw
44  */
45 
46 /**
47  * \def KVIRC_API This prefix before a class name or function enables the export of its symbols outside kvirc; needed for win32/visual studio, win32/mingw, linux/gcc.
48  * \def KVIRC_API_TYPEDEF This prefix before a typedef enables the export of its symbol outside kvirc; needed for win32/visual studio, win32/mingw
49  */
50 // note: MINGW is a cmake-set variable
51 #ifdef MINGW
52 
53 /**
54 	 * \def COMPILE_ON_MINGW This flag will enable specific code for windows/mingw (cross)compilation
55 	 */
56 #define COMPILE_ON_MINGW
57 
58 #ifdef _WANT_KVILIB_
59 #define KVILIB_API __declspec(dllexport) __attribute__((visibility("default")))
60 #define KVILIB_API_TYPEDEF __declspec(dllexport)
61 #else
62 #define KVILIB_API __declspec(dllimport) __attribute__((visibility("default")))
63 #define KVILIB_API_TYPEDEF __declspec(dllimport)
64 #endif
65 
66 #ifdef _WANT_KVIRC_
67 #define KVIRC_API __declspec(dllexport) __attribute__((visibility("default")))
68 #define KVIRC_API_TYPEDEF __declspec(dllexport)
69 #else
70 #define KVIRC_API __declspec(dllimport) __attribute__((visibility("default")))
71 #define KVIRC_API_TYPEDEF __declspec(dllimport)
72 #endif
73 
74 // note: unofficial cmake ports defines OS2
75 #elif defined(OS2)
76 
77 // os2 ports still uses mingw/gcc
78 #define COMPILE_ON_MINGW
79 
80 // visibility attribute is not supported by gcc/os2
81 #ifdef _WANT_KVILIB_
82 #define KVILIB_API __declspec(dllexport)
83 #define KVILIB_API_TYPEDEF __declspec(dllexport)
84 #else
85 #define KVILIB_API __declspec(dllimport)
86 #define KVILIB_API_TYPEDEF __declspec(dllimport)
87 #endif
88 
89 #ifdef _WANT_KVIRC_
90 #define KVIRC_API __declspec(dllexport)
91 #define KVIRC_API_TYPEDEF __declspec(dllexport)
92 #else
93 #define KVIRC_API __declspec(dllimport)
94 #define KVIRC_API_TYPEDEF __declspec(dllimport)
95 #endif
96 
97 // note: cmake defines "WIN32" but we're not using it since it includes cygwin, too
98 // we use qt's Q_OS_WIN32 instead (and its variants)
99 #elif(defined(_OS_WIN32_) || defined(Q_OS_WIN32) || defined(Q_OS_WIN32_))
100 
101 /**
102 	 * \def COMPILE_ON_WINDOWS This flag will enable specific code for windows/visual studio compilation
103 	 */
104 #define COMPILE_ON_WINDOWS
105 
106 #ifdef _WANT_KVILIB_
107 #define KVILIB_API __declspec(dllexport)
108 #define KVILIB_API_TYPEDEF __declspec(dllexport)
109 #else
110 #define KVILIB_API __declspec(dllimport)
111 #define KVILIB_API_TYPEDEF __declspec(dllimport)
112 #endif
113 
114 #ifdef _WANT_KVIRC_
115 #define KVIRC_API __declspec(dllexport)
116 #define KVIRC_API_TYPEDEF __declspec(dllexport)
117 #else
118 #define KVIRC_API __declspec(dllimport)
119 #define KVIRC_API_TYPEDEF __declspec(dllimport)
120 #endif
121 
122 #else
123 // we failback on unix/linux variants
124 #define KVILIB_API __attribute__((visibility("default")))
125 #define KVILIB_API_TYPEDEF
126 
127 #define KVIRC_API __attribute__((visibility("default")))
128 #define KVIRC_API_TYPEDEF
129 
130 // note: cmake defines "APPLE" but we're not using it since it includes legacy mac os version (pre-X)
131 // we use qt's Q_OS_MACX instead
132 #ifdef Q_OS_MACX
133 /**
134 		* \def COMPILE_ON_MAC This flag will enable specific code for mac compilation
135 		*/
136 
137 #define COMPILE_ON_MAC
138 #endif
139 
140 #endif
141 
142 /**
143 * \def KVI_VERSION Defines the current KVIrc version
144 * \def KVIRC_VERSION_BRANCH Defines the KVIrc version of the current branch
145 * \def KVI_RELEASE_NAME Defines the codename for the current KVIrc release
146 * \def _GNU_SOURCE Enables _GNU_SOURCE features
147 * \def KVI_PTR2MEMBER Cross-platform macro that returns a member from its pointer
148 * \def KVI_DEPRECATED Prefix for deprecated objects inside KVIrc code (currently unused)
149 * \def BIG_ENDIAN_MACHINE_BYTE_ORDER If defined, the current target processor is big endian, little endian otherwise
150 */
151 
152 #define KVI_VERSION KVIRC_VERSION_RELEASE
153 
154 #ifndef KVIRC_VERSION_BRANCH
155 #define KVI_VERSION_BRANCH "VS_BRANCH"
156 #else
157 #define KVI_VERSION_BRANCH KVIRC_VERSION_BRANCH
158 #endif
159 
160 #define KVI_RELEASE_NAME KVIRC_VERSION_CODENAME
161 
162 // We want _GNU_SOURCE features
163 #ifndef _GNU_SOURCE
164 #define _GNU_SOURCE
165 #endif
166 
167 #if defined(__GNUC__)
168 // gcc
169 #if __GNUC__ >= 3
170 #define KVI_PTR2MEMBER(__x) &__x
171 #else
172 #define KVI_PTR2MEMBER(__x) &(__x)
173 #endif
174 #elif defined(COMPILE_ON_WINDOWS)
175 // Visual C++
176 #define KVI_PTR2MEMBER(__x) &__x
177 #elif defined(__SUNPRO_CC)
178 // Sun Forte
179 #define KVI_PTR2MEMBER(__x) (__x)
180 #else
181 // default
182 #define KVI_PTR2MEMBER(__x) &(__x)
183 #endif
184 
185 #define KVI_DEPRECATED
186 
187 // Trust Qt about the current target processor endianness
188 #if Q_BYTE_ORDER == Q_BIG_ENDIAN
189 #define BIG_ENDIAN_MACHINE_BYTE_ORDER
190 #else
191 #ifdef BIG_ENDIAN_MACHINE_BYTE_ORDER
192 #undef BIG_ENDIAN_MACHINE_BYTE_ORDER
193 #endif
194 #endif
195 
196 #if defined(COMPILE_ON_WINDOWS) || defined(COMPILE_ON_MINGW)
197 #define UNICODE
198 #define _UNICODE
199 #endif
200 
201 #endif //_KVI_SETTINGS_H_
202