platform.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2008 by Kutumov Alexey                                  *
00003  *   ru.pixel@gmail.com                                                    *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License as published by  *
00007  *   the Free Software Foundation; either version 2 of the License, or     *
00008  *   (at your option) any later version.                                   *
00009  *                                                                         *
00010  *   This program is distributed in the hope that it will be useful,       *
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00013  *   GNU General Public License for more details.                          *
00014  *                                                                         *
00015  *   You should have received a copy of the GNU General Public License     *
00016  *   along with this program; if not, write to the                         *
00017  *   Free Software Foundation, Inc.,                                       *
00018  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00019  ***************************************************************************/
00020 
00039 #ifndef __platform__header__
00040 #define __platform__header__
00041 
00042 namespace gpucalc
00043 {
00044 
00045 #define PLATFORM_WIN32  1
00046 #define PLATFORM_LINUX  2
00047 #define PLATFORM_APPLE  3
00048 
00049 #define COMPILER_MSVC  1
00050 #define COMPILER_GNUC  2
00051 #define COMPILER_BORL  3
00052 
00053 #define ENDIAN_LITTLE  1
00054 #define ENDIAN_BIG   2
00055 
00056 #define ARCHITECTURE_32  1
00057 #define ARCHITECTURE_64  2
00058 
00059 
00060 //define compiler and its version
00061 #if defined( _MSC_VER )
00062 #   define COMPILER COMPILER_MSVC
00063 #   define COMP_VER _MSC_VER
00064 
00065 #elif defined( __GNUC__ )
00066 #   define COMPILER COMPILER_GNUC
00067 #   define COMP_VER (((__GNUC__)*100) + \
00068  (__GNUC_MINOR__*10) + \
00069  __GNUC_PATCHLEVEL__)
00070 
00071 #elif defined( __BORLANDC__ )
00072 #   define COMPILER COMPILER_BORL
00073 #   define COMP_VER __BCPLUSPLUS__
00074 
00075 #else
00076 #   pragma error "No known compiler. Abort! Abort!"
00077 
00078 #endif
00079 
00080 
00081 //define platform
00082 #if defined( __WIN32__ ) || defined( _WIN32 )
00083 #   define PLATFORM PLATFORM_WIN32
00084 
00085 #elif defined( __APPLE_CC__)
00086 #   define PLATFORM PLATFORM_APPLE
00087 
00088 #else
00089 #   define PLATFORM PLATFORM_LINUX
00090 #endif
00091 
00092 
00093 
00094 //define FORCEINLINE directive
00095 #if COMPILER == COMPILER_MSVC
00096 #   if COMP_VER >= 1200
00097 #       define FORCEINLINE __forceinline
00098 #   endif
00099 #elif defined(__MINGW32__)
00100 #   if !defined(FORCEINLINE)
00101 #       define FORCEINLINE __inline
00102 #   endif
00103 #else
00104 #   define FORCEINLINE __inline
00105 #endif
00106 
00107 
00108 
00109 
00110 //define current architecture
00111 #if defined(__x86_64__) || defined(_M_X64) || defined(__powerpc64__) || defined(__alpha__) || defined(__ia64__) || defined(__s390__) || defined(__s390x__)
00112 #   define ARCH_TYPE ARCHITECTURE_64
00113 #else
00114 #   define ARCH_TYPE ARCHITECTURE_32
00115 #endif
00116 
00117 
00118 
00119 #if PLATFORM == PLATFORM_WIN32
00120 
00121 # if defined (STATIC_LIB)
00122 #  define _GpuCalcExport
00123 #  define _GpuCalcPrivate
00124 # else
00125 #  if defined( NONCLIENT_BUILD )
00126 #        define _GpuCalcExport __declspec( dllexport )
00127 #    else
00128 #   if defined( __MINGW32__ )
00129 #    define _GpuCalcExport
00130 #   else
00131 #    define _GpuCalcExport __declspec( dllimport )
00132 #           endif
00133 #    endif
00134 #  define _GpuCalcPrivate
00135 # endif
00136 #endif
00137 
00138 
00139 #if PLATFORM == PLATFORM_LINUX || PLATFORM == PLATFORM_APPLE
00140 
00141 // Enable GCC symbol visibility
00142 # if defined( GCC_VISIBILITY )
00143 #  define _GpuCalcExport  __attribute__ ((visibility("default")))
00144 #  define _GpuCalcPrivate __attribute__ ((visibility("hidden")))
00145 # else
00146 #  define _GpuCalcExport
00147 #  define _GpuCalcPrivate
00148 # endif
00149 #endif
00150 
00151 }
00152 
00153 #endif

Generated on Thu Mar 5 22:36:42 2009 for gpucalc by  doxygen 1.5.6