Simple Application Framework  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Saf/Platform.h
Go to the documentation of this file.
00001 /*
00002     This file is part of Simple Application Framework (Saf) library.
00003     Copyright (C) 2010 - 2012 Ondrej Danek <ondrej.danek@gmail.com>
00004 
00005     This library is free software: you can redistribute it and/or modify
00006     it under the terms of the GNU General Public License as published 
00007     by the Free Software Foundation, either version 3 of the License, or
00008     (at your option) any later version.
00009 
00010     Saf 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 Simple Application Framework library. If not, 
00017     see <http://www.gnu.org/licenses/>.
00018 */
00019 
00028 #ifndef SAF_PLATFORM_H
00029 #define SAF_PLATFORM_H
00030 
00031 #ifndef __cplusplus
00032     #error "C++ compiler required."
00033 #endif
00034 
00035 #define SAF_PLATFORM_UNSUPPORTED
00036 
00037 // Windows and Microsoft compiler
00038 #ifdef _MSC_VER
00039     #define SAF_PLATFORM_COMPILER_MSC
00040     #undef SAF_PLATFORM_UNSUPPORTED
00041     #define SAF_PLATFORM_OS_WIN
00042 
00043     #ifdef _M_X64
00044         #define SAF_PLATFORM_ARCH_X64
00045     #else
00046         #define SAF_PLATFORM_ARCH_X32
00047     #endif
00048 #endif
00049 
00050 // Linux and GCC compiler
00051 #ifdef __GNUC__
00052     #define SAF_PLATFORM_COMPILER_GCC
00053 
00054     #if defined(__linux)
00055         #undef SAF_PLATFORM_UNSUPPORTED
00056         #define SAF_PLATFORM_OS_LINUX
00057     #elif defined(__APPLE__)
00058         #undef SAF_PLATFORM_UNSUPPORTED
00059         #define SAF_PLATFORM_OS_MAC
00060     #endif
00061 
00062     #ifdef __x86_64__
00063         #define SAF_PLATFORM_ARCH_X64
00064     #else
00065         #define SAF_PLATFORM_ARCH_X32
00066     #endif
00067 #endif
00068 
00069 // 64bit architecture detection
00070 #ifdef SAF_PLATFORM_UNSUPPORTED
00071     #error "Unsupported platform. Check if your OS, compiler and CPU architecture is supported by the library."
00072 #endif
00073 
00074 #endif
00075