Go to the
documentation of this file.
00001
00004 #ifndef KARCH_ARCH_H
00005 #define KARCH_ARCH_H
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045 #define KARCH_ARCH_80286 200
00046 #define KARCH_ARCH_I386 300
00047 #define KARCH_ARCH_I486 400
00048 #define KARCH_ARCH_PENTIUM 500
00049 #define KARCH_ARCH_PENTIUMPRO 600
00050 #define KARCH_ARCH_PENTIUMII 630
00051 #define KARCH_ARCH_PENTIUMIII 670
00052 #define KARCH_ARCH_PENTIUMIV 700
00053
00054
00055
00056
00057 #define KARCH_ARCH_AMD64_GENERIC 800
00058
00059
00060
00061
00062 #define KARCH_ARCH_ITANIUM 1000
00063
00064 #if defined(__CYGWIN32__)
00065 #define linux // fake a linux setup
00066 #endif
00067
00068 #if defined(linux) //////////////////////////////////////////////// LINUX
00069 #define KARCH_DEV_GNUC __GNUC__
00070 #define KARCH_ENV_UNIX 1
00071 #define KARCH_ENV_POSIX 1
00072 #define KARCH_ENV_LINUX 1
00073
00074 #if defined(__GNUC__)
00075 #ifndef _GNU_SOURCE
00076 #define _GNU_SOURCE
00077 #endif
00078 #define KARCH_DEV_GNUC __GNUC__
00079
00080
00081 #if defined(__ia64__) && !defined(KARCH_CPU_IA64)
00082 #define KARCH_CPU_IA64 KARCH_ARCH_ITANIUM
00083 #elif defined(__x86_64) && !defined(KARCH_CPU_AMD64)
00084 #define KARCH_CPU_AMD64 KARCH_ARCH_AMD64_GENERIC
00085 #elif !defined(KARCH_CPU_IA32)
00086 #if defined(__pentiumiii__)
00087 #define KARCH_CPU_IA32 KARCH_ARCH_PENTIUMIII
00088 #elif defined(__pentiumii__)
00089 #define KARCH_CPU_IA32 KARCH_ARCH_PENTIUMII
00090 #elif defined(__i686__) || defined(__pentiumpro__)
00091 #define KARCH_CPU_IA32 KARCH_ARCH_PENTIUMPRO
00092 #elif defined(__i586__) || defined(__pentium__) || defined(__k6__)
00093 #define KARCH_CPU_IA32 KARCH_ARCH_PENTIUM
00094 #elif defined(__i486__)
00095 #define KARCH_CPU_IA32 KARCH_ARCH_I486
00096 #elif defined(__i386__)
00097 #define KARCH_CPU_IA32 KARCH_ARCH_I386
00098 #else
00099 #define KARCH_CPU_IA32 KARCH_ARCH_I286
00100 #endif
00101 #endif
00102
00103
00104 #if defined(KARCH_CPU_IA64)
00105 #define KARCH_ARCH_IA64 KARCH_CPU_IA64
00106 #define KARCH_ARCH_64 1
00107 #elif defined(KARCH_CPU_AMD64)
00108 #define KARCH_ARCH_AMD64 KARCH_CPU_AMD64
00109 #define KARCH_ARCH_64 1
00110 #elif defined(KARCH_CPU_IA32)
00111 #define KARCH_ARCH_IA32 KARCH_CPU_IA32
00112
00113 #if (KARCH_CPU_IA32 >= KARCH_ARCH_PENTIUMII)
00114 #define KARCH_CPU_IA32_MMX
00115 #endif
00116 #if (KARCH_CPU_IA32 >= KARCH_ARCH_PENTIUMIII)
00117 #define KARCH_CPU_IA32_SIMD
00118 #endif
00119 #endif
00120 #else
00121 #error "Compiler not supported"
00122 #endif
00123 #elif defined(_XBOX)
00124 #define KARCH_ENV_WIN 1
00125 #define KARCH_ENV_WIN32 _WIN32
00126 #define KARCH_ENV_XBOX _XBOX
00127 #define KARCH_DEV_MSC _MSC_VER
00128 #define KARCH_ARCH_IA32 _M_IX86
00129 #define KARCH_CPU_IA32 KARCH_ARCH_PENTIUM
00130
00131
00132
00133 #elif defined(_WIN32) || defined(_WIN64) //////////////////////////////////////////////// WIN32/WIN64
00134 #define KARCH_ENV_WIN 1
00135 #define KARCH_ENV_WIN32 _WIN32
00136 #if defined(_WINNT)
00137 #define KARCH_ENV_WINNT _WINNT
00138 #endif
00139 #define _WIN32_WINNT 0x0501 // for SetThreadIdealProcessor,TryEnterCriticalSection that does not work on windows 95/98
00140 #define WINVER 0x0501
00141
00142 #ifndef _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES
00143 #define _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES 1
00144 #endif
00145 #ifndef _CRT_NONSTDC_NO_WARNINGS
00146 #define _CRT_NONSTDC_NO_WARNINGS 1
00147 #endif
00148 #ifndef _CRT_SECURE_NO_WARNINGS
00149 #define _CRT_SECURE_NO_WARNINGS 1
00150 #endif
00151 #ifndef _CRT_SECURE_NO_DEPRECATE
00152 #define _CRT_SECURE_NO_DEPRECATE 1
00153 #endif
00154
00155
00156 #if defined _M_IX86
00157 #pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"")
00158 #elif defined _M_IA64
00159 #pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='ia64' publicKeyToken='6595b64144ccf1df' language='*'\"")
00160 #elif defined _M_X64
00161 #pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"")
00162 #else
00163 #pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
00164 #endif
00165
00166 #if defined(__MINGW32__)
00167 #define KARCH_ENV_MING32 __MINGW32__
00168 #endif
00169 #if defined(__ICL)
00170 #define KARCH_DEV_INTEL __ICL
00171 #endif
00172 #if defined(_MSC_VER)
00173 #define KARCH_DEV_MSC _MSC_VER
00174 #elif defined(__GNUC__)
00175 #define KARCH_DEV_GNUC __GNUC__
00176 #if !defined(KARCH_CPU_IA32)
00177 #if defined(__pentiumiii__)
00178 #define KARCH_CPU_IA32 KARCH_ARCH_PENTIUMIII
00179 #elif defined(__pentiumii__)
00180 #define KARCH_CPU_IA32 KARCH_ARCH_PENTIUMII
00181 #elif defined(__i686__) || defined(__pentiumpro__)
00182 #define KARCH_CPU_IA32 KARCH_ARCH_PENTIUMPRO
00183 #elif defined(__i586__) || defined(__pentium__) || defined(__k6__)
00184 #define KARCH_CPU_IA32 KARCH_ARCH_PENTIUM
00185 #elif defined(__i486__)
00186 #define KARCH_CPU_IA32 KARCH_ARCH_I486
00187 #elif defined(__i386__)
00188 #define KARCH_CPU_IA32 KARCH_ARCH_I386
00189 #else
00190 #define KARCH_CPU_IA32 KARCH_ARCH_I286
00191 #endif
00192 #endif
00193 #if !defined(KARCH_ARCH_IA32)
00194 #define KARCH_ARCH_IA32 KARCH_CPU_IA32
00195 #elif (KARCH_ARCH_IA32 < KARCH_CPU_IA32)
00196 #error "Selected architecture doesn't support selected instruction set"
00197 #endif
00198 #if (KARCH_CPU_IA32 >= KARCH_ARCH_PENTIUMII)
00199 #define KARCH_CPU_IA32_MMX
00200 #endif
00201 #if (KARCH_CPU_IA32 >= KARCH_ARCH_PENTIUMIII)
00202 #define KARCH_CPU_IA32_SIMD
00203 #endif
00204 #else
00205 #error "Compiler not supported"
00206 #endif
00207 #if defined(_M_IX86)
00208 #define KARCH_ARCH_IA32 _M_IX86
00209 #define KARCH_CPU_IA32 KARCH_ARCH_PENTIUMIII // to force a minimum of PENTIUM II
00210 #if !defined(KARCH_CPU_IA32)
00211 #if (KARCH_ARCH_IA32 >= KARCH_ARCH_PENTIUM)
00212 #define KARCH_CPU_IA32 KARCH_ARCH_PENTIUM
00213 #else
00214 #define KARCH_CPU_IA32 KARCH_ARCH_IA32
00215 #endif
00216 #endif
00217 #if (KARCH_CPU_IA32 >= KARCH_ARCH_PENTIUMII)
00218 #define KARCH_CPU_IA32_MMX
00219 #endif
00220 #if (KARCH_CPU_IA32 >= KARCH_ARCH_PENTIUMIII)
00221 #define KARCH_CPU_IA32_SIMD
00222 #endif
00223 #elif defined(_M_X64)
00224 #define KARCH_ARCH_X64 _M_X64
00225 #define KARCH_CPU_X64 KARCH_ARCH_AMD64
00226 #define KARCH_ENV_WIN64 _WIN64
00227 #define KARCH_ARCH_64 1
00228 #elif defined(_M_IA64)
00229 #define KARCH_ARCH_IA64 _M_IA64
00230 #define KARCH_CPU_IA64 KARCH_ARCH_ITANIUM
00231 #define KARCH_ENV_WIN64 _WIN64
00232 #define KARCH_ARCH_64 1
00233 #else
00234 #error "Architecture not supported"
00235 #endif
00236
00237 #elif defined(__MACH__)
00238
00239 #if defined(__i386__)
00240 #define KARCH_CPU_IA32 KARCH_ARCH_PENTIUM
00241 #define KARCH_ARCH_IA32 KARCH_CPU_IA32
00242 #elif defined(__x86_64__)
00243 #define KARCH_ARCH_X64 _M_X64
00244 #define KARCH_ARCH_64 1
00245 #elif defined(__arm__)
00246 #define KARCH_ARCH_ARM
00247 #define KARCH_CPU_ARM
00248 #define K_REQUIRE_DATA_ALIGNMENT
00249 #else
00250 #define KARCH_ARCH_POWERPC
00251 #define KARCH_CPU_POWERPC
00252 #endif
00253
00254 #define KARCH_DEV_MACOSX
00255 #define KARCH_DEV_GNUC_MACOSX
00256 #define KARCH_ENV_MACOSX
00257 #define KARCH_DEV_GNUC __GNUC__
00258 #define KARCH_ENV_UNIX 1
00259 #define KARCH_ENV_POSIX 1
00260
00261 #else //////////////////////////////////////////////// GENERIC
00262 #error "Environment not supported"
00263 #endif
00264
00265 #endif