/*
 *   ORXONOX - the hottest 3D action shooter ever to exist
 *                    > www.orxonox.net <
 *
 *
 *   License notice:
 *
 *   This program is free software; you can redistribute it and/or
 *   modify it under the terms of the GNU General Public License
 *   as published by the Free Software Foundation; either version 2
 *   of the License, or (at your option) any later version.
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with this program; if not, write to the Free Software
 *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 *
 *   Author:
 *      Reto Grieder
 *   Co-authors:
 *      ...
 *
 *   Original code: OgrePlatform.h, licensed under the LGPL. The code
 *   has changed almost completely though.
 *
 *   Caution: Do not configure this file CMake configuration (Debug, Release, etc.)
 *            dependent! XCode and Visual Studio have the same file for all.
 *
 */

/**
 @file
 @brief
    Various constants for compiler, architecture and platform.

    @GENERATED_FILE_COMMENT@
 */

#ifndef _OrxonoxConfig_H__
#define _OrxonoxConfig_H__

/*---------------------------------
 * Platform and compiler related options
 *-------------------------------*/
#cmakedefine ORXONOX_PLATFORM_WINDOWS
#cmakedefine ORXONOX_PLATFORM_LINUX
#cmakedefine ORXONOX_PLATFORM_APPLE
#cmakedefine ORXONOX_PLATFORM_UNIX /* Apple and Linux */

/* Determine compiler and set ORXONOX_COMP_VER */
#if defined( _MSC_VER )
#  define ORXONOX_COMPILER_MSVC
#  define ORXONOX_COMP_VER _MSC_VER

#elif defined( __GNUC__ )
#  define ORXONOX_COMPILER_GCC
#  define ORXONOX_COMP_VER (((__GNUC__)*100) + \
        (__GNUC_MINOR__*10) + \
        __GNUC_PATCHLEVEL__)
#  if defined(__MINGW32__)
#    define ORXONOX_COMPILER_MINGW
#  endif

#elif defined( __BORLANDC__ )
#  define ORXONOX_COMPILER_BORLAND
#  define ORXONOX_COMP_VER __BCPLUSPLUS__

#else
#  pragma error "No known compiler. Abort!"

#endif

/* Endianness */
#cmakedefine ORXONOX_BIG_ENDIAN
#cmakedefine ORXONOX_LITTLE_ENDIAN

/* Architecture */
#cmakedefine ORXONOX_ARCH_32
#cmakedefine ORXONOX_ARCH_64

/* See if we can use __forceinline or if we need to use __inline instead */
#cmakedefine HAVE_FORCEINLINE
#ifndef FORCEINLINE
#  ifdef HAVE_FORCEINLINE
#    define FORCEINLINE __forceinline
#  else
#    define FORCEINLINE __inline
#  endif
#endif

/* Try to define function information */
#ifndef __FUNCTIONNAME__
#  ifdef ORXONOX_COMPILER_BORLAND
#    define __FUNCTIONNAME__ __FUNC__
#  elif defined(ORXONOX_COMPILER_GCC)
#    define __FUNCTIONNAME__ __PRETTY_FUNCTION__
#  elif defined(ORXONOX_COMPILER_MSVC)
#    define __FUNCTIONNAME__ __FUNCTION__
#  else
#    define __FUNCTIONNAME__
#  endif
#endif


/*---------------------------------
 * Version information
 *-------------------------------*/
#define ORXONOX_VERSION_MAJOR @ORXONOX_VERSION_MAJOR@
#define ORXONOX_VERSION_MINOR @ORXONOX_VERSION_MINOR@
#define ORXONOX_VERSION_PATCH @ORXONOX_VERSION_PATCH@
#define ORXONOX_VERSION_NAME "@ORXONOX_VERSION_NAME@"

#define ORXONOX_VERSION ((ORXONOX_VERSION_MAJOR << 16) | (ORXONOX_VERSION_MINOR << 8) | ORXONOX_VERSION_PATCH)


/*---------------------------------
 * Unix settings
 *-------------------------------*/
#ifdef ORXONOX_PLATFORM_UNIX

/* TODO: Check what this actually is and whether we need it or not */
#if 0
#  ifdef ORXONOX_PLATFORM_APPLE
#    define ORXONOX_PLATFORM_LIB "OrxonoxPlatform.bundle"
#  else
/* ORXONOX_PLATFORM_LINUX */
#    define ORXONOX_PLATFORM_LIB "libOrxonoxPlatform.so"
#  endif
#endif

#endif /* Patform Unix */


/*---------------------------------
 * Apple Settings
 *-------------------------------*/


/*---------------------------------
 * Includes
 *-------------------------------*/
/* Define the english written operators like and, or, xor
 * This is C++ standard, but the Microsoft compiler doesn't define them. */
#cmakedefine HAVE_ISO646_H
#ifdef HAVE_ISO646_H
#  include <iso646.h>
#endif

#cmakedefine HAVE_STDINT_H
#ifdef HAVE_STDINT_H
#  include <stdint.h>
#elif defined(ORXONOX_COMPILER_MSVC)
typedef __int8            int8_t;
typedef __int16           int16_t;
typedef __int32           int32_t;
typedef __int64           int64_t;
typedef unsigned __int8   uint8_t;
typedef unsigned __int16  uint16_t;
typedef unsigned __int32  uint32_t;
typedef unsigned __int64  uint64_t;
#endif

#cmakedefine HAVE_STDDEF_H
/* Quite large, do not include unless necessary
#ifdef HAVE_STDDEF_H
#  include <stddef.h>
#endif
*/

/* Visual Leak Detector looks for memory leaks */
#cmakedefine VISUAL_LEAK_DETECTOR_ENABLE
#ifdef VISUAL_LEAK_DETECTOR_ENABLE
#  include <vld.h>
#endif

#endif /* _OrxonoxConfig_H__ */
