arch.h

Go to the documentation of this file.
00001 
00004 #ifndef FBXFILESDK_COMPONENTS_KBASELIB_KARCH_ARCH_H
00005 #define FBXFILESDK_COMPONENTS_KBASELIB_KARCH_ARCH_H
00006 
00007 /**************************************************************************************
00008 
00009  Copyright (C) 2001 - 2009 Autodesk, Inc. and/or its licensors.
00010  All Rights Reserved.
00011 
00012  The coded instructions, statements, computer programs, and/or related material 
00013  (collectively the "Data") in these files contain unpublished information 
00014  proprietary to Autodesk, Inc. and/or its licensors, which is protected by 
00015  Canada and United States of America federal copyright law and by international 
00016  treaties. 
00017  
00018  The Data may not be disclosed or distributed to third parties, in whole or in
00019  part, without the prior written consent of Autodesk, Inc. ("Autodesk").
00020 
00021  THE DATA IS PROVIDED "AS IS" AND WITHOUT WARRANTY.
00022  ALL WARRANTIES ARE EXPRESSLY EXCLUDED AND DISCLAIMED. AUTODESK MAKES NO
00023  WARRANTY OF ANY KIND WITH RESPECT TO THE DATA, EXPRESS, IMPLIED OR ARISING
00024  BY CUSTOM OR TRADE USAGE, AND DISCLAIMS ANY IMPLIED WARRANTIES OF TITLE, 
00025  NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE OR USE. 
00026  WITHOUT LIMITING THE FOREGOING, AUTODESK DOES NOT WARRANT THAT THE OPERATION
00027  OF THE DATA WILL BE UNINTERRUPTED OR ERROR FREE. 
00028  
00029  IN NO EVENT SHALL AUTODESK, ITS AFFILIATES, PARENT COMPANIES, LICENSORS
00030  OR SUPPLIERS ("AUTODESK GROUP") BE LIABLE FOR ANY LOSSES, DAMAGES OR EXPENSES
00031  OF ANY KIND (INCLUDING WITHOUT LIMITATION PUNITIVE OR MULTIPLE DAMAGES OR OTHER
00032  SPECIAL, DIRECT, INDIRECT, EXEMPLARY, INCIDENTAL, LOSS OF PROFITS, REVENUE
00033  OR DATA, COST OF COVER OR CONSEQUENTIAL LOSSES OR DAMAGES OF ANY KIND),
00034  HOWEVER CAUSED, AND REGARDLESS OF THE THEORY OF LIABILITY, WHETHER DERIVED
00035  FROM CONTRACT, TORT (INCLUDING, BUT NOT LIMITED TO, NEGLIGENCE), OR OTHERWISE,
00036  ARISING OUT OF OR RELATING TO THE DATA OR ITS USE OR ANY OTHER PERFORMANCE,
00037  WHETHER OR NOT AUTODESK HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH LOSS
00038  OR DAMAGE. 
00039 
00040 **************************************************************************************/
00041 
00042 /*
00043  *  Intel IA32 Architecture
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  *  AMD x64 Architecture
00056  */
00057 #define KARCH_ARCH_AMD64_GENERIC    800
00058 
00059 /*
00060  *  Intel IA64 Architecture
00061  */
00062 #define KARCH_ARCH_ITANIUM          1000
00063 
00064 
00065 #if defined(linux) || defined(__CYGWIN32__) 
00066     #define KARCH_DEV_GNUC          __GNUC__
00067     #define KARCH_ENV_POSIX         1
00068 
00069     #if defined(linux)
00070         #define KARCH_ENV_LINUX         1
00071     #endif
00072 
00073     #if defined(__GNUC__)
00074         #ifndef _GNU_SOURCE
00075         #define _GNU_SOURCE
00076         #endif
00077         #define KARCH_DEV_GNUC          __GNUC__
00078 
00079         // CPU Determination.
00080         #if defined(__ia64__) && !defined(KARCH_CPU_IA64)
00081             #define KARCH_CPU_IA64      KARCH_ARCH_ITANIUM
00082         #elif defined(__x86_64) && !defined(KARCH_CPU_AMD64)
00083             #define KARCH_CPU_AMD64     KARCH_ARCH_AMD64_GENERIC
00084         #elif !defined(KARCH_CPU_IA32)
00085             #if defined(__pentiumiii__)
00086                 #define KARCH_CPU_IA32      KARCH_ARCH_PENTIUMIII
00087             #elif defined(__pentiumii__)
00088                 #define KARCH_CPU_IA32      KARCH_ARCH_PENTIUMII
00089             #elif defined(__i686__) || defined(__pentiumpro__)
00090                 #define KARCH_CPU_IA32      KARCH_ARCH_PENTIUMPRO
00091             #elif defined(__i586__) || defined(__pentium__) || defined(__k6__)
00092                 #define KARCH_CPU_IA32      KARCH_ARCH_PENTIUM
00093             #elif defined(__i486__)
00094                 #define KARCH_CPU_IA32      KARCH_ARCH_I486
00095             #elif defined(__i386__)
00096                 #define KARCH_CPU_IA32      KARCH_ARCH_I386
00097             #else
00098                 #define KARCH_CPU_IA32      KARCH_ARCH_I286
00099             #endif
00100         #endif
00101 
00102         // ARCH Determination.
00103         #if defined(KARCH_CPU_IA64)
00104             #define KARCH_ARCH_IA64         KARCH_CPU_IA64
00105             #define KARCH_ARCH_64           1
00106         #elif defined(KARCH_CPU_AMD64)
00107             #define KARCH_ARCH_AMD64        KARCH_CPU_AMD64
00108             #define KARCH_ARCH_64           1
00109         #elif defined(KARCH_CPU_IA32)
00110             #define KARCH_ARCH_IA32         KARCH_CPU_IA32
00111             
00112             #if (KARCH_CPU_IA32 >= KARCH_ARCH_PENTIUMII)
00113                 #define KARCH_CPU_IA32_MMX
00114             #endif
00115             #if (KARCH_CPU_IA32 >= KARCH_ARCH_PENTIUMIII)
00116                 #define KARCH_CPU_IA32_SIMD
00117             #endif
00118         #endif
00119     #else
00120         #error "Compiler not supported"
00121     #endif
00122 #elif defined(_XBOX)
00123     #define KARCH_ENV_WIN               1
00124     #define KARCH_ENV_WIN32             _WIN32
00125     #define KARCH_ENV_XBOX              _XBOX
00126     #define KARCH_DEV_MSC               _MSC_VER
00127     #define KARCH_ARCH_IA32             _M_IX86 
00128     #define KARCH_CPU_IA32              KARCH_ARCH_PENTIUM  
00129     //#define KARCH_CPU_IA32_MMX
00130     //#define KARCH_CPU_IA32_SIMD
00131 
00132 #elif defined(_WIN32) || defined(_WIN64) 
00133     #define KARCH_ENV_WIN               1
00134     #ifdef KARCH_ENV_WIN32
00135     #undef KARCH_ENV_WIN32
00136     #endif
00137     #define KARCH_ENV_WIN32             _WIN32
00138     #if defined(_WINNT)
00139         #define KARCH_ENV_WINNT         _WINNT
00140     #endif
00141 
00142     #if defined(__MINGW32__)
00143         #define KARCH_ENV_MING32    __MINGW32__
00144     #endif
00145     #if defined(__ICL)
00146         #define KARCH_DEV_INTEL     __ICL
00147     #endif
00148     #if defined(_MSC_VER)
00149         #define KARCH_DEV_MSC       _MSC_VER
00150     #elif defined(__GNUC__)
00151         #define KARCH_DEV_GNUC          __GNUC__
00152         #if !defined(KARCH_CPU_IA32)
00153             #if defined(__pentiumiii__)
00154                 #define KARCH_CPU_IA32      KARCH_ARCH_PENTIUMIII
00155             #elif defined(__pentiumii__)
00156                 #define KARCH_CPU_IA32      KARCH_ARCH_PENTIUMII
00157             #elif defined(__i686__) || defined(__pentiumpro__)
00158                 #define KARCH_CPU_IA32      KARCH_ARCH_PENTIUMPRO
00159             #elif defined(__i586__) || defined(__pentium__) || defined(__k6__)
00160                 #define KARCH_CPU_IA32      KARCH_ARCH_PENTIUM
00161             #elif defined(__i486__)
00162                 #define KARCH_CPU_IA32      KARCH_ARCH_I486
00163             #elif defined(__i386__)
00164                 #define KARCH_CPU_IA32      KARCH_ARCH_I386
00165             #else
00166                 #define KARCH_CPU_IA32      KARCH_ARCH_I286
00167             #endif
00168         #endif
00169         #if !defined(KARCH_ARCH_IA32)
00170             #define KARCH_ARCH_IA32         KARCH_CPU_IA32
00171         #elif (KARCH_ARCH_IA32 < KARCH_CPU_IA32)
00172             #error "Selected architecture doesn't support selected instruction set"
00173         #endif
00174         #if (KARCH_CPU_IA32 >= KARCH_ARCH_PENTIUMII)
00175             #define KARCH_CPU_IA32_MMX
00176         #endif
00177         #if (KARCH_CPU_IA32 >= KARCH_ARCH_PENTIUMIII)
00178             #define KARCH_CPU_IA32_SIMD
00179         #endif
00180     #else
00181         #error "Compiler not supported"
00182     #endif
00183     #if defined(_M_IX86)
00184         #define KARCH_ARCH_IA32         _M_IX86
00185         #define KARCH_CPU_IA32          KARCH_ARCH_PENTIUMIII // to force a minimum of PENTIUM II
00186         #if !defined(KARCH_CPU_IA32)
00187             #if (KARCH_ARCH_IA32 >= KARCH_ARCH_PENTIUM)
00188                 #define KARCH_CPU_IA32  KARCH_ARCH_PENTIUM
00189             #else
00190                 #define KARCH_CPU_IA32  KARCH_ARCH_IA32
00191             #endif
00192         #endif
00193         #if (KARCH_CPU_IA32 >= KARCH_ARCH_PENTIUMII)
00194             #define KARCH_CPU_IA32_MMX
00195         #endif
00196         #if (KARCH_CPU_IA32 >= KARCH_ARCH_PENTIUMIII)
00197             #define KARCH_CPU_IA32_SIMD
00198         #endif
00199     #elif defined(_M_X64)
00200         #define KARCH_ARCH_X64          _M_X64
00201         #define KARCH_CPU_X64           KARCH_ARCH_AMD64
00202         #define KARCH_ENV_WIN64         _WIN64
00203         #define KARCH_ARCH_64           1
00204     #elif defined(_M_IA64)
00205         #define KARCH_ARCH_IA64         _M_IA64
00206         #define KARCH_CPU_IA64          KARCH_ARCH_ITANIUM
00207         #define KARCH_ENV_WIN64         _WIN64
00208         #define KARCH_ARCH_64       1
00209     #else
00210         #error "Architecture not supported"
00211     #endif
00212 
00213 #elif defined(__MACH__)
00214     #if __LP64__ && !defined(__x86_64__)
00215         #define __x86_64__
00216     #endif
00217     #if defined(__i386__)
00218         #define KARCH_CPU_IA32      KARCH_ARCH_PENTIUM
00219         #define KARCH_ARCH_IA32     KARCH_CPU_IA32
00220     #elif defined(__x86_64__)
00221         #define KARCH_ARCH_X64      _M_X64
00222         #define KARCH_ARCH_64       1
00223     #else
00224         #define KARCH_ARCH_POWERPC
00225         #define KARCH_CPU_POWERPC
00226     #endif
00227     
00228     #define KARCH_DEV_MACOSX
00229     #define KARCH_DEV_GNUC_MACOSX
00230     #define KARCH_ENV_MACOSX
00231     #define KARCH_DEV_GNUC          __GNUC__
00232     #define KARCH_ENV_POSIX         1
00233 
00234 #else   
00235     #error "Environment not supported"
00236 #endif
00237 
00238 #endif // FBXFILESDK_COMPONENTS_KBASELIB_KARCH_ARCH_H
00239