First
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
tags
|
||||
cscope.out
|
||||
**/*.swp
|
||||
**/*.swo
|
||||
.swp
|
||||
*.swp
|
||||
.swo
|
||||
.TMP
|
||||
-.d
|
||||
eastl_build_out
|
||||
build_bench
|
||||
bench.bat
|
||||
build.bat
|
||||
.p4config
|
||||
|
||||
## CMake generated files
|
||||
CMakeCache.txt
|
||||
cmake_install.cmake
|
||||
|
||||
## Patch files
|
||||
*.patch
|
||||
|
||||
## For Visual Studio Generated projects
|
||||
*.sln
|
||||
**/*.vcxproj
|
||||
**/*.vcxproj.filters
|
||||
*.VC.opendb
|
||||
*.sdf
|
||||
**/*.suo
|
||||
**/*.user
|
||||
.vs/*
|
||||
**/Debug/*
|
||||
CMakeFiles/*
|
||||
EASTL.dir/**
|
||||
RelWithDebInfo/*
|
||||
Release/*
|
||||
Win32/*
|
||||
x64/*
|
||||
MinSizeRel/*
|
||||
build*/*
|
||||
Testing/*
|
||||
%ALLUSERSPROFILE%/*
|
||||
|
||||
# Buck
|
||||
/buck-out/
|
||||
/.buckd/
|
||||
/buckaroo/
|
||||
.buckconfig.local
|
||||
BUCKAROO_DEPS
|
||||
@@ -0,0 +1,18 @@
|
||||
[submodule "test/packages/EAMain"]
|
||||
path = test/packages/EAMain
|
||||
url = git@github.com:electronicarts/EAMain.git
|
||||
[submodule "test/packages/EATest"]
|
||||
path = test/packages/EATest
|
||||
url = git@github.com:electronicarts/EATest.git
|
||||
[submodule "test/packages/EAStdC"]
|
||||
path = test/packages/EAStdC
|
||||
url = git@github.com:electronicarts/EAStdC.git
|
||||
[submodule "test/packages/EAAssert"]
|
||||
path = test/packages/EAAssert
|
||||
url = git@github.com:electronicarts/EAAssert.git
|
||||
[submodule "test/packages/EAThread"]
|
||||
path = test/packages/EAThread
|
||||
url = git@github.com:electronicarts/EAThread.git
|
||||
[submodule "test/packages/EASTL"]
|
||||
path = test/packages/EASTL
|
||||
url = git@github.com:electronicarts/EASTL.git
|
||||
@@ -0,0 +1,4 @@
|
||||
tags
|
||||
|
||||
.p4config
|
||||
/.git/
|
||||
@@ -0,0 +1,68 @@
|
||||
language: cpp
|
||||
|
||||
os:
|
||||
- linux
|
||||
- osx
|
||||
- windows
|
||||
|
||||
compiler:
|
||||
- gcc
|
||||
- clang
|
||||
- msvc
|
||||
|
||||
env:
|
||||
- EA_CONFIG=Debug
|
||||
- EA_CONFIG=Release
|
||||
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
- george-edison55-precise-backports
|
||||
- llvm-toolchain-trusty-7
|
||||
packages:
|
||||
- cmake
|
||||
- cmake-data
|
||||
- g++-7
|
||||
- clang-7
|
||||
|
||||
matrix:
|
||||
exclude:
|
||||
- os: osx
|
||||
compiler: gcc
|
||||
- os: osx
|
||||
compiler: msvc
|
||||
- os: linux
|
||||
compiler: msvc
|
||||
- os: windows
|
||||
compiler: clang
|
||||
- os: windows
|
||||
compiler: gcc
|
||||
|
||||
# Handle git submodules yourself
|
||||
git:
|
||||
submodules: false
|
||||
|
||||
# Use sed to replace the SSH URL with the public URL, then initialize submodules
|
||||
before_install:
|
||||
- sed --version >/dev/null 2>&1 && sed -i 's/git@github.com:/https:\/\/github.com\//' .gitmodules || sed -i "" 's/git@github.com:/https:\/\/github.com\//' .gitmodules
|
||||
- git submodule update --init
|
||||
|
||||
install:
|
||||
- if [[ "$CXX" == "g++" ]]; then export CC="gcc-7" ;fi
|
||||
- if [[ "$CXX" == "g++" ]]; then export CXX="g++-7" ;fi
|
||||
- if [[ "$CXX" == "clang++" && "${TRAVIS_OS_NAME}" != "osx" ]]; then export CC="clang-7" ;fi
|
||||
- if [[ "$CXX" == "clang++" && "${TRAVIS_OS_NAME}" != "osx" ]]; then export CXX="clang++-7" ;fi
|
||||
|
||||
# Universal Setup
|
||||
before_script:
|
||||
- mkdir build_$EA_CONFIG
|
||||
- cd build_$EA_CONFIG
|
||||
- cmake .. -DEABASE_BUILD_TESTS:BOOL=ON
|
||||
- cmake --build . --config $EA_CONFIG
|
||||
|
||||
script:
|
||||
# Run Tests
|
||||
- cd $TRAVIS_BUILD_DIR/build_$EA_CONFIG/test
|
||||
- ctest -C $EA_CONFIG -V || exit 1
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
#-------------------------------------------------------------------------------------------
|
||||
# Copyright (C) Electronic Arts Inc. All rights reserved.
|
||||
#-------------------------------------------------------------------------------------------
|
||||
cmake_minimum_required(VERSION 3.1)
|
||||
project(EABase CXX)
|
||||
|
||||
#-------------------------------------------------------------------------------------------
|
||||
# Options
|
||||
#-------------------------------------------------------------------------------------------
|
||||
option(EABASE_BUILD_TESTS "Enable generation of build files for tests" OFF)
|
||||
|
||||
#-------------------------------------------------------------------------------------------
|
||||
# Package Tests
|
||||
#-------------------------------------------------------------------------------------------
|
||||
if(EABASE_BUILD_TESTS)
|
||||
add_subdirectory(test)
|
||||
endif()
|
||||
|
||||
#-------------------------------------------------------------------------------------------
|
||||
# Defines
|
||||
#-------------------------------------------------------------------------------------------
|
||||
add_definitions(-D_CHAR16T)
|
||||
|
||||
#-------------------------------------------------------------------------------------------
|
||||
# Header only library
|
||||
#-------------------------------------------------------------------------------------------
|
||||
add_library(EABase INTERFACE)
|
||||
|
||||
#-------------------------------------------------------------------------------------------
|
||||
# Include dirs
|
||||
#-------------------------------------------------------------------------------------------
|
||||
target_include_directories(EABase INTERFACE include/Common)
|
||||
@@ -0,0 +1,73 @@
|
||||
## Contributing
|
||||
|
||||
Before you can contribute, EA must have a Contributor License Agreement (CLA) on file that has been signed by each contributor.
|
||||
You can sign here: [Go to CLA](https://electronicarts.na1.echosign.com/public/esignWidget?wid=CBFCIBAA3AAABLblqZhByHRvZqmltGtliuExmuV-WNzlaJGPhbSRg2ufuPsM3P0QmILZjLpkGslg24-UJtek*)
|
||||
|
||||
### Pull Request Policy
|
||||
|
||||
All code contributions are submitted as [Github pull requests](https://help.github.com/articles/using-pull-requests/). All pull requests will be reviewed by a maintainer according to the guidelines found in the next section.
|
||||
|
||||
Your pull request should:
|
||||
|
||||
* merge cleanly
|
||||
* come with tests
|
||||
* tests should be minimal and stable
|
||||
* fail before your fix is applied
|
||||
* pass the test suite
|
||||
* code formatting is encoded in clang format
|
||||
* limit using clang format on new code
|
||||
* do not deviate from style already established in the files
|
||||
|
||||
|
||||
### Running the Unit Tests
|
||||
|
||||
EAAssert uses CMake as its build system.
|
||||
|
||||
* Create and navigate to "your_build_folder":
|
||||
* mkdir your_build_folder && cd your_build_folder
|
||||
* Generate build scripts:
|
||||
* cmake source_folder -DEABASE_BUILD_TESTS:BOOL=ON
|
||||
* Build unit tests for "your_config":
|
||||
* cmake --build . --config your_config
|
||||
* Run the unit tests for "your_config" from the test folder:
|
||||
* cd test && ctest -C your_config
|
||||
|
||||
|
||||
Here is an example batch file.
|
||||
```batch
|
||||
set build_folder=out
|
||||
mkdir %build_folder%
|
||||
pushd %build_folder%
|
||||
call cmake .. -DEABASE_BUILD_TESTS:BOOL=ON
|
||||
call cmake --build . --config Release
|
||||
call cmake --build . --config Debug
|
||||
call cmake --build . --config RelWithDebInfo
|
||||
call cmake --build . --config MinSizeRel
|
||||
pushd test
|
||||
call ctest -C Release
|
||||
call ctest -C Debug
|
||||
call ctest -C RelWithDebInfo
|
||||
call ctest -C MinSizeRel
|
||||
popd
|
||||
popd
|
||||
```
|
||||
|
||||
Here is an example bash file
|
||||
```bash
|
||||
build_folder=out
|
||||
mkdir $build_folder
|
||||
pushd $build_folder
|
||||
cmake .. -DEABASE_BUILD_TESTS:BOOL=ON
|
||||
cmake --build . --config Release
|
||||
cmake --build . --config Debug
|
||||
cmake --build . --config RelWithDebInfo
|
||||
cmake --build . --config MinSizeRel
|
||||
pushd test
|
||||
ctest -C Release
|
||||
ctest -C Debug
|
||||
ctest -C RelWithDebInfo
|
||||
ctest -C MinSizeRel
|
||||
popd
|
||||
popd
|
||||
```
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
Copyright (C) 2017 Electronic Arts Inc. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
3. Neither the name of Electronic Arts, Inc. ("EA") nor the names of
|
||||
its contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY ELECTRONIC ARTS AND ITS CONTRIBUTORS "AS IS" AND ANY
|
||||
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL ELECTRONIC ARTS OR ITS CONTRIBUTORS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
@@ -0,0 +1,26 @@
|
||||
# EABase
|
||||
|
||||
[](https://travis-ci.org/electronicarts/EABase)
|
||||
|
||||
EABase is a small set of header files that define platform-independent data types and macros.
|
||||
|
||||
|
||||
## Documentation
|
||||
|
||||
Please see [Introduction](doc/EABase.html).
|
||||
|
||||
|
||||
## Compiling sources
|
||||
|
||||
Please see [CONTRIBUTING.md](CONTRIBUTING.md) for details on compiling and testing the source.
|
||||
|
||||
|
||||
## Credits
|
||||
|
||||
Roberto Parolin is the current EABase owner within EA and is responsible for the open source repository.
|
||||
|
||||
|
||||
## License
|
||||
|
||||
Modified BSD License (3-Clause BSD license) see the file LICENSE in the project root.
|
||||
|
||||
@@ -0,0 +1,309 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<title>EABase Future Plans</title>
|
||||
<style type="text/css">
|
||||
.SmallBody{
|
||||
font-size: 10pt
|
||||
}
|
||||
|
||||
body
|
||||
{
|
||||
font-family: Palatino Linotype, Book Antiqua, Times New Roman;
|
||||
font-size: 11pt;
|
||||
}
|
||||
|
||||
h1
|
||||
{
|
||||
font-family: Verdana;
|
||||
display: block;
|
||||
background-color: #FFF0B0;
|
||||
border: solid 2px black;
|
||||
font-size: 16pt;
|
||||
font-weight: bold;
|
||||
padding: 6px;
|
||||
}
|
||||
|
||||
h2
|
||||
{
|
||||
font-size: 14pt;
|
||||
font-family: Verdana;
|
||||
border-bottom: 2px solid black;
|
||||
}
|
||||
|
||||
h3
|
||||
{
|
||||
font-family: Verdana;
|
||||
font-size: 13pt;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.code-example
|
||||
{
|
||||
display: block;
|
||||
background-color: #e0e0f0;
|
||||
margin-left: 3em;
|
||||
margin-right: 3em;
|
||||
margin-top: 1em;
|
||||
margin-bottom: 1em;
|
||||
padding: 8px;
|
||||
border: solid 2px #a0a0d0;
|
||||
font-family: monospace;
|
||||
font-size: 10pt;
|
||||
white-space: pre;
|
||||
}
|
||||
|
||||
.code-example-span
|
||||
{
|
||||
font-family: monospace;
|
||||
font-size: 10pt;
|
||||
white-space: pre;
|
||||
}
|
||||
|
||||
.code-example-comment
|
||||
{
|
||||
background-color: #e0e0f0;
|
||||
padding: 0px 0px;
|
||||
font-family: monospace;
|
||||
font-size: 10pt;
|
||||
white-space: pre;
|
||||
color: #999999;
|
||||
margin: auto auto;
|
||||
}
|
||||
|
||||
|
||||
.faq-question
|
||||
{
|
||||
background-color: #D0E0D0;
|
||||
font-size: 12pt;
|
||||
font-weight: bold;
|
||||
margin-bottom: 0.5em;
|
||||
margin-top: 0em;
|
||||
padding-left:8px;
|
||||
padding-right:8px;
|
||||
padding-top:2px;
|
||||
padding-bottom:2px
|
||||
}
|
||||
|
||||
.faq-answer
|
||||
{
|
||||
display: block;
|
||||
margin: 4pt 1em 0.5em 1em;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>EABase
|
||||
</h1>
|
||||
<h3>What is EABase?
|
||||
</h3>
|
||||
<p>EABase is a small set of header files that define platform-independent
|
||||
data types and macros. As such it is similar to many projects that have
|
||||
a platform.h, system.h, defines.h, etc. file. The difference is that
|
||||
EABase is very comprehensive and is the annointed Electronic Arts
|
||||
worldwide standard for new projects. </p>
|
||||
<p>With respect to the base types and definitions, many of these are
|
||||
already present in the most recent C language standard, though the C++
|
||||
standard has yet to formally adopt them. EABase bridges the gap and
|
||||
defines these values if they aren't already defined. With respect to
|
||||
compiler and platform definitions, EABase provides a standard reliable
|
||||
means of identifying or specifying compilers, platforms, endian-ness,
|
||||
alignment attributes, etc. </p>
|
||||
<h3>Usage notes </h3>
|
||||
<p>You probably don't want to use float_t and double_t. They are there for C99 compatibility but are rarely what you want to use, since their size is variable.</p>
|
||||
<p>Prid8, etc. are somewhat painful and ugly to use and you may find you don't like them. They too are for C99 compatibility.</p>
|
||||
<p>intptr_t is not a pointer to an int; it's an int with the same size as a pointer, so you can safely store pointers in it.</p>
|
||||
<p>EA::result_type is rarely used and exists for backwards compatibility.</p>
|
||||
<h3>What specifically does EABase define?</h3>
|
||||
<p>Here we list the things EABase defines, grouped by category. These
|
||||
defines are up to date as of the file modification date listed at the
|
||||
top of this file.</p>
|
||||
<h4>Base Types and Definitions<br>
|
||||
|
||||
</h4>
|
||||
|
||||
<div style="margin-left: 40px;">bool8_t, int8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t, int64_t, uint64_t, float_t, double_t, (EAStdC package implements int128_t)<br>
|
||||
|
||||
intptr_t, uintptr_t, intmax_t, uintmax_t, ssize_t<br>
|
||||
|
||||
char8_t, char16_t, char32_t<br>
|
||||
|
||||
INT8_C(), UINT8_C(), etc.<br>
|
||||
|
||||
INT8_MIN, INT8_MAX, UINT8_MAX, etc.<br>
|
||||
|
||||
PRId8, PRId16, PRId32, etc, SCNd8, SCNd16, SCNd32, etc.</div>
|
||||
|
||||
<h4>Result Types and Definitions<br>
|
||||
|
||||
</h4>
|
||||
|
||||
<div style="margin-left: 40px;">EA::result_type<br>
|
||||
|
||||
EA::SUCCESS, EA::FAILURE<br>
|
||||
|
||||
EA_SUCCEEDED(), EA_FAILED()</div>
|
||||
|
||||
<h4>Compiler Definitions<br>
|
||||
|
||||
</h4>
|
||||
|
||||
<div style="margin-left: 40px;">EA_COMPILER_GNUC<br>
|
||||
|
||||
EA_COMPILER_SN<br>
|
||||
|
||||
EA_COMPILER_MSVC<br>
|
||||
|
||||
EA_COMPILER_METROWERKS<br>
|
||||
|
||||
EA_COMPILER_INTEL<br>
|
||||
|
||||
EA_COMPILER_BORLANDC<br>
|
||||
|
||||
<br>
|
||||
|
||||
EA_COMPILER_VERSION = <integer><br>
|
||||
|
||||
EA_COMPILER_NAME = <string><br>
|
||||
|
||||
EA_COMPILER_STRING = <string><br>
|
||||
|
||||
<br>
|
||||
|
||||
EA_COMPILER_NO_STATIC_CONSTANTS<br>
|
||||
|
||||
EA_COMPILER_NO_TEMPLATE_SPECIALIZATION<br>
|
||||
|
||||
EA_COMPILER_NO_TEMPLATE_PARTIAL_SPECIALIZATION<br>
|
||||
|
||||
EA_COMPILER_NO_MEMBER_TEMPLATES<br>
|
||||
|
||||
EA_COMPILER_NO_MEMBER_TEMPLATE_SPECIALIZATION<br>
|
||||
|
||||
EA_COMPILER_NO_TEMPLATE_TEMPLATES<br>
|
||||
|
||||
EA_COMPILER_NO_MEMBER_TEMPLATE_FRIENDS<br>
|
||||
|
||||
EA_COMPILER_NO_VOID_RETURNS<br>
|
||||
|
||||
EA_COMPILER_NO_COVARIANT_RETURN_TYPE<br>
|
||||
|
||||
EA_COMPILER_NO_DEDUCED_TYPENAME<br>
|
||||
|
||||
EA_COMPILER_NO_ARGUMENT_DEPENDENT_LOOKUP<br>
|
||||
|
||||
EA_COMPILER_NO_EXCEPTION_STD_NAMESPACE<br>
|
||||
|
||||
EA_COMPILER_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS<br>
|
||||
|
||||
EA_COMPILER_NO_EXCEPTIONS<br>
|
||||
|
||||
EA_COMPILER_NO_UNWIND<br>
|
||||
|
||||
<br>
|
||||
|
||||
EA_COMPILER_IS_ANSIC<br>
|
||||
|
||||
EA_COMPILER_IS_C99<br>
|
||||
|
||||
EA_COMPILER_HAS_C99_TYPES<br>
|
||||
EA_COMPILER_IS_CPLUSPLUS<br>
|
||||
|
||||
EA_COMPILER_MANAGED_CPP</div>
|
||||
<h4>Utilities<br>
|
||||
</h4>
|
||||
<div style="margin-left: 40px;">
|
||||
|
||||
<p>EA_ALIGN_OF()<br>
|
||||
EA_PREFIX_ALIGN()<br>
|
||||
|
||||
EA_POSTFIX_ALIGN()<br>
|
||||
EA_ALIGNED()<br>
|
||||
|
||||
EA_PACKED()<br>
|
||||
EA_LIKELY()<br>
|
||||
EA_UNLIKELY()<br>
|
||||
EA_ASSUME()<br>
|
||||
EA_PURE<br>
|
||||
EA_WCHAR_T_NON_NATIVE<br>
|
||||
|
||||
EA_WCHAR_SIZE<br>
|
||||
EA_RESTRICT<br>
|
||||
EA_DEPRECATED<br>
|
||||
EA_PREFIX_DEPRECATED<br>
|
||||
EA_POSTFIX_DEPRECATED <br>
|
||||
EA_FORCE_INLINE<br>
|
||||
EA_NO_INLINE<br>
|
||||
EA_PREFIX_NO_INLINE<br>
|
||||
EA_POSTFIX_NO_INLINE <br>
|
||||
EA_PASCAL<br>
|
||||
|
||||
EA_PASCAL_FUNC()<br>
|
||||
|
||||
EA_SSE = [0 | 1]<br>
|
||||
|
||||
EA_IMPORT<br>
|
||||
|
||||
EA_EXPORT<br>
|
||||
EA_OVERRIDE<br>
|
||||
EA_INIT_PRIORITY<br>
|
||||
EA_MAY_ALIAS<br>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<h4>Platform Definitions<br>
|
||||
|
||||
</h4>
|
||||
|
||||
<div style="margin-left: 40px;"><br>
|
||||
|
||||
|
||||
EA_PLATFORM_MAC<br>
|
||||
|
||||
EA_PLATFORM_OSX<br>
|
||||
EA_PLATFORM_IPHONE<br>
|
||||
EA_PLATFORM_ANDROID<br>
|
||||
EA_PLATFORM_LINUX<br>
|
||||
|
||||
EA_PLATFORM_WINDOWS<br>
|
||||
|
||||
EA_PLATFORM_WIN32<br>
|
||||
|
||||
EA_PLATFORM_WIN64<br>
|
||||
|
||||
EA_PLATFORM_HPUX<br>
|
||||
|
||||
EA_PLATFORM_SUN<br>
|
||||
|
||||
<br>
|
||||
|
||||
EA_PLATFORM_NAME<br>
|
||||
|
||||
EA_PLATFORM_DESCRIPTION<br>
|
||||
|
||||
EA_PROCESSOR_POWERPC, EA_PROCESSOR_X86, EA_PROCESSOR_ARM, etc.<br>
|
||||
|
||||
EA_SYSTEM_LITTLE_ENDIAN, EA_SYSTEM_BIG_ENDIAN<br>
|
||||
|
||||
EA_ASM_STYLE_ATT, EA_ASM_STYLE_INTEL, EA_ASM_STYLE_MOTOROLA<br>
|
||||
|
||||
EA_PLATFORM_PTR_SIZE<br>
|
||||
EA_PLATFORM_WORD_SIZE</div>
|
||||
|
||||
|
||||
<br>
|
||||
|
||||
<hr style="width: 100%; height: 2px;"><br>
|
||||
|
||||
<br>
|
||||
|
||||
<br>
|
||||
<br>
|
||||
<br>
|
||||
<br>
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,738 @@
|
||||
/*-----------------------------------------------------------------------------
|
||||
* config/eaplatform.h
|
||||
*
|
||||
* Copyright (c) Electronic Arts Inc. All rights reserved.
|
||||
*-----------------------------------------------------------------------------
|
||||
* Currently supported platform indentification defines include:
|
||||
*/
|
||||
#ifdef EA_PLATFORM_PS4 // ifdef for code stripping purposes
|
||||
// EA_PLATFORM_PS4 (EA_PLATFORM_KETTLE)
|
||||
#endif
|
||||
#ifdef EA_PLATFORM_XBOXONE // ifdef for code stripping purposes
|
||||
// EA_PLATFORM_XBOXONE (EA_PLATFORM_CAPILANO)
|
||||
// EA_PLATFORM_XBOXONE_XDK (EA_PLATFORM_CAPILANO_XDK), set by capilano_config package
|
||||
// EA_PLATFORM_XBOXONE_ADK (EA_PLATFORM_CAPILANO_ADK), set by capilano_config package
|
||||
#endif
|
||||
// EA_PLATFORM_ANDROID
|
||||
// EA_PLATFORM_APPLE
|
||||
// EA_PLATFORM_IPHONE
|
||||
// EA_PLATFORM_IPHONE_SIMULATOR
|
||||
// EA_PLATFORM_OSX
|
||||
// EA_PLATFORM_LINUX
|
||||
// EA_PLATFORM_SAMSUNG_TV
|
||||
// EA_PLATFORM_WINDOWS
|
||||
// EA_PLATFORM_WIN32
|
||||
// EA_PLATFORM_WIN64
|
||||
// EA_PLATFORM_WINDOWS_PHONE
|
||||
// EA_PLATFORM_WINRT
|
||||
// EA_PLATFORM_SUN
|
||||
// EA_PLATFORM_LRB (Larrabee)
|
||||
// EA_PLATFORM_POSIX (pseudo-platform; may be defined along with another platform like EA_PLATFORM_LINUX, EA_PLATFORM_UNIX, EA_PLATFORM_QNX)
|
||||
// EA_PLATFORM_UNIX (pseudo-platform; may be defined along with another platform like EA_PLATFORM_LINUX)
|
||||
// EA_PLATFORM_CYGWIN (pseudo-platform; may be defined along with another platform like EA_PLATFORM_LINUX)
|
||||
// EA_PLATFORM_MINGW (pseudo-platform; may be defined along with another platform like EA_PLATFORM_WINDOWS)
|
||||
// EA_PLATFORM_MICROSOFT (pseudo-platform; may be defined along with another platform like EA_PLATFORM_WINDOWS)
|
||||
//
|
||||
// EA_ABI_ARM_LINUX (a.k.a. "eabi". for all platforms that use the CodeSourcery GNU/Linux toolchain, like Android)
|
||||
// EA_ABI_ARM_APPLE (similar to eabi but not identical)
|
||||
// EA_ABI_ARM64_APPLE (similar to eabi but not identical) https://developer.apple.com/library/ios/documentation/Xcode/Conceptual/iPhoneOSABIReference/Articles/ARM64FunctionCallingConventions.html
|
||||
// EA_ABI_ARM_WINCE (similar to eabi but not identical)
|
||||
//
|
||||
// Other definitions emanated from this file inclue:
|
||||
// EA_PLATFORM_NAME = <string>
|
||||
// EA_PLATFORM_DESCRIPTION = <string>
|
||||
// EA_PROCESSOR_XXX
|
||||
// EA_MISALIGNED_SUPPORT_LEVEL=0|1|2
|
||||
// EA_SYSTEM_LITTLE_ENDIAN | EA_SYSTEM_BIG_ENDIAN
|
||||
// EA_ASM_STYLE_ATT | EA_ASM_STYLE_INTEL | EA_ASM_STYLE_MOTOROLA
|
||||
// EA_PLATFORM_PTR_SIZE = <integer size in bytes>
|
||||
// EA_PLATFORM_WORD_SIZE = <integer size in bytes>
|
||||
// EA_CACHE_LINE_SIZE = <integer size in bytes>
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
/*
|
||||
EA_PLATFORM_MOBILE
|
||||
EA_PLATFORM_MOBILE is a peer to EA_PLATORM_DESKTOP and EA_PLATFORM_CONSOLE. Their definition is qualitative rather
|
||||
than quantitative, and refers to the general (usually weaker) capabilities of the machine. Mobile devices have a
|
||||
similar set of weaknesses that are useful to generally categorize. The primary motivation is to avoid code that
|
||||
tests for multiple mobile platforms on a line and needs to be updated every time we get a new one.
|
||||
For example, mobile platforms tend to have weaker ARM processors, don't have full multiple processor support,
|
||||
are hand-held, don't have mice (though may have touch screens or basic cursor controls), have writable solid
|
||||
state permanent storage. Production user code shouldn't have too many expectations about the meaning of this define.
|
||||
|
||||
EA_PLATFORM_DESKTOP
|
||||
This is similar to EA_PLATFORM_MOBILE in its qualitative nature and refers to platforms that are powerful.
|
||||
For example, they nearly always have virtual memory, mapped memory, hundreds of GB of writable disk storage,
|
||||
TCP/IP network connections, mice, keyboards, 512+ MB of RAM, multiprocessing, multiple display support.
|
||||
Production user code shouldn't have too many expectations about the meaning of this define.
|
||||
|
||||
EA_PLATFORM_CONSOLE
|
||||
This is similar to EA_PLATFORM_MOBILE in its qualitative nature and refers to platforms that are consoles.
|
||||
This means platforms that are connected to TVs, are fairly powerful (especially graphics-wise), are tightly
|
||||
controlled by vendors, tend not to have mapped memory, tend to have TCP/IP, don't have multiple process support
|
||||
though they might have multiple CPUs, support TV output only. Production user code shouldn't have too many
|
||||
expectations about the meaning of this define.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#ifndef INCLUDED_eaplatform_H
|
||||
#define INCLUDED_eaplatform_H
|
||||
|
||||
|
||||
// Cygwin
|
||||
// This is a pseudo-platform which will be defined along with EA_PLATFORM_LINUX when
|
||||
// using the Cygwin build environment.
|
||||
#if defined(__CYGWIN__)
|
||||
#define EA_PLATFORM_CYGWIN 1
|
||||
#define EA_PLATFORM_DESKTOP 1
|
||||
#endif
|
||||
|
||||
// MinGW
|
||||
// This is a pseudo-platform which will be defined along with EA_PLATFORM_WINDOWS when
|
||||
// using the MinGW Windows build environment.
|
||||
#if defined(__MINGW32__) || defined(__MINGW64__)
|
||||
#define EA_PLATFORM_MINGW 1
|
||||
#define EA_PLATFORM_DESKTOP 1
|
||||
#endif
|
||||
|
||||
#if defined(EA_PLATFORM_PS4) || defined(__ORBIS__) || defined(EA_PLATFORM_KETTLE)
|
||||
// PlayStation 4
|
||||
// Orbis was Sony's code-name for the platform, which is now obsolete.
|
||||
// Kettle was an EA-specific code-name for the platform, which is now obsolete.
|
||||
#if defined(EA_PLATFORM_PS4)
|
||||
#undef EA_PLATFORM_PS4
|
||||
#endif
|
||||
#define EA_PLATFORM_PS4 1
|
||||
|
||||
// Backward compatibility:
|
||||
#if defined(EA_PLATFORM_KETTLE)
|
||||
#undef EA_PLATFORM_KETTLE
|
||||
#endif
|
||||
// End backward compatbility
|
||||
|
||||
#define EA_PLATFORM_KETTLE 1
|
||||
#define EA_PLATFORM_NAME "PS4"
|
||||
#define EA_SYSTEM_LITTLE_ENDIAN 1
|
||||
#define EA_PLATFORM_DESCRIPTION "PS4 on x64"
|
||||
#define EA_PLATFORM_CONSOLE 1
|
||||
#define EA_PLATFORM_SONY 1
|
||||
#define EA_PLATFORM_POSIX 1
|
||||
// #define EA_POSIX_THREADS_AVAILABLE 1 // POSIX threading API is available but discouraged. Sony indicated use of the scePthreads* API is preferred.
|
||||
#define EA_PROCESSOR_X86_64 1
|
||||
#if defined(__GNUC__) || defined(__clang__)
|
||||
#define EA_ASM_STYLE_ATT 1
|
||||
#endif
|
||||
|
||||
#elif defined(EA_PLATFORM_XBOXONE) || defined(_DURANGO) || defined(_XBOX_ONE) || defined(EA_PLATFORM_CAPILANO) || defined(_GAMING_XBOX)
|
||||
// XBox One
|
||||
// Durango was Microsoft's code-name for the platform, which is now obsolete.
|
||||
// Microsoft uses _DURANGO instead of some variation of _XBOX, though it's not natively defined by the compiler.
|
||||
// Capilano was an EA-specific code-name for the platform, which is now obsolete.
|
||||
#if defined(EA_PLATFORM_XBOXONE)
|
||||
#undef EA_PLATFORM_XBOXONE
|
||||
#endif
|
||||
#define EA_PLATFORM_XBOXONE 1
|
||||
|
||||
// Backward compatibility:
|
||||
#if defined(EA_PLATFORM_CAPILANO)
|
||||
#undef EA_PLATFORM_CAPILANO
|
||||
#endif
|
||||
#define EA_PLATFORM_CAPILANO 1
|
||||
#if defined(EA_PLATFORM_CAPILANO_XDK) && !defined(EA_PLATFORM_XBOXONE_XDK)
|
||||
#define EA_PLATFORM_XBOXONE_XDK 1
|
||||
#endif
|
||||
#if defined(EA_PLATFORM_CAPILANO_ADK) && !defined(EA_PLATFORM_XBOXONE_ADK)
|
||||
#define EA_PLATFORM_XBOXONE_ADK 1
|
||||
#endif
|
||||
// End backward compatibility
|
||||
|
||||
#if !defined(_DURANGO)
|
||||
#define _DURANGO
|
||||
#endif
|
||||
#define EA_PLATFORM_NAME "XBox One"
|
||||
//#define EA_PROCESSOR_X86 Currently our policy is that we don't define this, even though x64 is something of a superset of x86.
|
||||
#define EA_PROCESSOR_X86_64 1
|
||||
#define EA_SYSTEM_LITTLE_ENDIAN 1
|
||||
#define EA_PLATFORM_DESCRIPTION "XBox One on x64"
|
||||
#define EA_ASM_STYLE_INTEL 1
|
||||
#define EA_PLATFORM_CONSOLE 1
|
||||
#define EA_PLATFORM_MICROSOFT 1
|
||||
|
||||
// WINAPI_FAMILY defines - mirrored from winapifamily.h
|
||||
#define EA_WINAPI_FAMILY_APP 1000
|
||||
#define EA_WINAPI_FAMILY_DESKTOP_APP 1001
|
||||
#define EA_WINAPI_FAMILY_PHONE_APP 1002
|
||||
#define EA_WINAPI_FAMILY_TV_APP 1003
|
||||
#define EA_WINAPI_FAMILY_TV_TITLE 1004
|
||||
#define EA_WINAPI_FAMILY_GAMES 1006
|
||||
|
||||
#if defined(WINAPI_FAMILY)
|
||||
#include <winapifamily.h>
|
||||
#if defined(WINAPI_FAMILY_TV_TITLE) && WINAPI_FAMILY == WINAPI_FAMILY_TV_TITLE
|
||||
#define EA_WINAPI_FAMILY EA_WINAPI_FAMILY_TV_TITLE
|
||||
#elif defined(WINAPI_FAMILY_DESKTOP_APP) && WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP
|
||||
#define EA_WINAPI_FAMILY EA_WINAPI_FAMILY_DESKTOP_APP
|
||||
#elif defined(WINAPI_FAMILY_GAMES) && WINAPI_FAMILY == WINAPI_FAMILY_GAMES
|
||||
#define EA_WINAPI_FAMILY EA_WINAPI_FAMILY_GAMES
|
||||
#else
|
||||
#error Unsupported WINAPI_FAMILY
|
||||
#endif
|
||||
#else
|
||||
#error WINAPI_FAMILY should always be defined on Capilano.
|
||||
#endif
|
||||
|
||||
// Macro to determine if a partition is enabled.
|
||||
#define EA_WINAPI_FAMILY_PARTITION(Partition) (Partition)
|
||||
|
||||
#if EA_WINAPI_FAMILY == EA_WINAPI_FAMILY_DESKTOP_APP
|
||||
#define EA_WINAPI_PARTITION_CORE 1
|
||||
#define EA_WINAPI_PARTITION_DESKTOP 1
|
||||
#define EA_WINAPI_PARTITION_APP 1
|
||||
#define EA_WINAPI_PARTITION_PC_APP 0
|
||||
#define EA_WIANPI_PARTITION_PHONE 0
|
||||
#define EA_WINAPI_PARTITION_TV_APP 0
|
||||
#define EA_WINAPI_PARTITION_TV_TITLE 0
|
||||
#define EA_WINAPI_PARTITION_GAMES 0
|
||||
#elif EA_WINAPI_FAMILY == EA_WINAPI_FAMILY_TV_TITLE
|
||||
#define EA_WINAPI_PARTITION_CORE 1
|
||||
#define EA_WINAPI_PARTITION_DESKTOP 0
|
||||
#define EA_WINAPI_PARTITION_APP 0
|
||||
#define EA_WINAPI_PARTITION_PC_APP 0
|
||||
#define EA_WIANPI_PARTITION_PHONE 0
|
||||
#define EA_WINAPI_PARTITION_TV_APP 0
|
||||
#define EA_WINAPI_PARTITION_TV_TITLE 1
|
||||
#define EA_WINAPI_PARTITION_GAMES 0
|
||||
#elif EA_WINAPI_FAMILY == EA_WINAPI_FAMILY_GAMES
|
||||
#define EA_WINAPI_PARTITION_CORE 1
|
||||
#define EA_WINAPI_PARTITION_DESKTOP 0
|
||||
#define EA_WINAPI_PARTITION_APP 0
|
||||
#define EA_WINAPI_PARTITION_PC_APP 0
|
||||
#define EA_WIANPI_PARTITION_PHONE 0
|
||||
#define EA_WINAPI_PARTITION_TV_APP 0
|
||||
#define EA_WINAPI_PARTITION_TV_TITLE 0
|
||||
#define EA_WINAPI_PARTITION_GAMES 1
|
||||
#else
|
||||
#error Unsupported WINAPI_FAMILY
|
||||
#endif
|
||||
|
||||
#if EA_WINAPI_FAMILY_PARTITION(EA_WINAPI_PARTITION_GAMES)
|
||||
#define CS_UNDEFINED_STRING 1
|
||||
#define CS_UNDEFINED_STRING 1
|
||||
#endif
|
||||
|
||||
#if EA_WINAPI_FAMILY_PARTITION(EA_WINAPI_PARTITION_TV_TITLE)
|
||||
#define EA_PLATFORM_XBOXONE_XDK 1
|
||||
#endif
|
||||
#elif defined(EA_PLATFORM_LRB) || defined(__LRB__) || (defined(__EDG__) && defined(__ICC) && defined(__x86_64__))
|
||||
#undef EA_PLATFORM_LRB
|
||||
#define EA_PLATFORM_LRB 1
|
||||
#define EA_PLATFORM_NAME "Larrabee"
|
||||
#define EA_PLATFORM_DESCRIPTION "Larrabee on LRB1"
|
||||
#define EA_PROCESSOR_X86_64 1
|
||||
#if defined(BYTE_ORDER) && (BYTE_ORDER == 4321)
|
||||
#define EA_SYSTEM_BIG_ENDIAN 1
|
||||
#else
|
||||
#define EA_SYSTEM_LITTLE_ENDIAN 1
|
||||
#endif
|
||||
#define EA_PROCESSOR_LRB 1
|
||||
#define EA_PROCESSOR_LRB1 1 // Larrabee version 1
|
||||
#define EA_ASM_STYLE_ATT 1 // Both types of asm style
|
||||
#define EA_ASM_STYLE_INTEL 1 // are supported.
|
||||
#define EA_PLATFORM_DESKTOP 1
|
||||
|
||||
// Android (Google phone OS)
|
||||
#elif defined(EA_PLATFORM_ANDROID) || defined(__ANDROID__)
|
||||
#undef EA_PLATFORM_ANDROID
|
||||
#define EA_PLATFORM_ANDROID 1
|
||||
#define EA_PLATFORM_LINUX 1
|
||||
#define EA_PLATFORM_UNIX 1
|
||||
#define EA_PLATFORM_POSIX 1
|
||||
#define EA_PLATFORM_NAME "Android"
|
||||
#define EA_ASM_STYLE_ATT 1
|
||||
#if defined(__arm__)
|
||||
#define EA_ABI_ARM_LINUX 1 // a.k.a. "ARM eabi"
|
||||
#define EA_PROCESSOR_ARM32 1
|
||||
#define EA_PLATFORM_DESCRIPTION "Android on ARM"
|
||||
#elif defined(__aarch64__)
|
||||
#define EA_PROCESSOR_ARM64 1
|
||||
#define EA_PLATFORM_DESCRIPTION "Android on ARM64"
|
||||
#elif defined(__i386__)
|
||||
#define EA_PROCESSOR_X86 1
|
||||
#define EA_PLATFORM_DESCRIPTION "Android on x86"
|
||||
#elif defined(__x86_64)
|
||||
#define EA_PROCESSOR_X86_64 1
|
||||
#define EA_PLATFORM_DESCRIPTION "Android on x64"
|
||||
#else
|
||||
#error Unknown processor
|
||||
#endif
|
||||
#if !defined(EA_SYSTEM_BIG_ENDIAN) && !defined(EA_SYSTEM_LITTLE_ENDIAN)
|
||||
#define EA_SYSTEM_LITTLE_ENDIAN 1
|
||||
#endif
|
||||
#define EA_PLATFORM_MOBILE 1
|
||||
|
||||
// Samsung SMART TV - a Linux-based smart TV
|
||||
#elif defined(EA_PLATFORM_SAMSUNG_TV)
|
||||
#undef EA_PLATFORM_SAMSUNG_TV
|
||||
#define EA_PLATFORM_SAMSUNG_TV 1
|
||||
#define EA_PLATFORM_LINUX 1
|
||||
#define EA_PLATFORM_UNIX 1
|
||||
#define EA_PLATFORM_POSIX 1
|
||||
#define EA_PLATFORM_NAME "SamsungTV"
|
||||
#define EA_PLATFORM_DESCRIPTION "Samsung SMART TV on ARM"
|
||||
#define EA_ASM_STYLE_ATT 1
|
||||
#define EA_SYSTEM_LITTLE_ENDIAN 1
|
||||
#define EA_PROCESSOR_ARM32 1
|
||||
#define EA_ABI_ARM_LINUX 1 // a.k.a. "ARM eabi"
|
||||
#define EA_PROCESSOR_ARM7 1
|
||||
|
||||
#elif defined(__APPLE__) && __APPLE__
|
||||
#include <TargetConditionals.h>
|
||||
|
||||
// Apple family of operating systems.
|
||||
#define EA_PLATFORM_APPLE
|
||||
#define EA_PLATFORM_POSIX 1
|
||||
|
||||
// iPhone
|
||||
// TARGET_OS_IPHONE will be undefined on an unknown compiler, and will be defined on gcc.
|
||||
#if defined(EA_PLATFORM_IPHONE) || defined(__IPHONE__) || (defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE) || (defined(TARGET_IPHONE_SIMULATOR) && TARGET_IPHONE_SIMULATOR)
|
||||
#undef EA_PLATFORM_IPHONE
|
||||
#define EA_PLATFORM_IPHONE 1
|
||||
#define EA_PLATFORM_NAME "iPhone"
|
||||
#define EA_ASM_STYLE_ATT 1
|
||||
#define EA_POSIX_THREADS_AVAILABLE 1
|
||||
#if defined(__arm__)
|
||||
#define EA_ABI_ARM_APPLE 1
|
||||
#define EA_PROCESSOR_ARM32 1
|
||||
#define EA_SYSTEM_LITTLE_ENDIAN 1
|
||||
#define EA_PLATFORM_DESCRIPTION "iPhone on ARM"
|
||||
#elif defined(__aarch64__) || defined(__AARCH64)
|
||||
#define EA_ABI_ARM64_APPLE 1
|
||||
#define EA_PROCESSOR_ARM64 1
|
||||
#define EA_SYSTEM_LITTLE_ENDIAN 1
|
||||
#define EA_PLATFORM_DESCRIPTION "iPhone on ARM64"
|
||||
#elif defined(__i386__)
|
||||
#define EA_PLATFORM_IPHONE_SIMULATOR 1
|
||||
#define EA_PROCESSOR_X86 1
|
||||
#define EA_SYSTEM_LITTLE_ENDIAN 1
|
||||
#define EA_PLATFORM_DESCRIPTION "iPhone simulator on x86"
|
||||
#elif defined(__x86_64) || defined(__amd64)
|
||||
#define EA_PROCESSOR_X86_64 1
|
||||
#define EA_SYSTEM_LITTLE_ENDIAN 1
|
||||
#define EA_PLATFORM_DESCRIPTION "iPhone simulator on x64"
|
||||
#else
|
||||
#error Unknown processor
|
||||
#endif
|
||||
#define EA_PLATFORM_MOBILE 1
|
||||
|
||||
// Macintosh OSX
|
||||
// TARGET_OS_MAC is defined by the Metrowerks and older AppleC compilers.
|
||||
// Howerver, TARGET_OS_MAC is defined to be 1 in all cases.
|
||||
// __i386__ and __intel__ are defined by the GCC compiler.
|
||||
// __dest_os is defined by the Metrowerks compiler.
|
||||
// __MACH__ is defined by the Metrowerks and GCC compilers.
|
||||
// powerc and __powerc are defined by the Metrowerks and GCC compilers.
|
||||
#elif defined(EA_PLATFORM_OSX) || defined(__MACH__) || (defined(__MSL__) && (__dest_os == __mac_os_x))
|
||||
#undef EA_PLATFORM_OSX
|
||||
#define EA_PLATFORM_OSX 1
|
||||
#define EA_PLATFORM_UNIX 1
|
||||
#define EA_PLATFORM_POSIX 1
|
||||
//#define EA_PLATFORM_BSD 1 We don't currently define this. OSX has some BSD history but a lot of the API is different.
|
||||
#define EA_PLATFORM_NAME "OSX"
|
||||
#if defined(__i386__) || defined(__intel__)
|
||||
#define EA_PROCESSOR_X86 1
|
||||
#define EA_SYSTEM_LITTLE_ENDIAN 1
|
||||
#define EA_PLATFORM_DESCRIPTION "OSX on x86"
|
||||
#elif defined(__x86_64) || defined(__amd64)
|
||||
#define EA_PROCESSOR_X86_64 1
|
||||
#define EA_SYSTEM_LITTLE_ENDIAN 1
|
||||
#define EA_PLATFORM_DESCRIPTION "OSX on x64"
|
||||
#elif defined(__arm__)
|
||||
#define EA_ABI_ARM_APPLE 1
|
||||
#define EA_PROCESSOR_ARM32 1
|
||||
#define EA_SYSTEM_LITTLE_ENDIAN 1
|
||||
#define EA_PLATFORM_DESCRIPTION "OSX on ARM"
|
||||
#elif defined(__aarch64__) || defined(__AARCH64)
|
||||
#define EA_ABI_ARM64_APPLE 1
|
||||
#define EA_PROCESSOR_ARM64 1
|
||||
#define EA_SYSTEM_LITTLE_ENDIAN 1
|
||||
#define EA_PLATFORM_DESCRIPTION "OSX on ARM64"
|
||||
#elif defined(__POWERPC64__) || defined(__powerpc64__)
|
||||
#define EA_PROCESSOR_POWERPC 1
|
||||
#define EA_PROCESSOR_POWERPC_64 1
|
||||
#define EA_SYSTEM_BIG_ENDIAN 1
|
||||
#define EA_PLATFORM_DESCRIPTION "OSX on PowerPC 64"
|
||||
#elif defined(__POWERPC__) || defined(__powerpc__)
|
||||
#define EA_PROCESSOR_POWERPC 1
|
||||
#define EA_PROCESSOR_POWERPC_32 1
|
||||
#define EA_SYSTEM_BIG_ENDIAN 1
|
||||
#define EA_PLATFORM_DESCRIPTION "OSX on PowerPC"
|
||||
#else
|
||||
#error Unknown processor
|
||||
#endif
|
||||
#if defined(__GNUC__)
|
||||
#define EA_ASM_STYLE_ATT 1
|
||||
#else
|
||||
#define EA_ASM_STYLE_MOTOROLA 1
|
||||
#endif
|
||||
#define EA_PLATFORM_DESKTOP 1
|
||||
#else
|
||||
#error Unknown Apple Platform
|
||||
#endif
|
||||
|
||||
// Linux
|
||||
// __linux and __linux__ are defined by the GCC and Borland compiler.
|
||||
// __i386__ and __intel__ are defined by the GCC compiler.
|
||||
// __i386__ is defined by the Metrowerks compiler.
|
||||
// _M_IX86 is defined by the Borland compiler.
|
||||
// __sparc__ is defined by the GCC compiler.
|
||||
// __powerpc__ is defined by the GCC compiler.
|
||||
// __ARM_EABI__ is defined by GCC on an ARM v6l (Raspberry Pi 1)
|
||||
// __ARM_ARCH_7A__ is defined by GCC on an ARM v7l (Raspberry Pi 2)
|
||||
#elif defined(EA_PLATFORM_LINUX) || (defined(__linux) || defined(__linux__))
|
||||
#undef EA_PLATFORM_LINUX
|
||||
#define EA_PLATFORM_LINUX 1
|
||||
#define EA_PLATFORM_UNIX 1
|
||||
#define EA_PLATFORM_POSIX 1
|
||||
#define EA_PLATFORM_NAME "Linux"
|
||||
#if defined(__i386__) || defined(__intel__) || defined(_M_IX86)
|
||||
#define EA_PROCESSOR_X86 1
|
||||
#define EA_SYSTEM_LITTLE_ENDIAN 1
|
||||
#define EA_PLATFORM_DESCRIPTION "Linux on x86"
|
||||
#elif defined(__ARM_ARCH_7A__) || defined(__ARM_EABI__)
|
||||
#define EA_ABI_ARM_LINUX 1
|
||||
#define EA_PROCESSOR_ARM32 1
|
||||
#define EA_PLATFORM_DESCRIPTION "Linux on ARM 6/7 32-bits"
|
||||
#elif defined(__aarch64__) || defined(__AARCH64)
|
||||
#define EA_PROCESSOR_ARM64 1
|
||||
#define EA_PLATFORM_DESCRIPTION "Linux on ARM64"
|
||||
#elif defined(__x86_64__)
|
||||
#define EA_PROCESSOR_X86_64 1
|
||||
#define EA_SYSTEM_LITTLE_ENDIAN 1
|
||||
#define EA_PLATFORM_DESCRIPTION "Linux on x64"
|
||||
#elif defined(__powerpc64__)
|
||||
#define EA_PROCESSOR_POWERPC 1
|
||||
#define EA_PROCESSOR_POWERPC_64 1
|
||||
#define EA_SYSTEM_BIG_ENDIAN 1
|
||||
#define EA_PLATFORM_DESCRIPTION "Linux on PowerPC 64"
|
||||
#elif defined(__powerpc__)
|
||||
#define EA_PROCESSOR_POWERPC 1
|
||||
#define EA_PROCESSOR_POWERPC_32 1
|
||||
#define EA_SYSTEM_BIG_ENDIAN 1
|
||||
#define EA_PLATFORM_DESCRIPTION "Linux on PowerPC"
|
||||
#else
|
||||
#error Unknown processor
|
||||
#error Unknown endianness
|
||||
#endif
|
||||
#if defined(__GNUC__)
|
||||
#define EA_ASM_STYLE_ATT 1
|
||||
#endif
|
||||
#define EA_PLATFORM_DESKTOP 1
|
||||
|
||||
|
||||
#elif defined(EA_PLATFORM_BSD) || (defined(__BSD__) || defined(__FreeBSD__))
|
||||
#undef EA_PLATFORM_BSD
|
||||
#define EA_PLATFORM_BSD 1
|
||||
#define EA_PLATFORM_UNIX 1
|
||||
#define EA_PLATFORM_POSIX 1 // BSD's posix complaince is not identical to Linux's
|
||||
#define EA_PLATFORM_NAME "BSD Unix"
|
||||
#if defined(__i386__) || defined(__intel__)
|
||||
#define EA_PROCESSOR_X86 1
|
||||
#define EA_SYSTEM_LITTLE_ENDIAN 1
|
||||
#define EA_PLATFORM_DESCRIPTION "BSD on x86"
|
||||
#elif defined(__x86_64__)
|
||||
#define EA_PROCESSOR_X86_64 1
|
||||
#define EA_SYSTEM_LITTLE_ENDIAN 1
|
||||
#define EA_PLATFORM_DESCRIPTION "BSD on x64"
|
||||
#elif defined(__powerpc64__)
|
||||
#define EA_PROCESSOR_POWERPC 1
|
||||
#define EA_PROCESSOR_POWERPC_64 1
|
||||
#define EA_SYSTEM_BIG_ENDIAN 1
|
||||
#define EA_PLATFORM_DESCRIPTION "BSD on PowerPC 64"
|
||||
#elif defined(__powerpc__)
|
||||
#define EA_PROCESSOR_POWERPC 1
|
||||
#define EA_PROCESSOR_POWERPC_32 1
|
||||
#define EA_SYSTEM_BIG_ENDIAN 1
|
||||
#define EA_PLATFORM_DESCRIPTION "BSD on PowerPC"
|
||||
#else
|
||||
#error Unknown processor
|
||||
#error Unknown endianness
|
||||
#endif
|
||||
#if !defined(EA_PLATFORM_FREEBSD) && defined(__FreeBSD__)
|
||||
#define EA_PLATFORM_FREEBSD 1 // This is a variation of BSD.
|
||||
#endif
|
||||
#if defined(__GNUC__)
|
||||
#define EA_ASM_STYLE_ATT 1
|
||||
#endif
|
||||
#define EA_PLATFORM_DESKTOP 1
|
||||
|
||||
|
||||
#elif defined(EA_PLATFORM_WINDOWS_PHONE)
|
||||
#undef EA_PLATFORM_WINDOWS_PHONE
|
||||
#define EA_PLATFORM_WINDOWS_PHONE 1
|
||||
#define EA_PLATFORM_NAME "Windows Phone"
|
||||
#if defined(_M_AMD64) || defined(_AMD64_) || defined(__x86_64__)
|
||||
#define EA_PROCESSOR_X86_64 1
|
||||
#define EA_SYSTEM_LITTLE_ENDIAN 1
|
||||
#define EA_PLATFORM_DESCRIPTION "Windows Phone on x64"
|
||||
#elif defined(_M_IX86) || defined(_X86_)
|
||||
#define EA_PROCESSOR_X86 1
|
||||
#define EA_SYSTEM_LITTLE_ENDIAN 1
|
||||
#define EA_PLATFORM_DESCRIPTION "Windows Phone on X86"
|
||||
#elif defined(_M_ARM)
|
||||
#define EA_ABI_ARM_WINCE 1
|
||||
#define EA_PROCESSOR_ARM32 1
|
||||
#define EA_SYSTEM_LITTLE_ENDIAN 1
|
||||
#define EA_PLATFORM_DESCRIPTION "Windows Phone on ARM"
|
||||
#else //Possibly other Windows Phone variants
|
||||
#error Unknown processor
|
||||
#error Unknown endianness
|
||||
#endif
|
||||
#define EA_PLATFORM_MICROSOFT 1
|
||||
|
||||
// WINAPI_FAMILY defines - mirrored from winapifamily.h
|
||||
#define EA_WINAPI_FAMILY_APP 1
|
||||
#define EA_WINAPI_FAMILY_DESKTOP_APP 2
|
||||
#define EA_WINAPI_FAMILY_PHONE_APP 3
|
||||
|
||||
#if defined(WINAPI_FAMILY)
|
||||
#include <winapifamily.h>
|
||||
#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
|
||||
#define EA_WINAPI_FAMILY EA_WINAPI_FAMILY_PHONE_APP
|
||||
#else
|
||||
#error Unsupported WINAPI_FAMILY for Windows Phone
|
||||
#endif
|
||||
#else
|
||||
#error WINAPI_FAMILY should always be defined on Windows Phone.
|
||||
#endif
|
||||
|
||||
// Macro to determine if a partition is enabled.
|
||||
#define EA_WINAPI_FAMILY_PARTITION(Partition) (Partition)
|
||||
|
||||
// Enable the appropriate partitions for the current family
|
||||
#if EA_WINAPI_FAMILY == EA_WINAPI_FAMILY_PHONE_APP
|
||||
# define EA_WINAPI_PARTITION_CORE 1
|
||||
# define EA_WINAPI_PARTITION_PHONE 1
|
||||
# define EA_WINAPI_PARTITION_APP 1
|
||||
#else
|
||||
# error Unsupported WINAPI_FAMILY for Windows Phone
|
||||
#endif
|
||||
|
||||
|
||||
// Windows
|
||||
// _WIN32 is defined by the VC++, Intel and GCC compilers.
|
||||
// _WIN64 is defined by the VC++, Intel and GCC compilers.
|
||||
// __WIN32__ is defined by the Borland compiler.
|
||||
// __INTEL__ is defined by the Metrowerks compiler.
|
||||
// _M_IX86, _M_AMD64 and _M_IA64 are defined by the VC++, Intel, and Borland compilers.
|
||||
// _X86_, _AMD64_, and _IA64_ are defined by the Metrowerks compiler.
|
||||
// _M_ARM is defined by the VC++ compiler.
|
||||
#elif (defined(EA_PLATFORM_WINDOWS) || (defined(_WIN32) || defined(__WIN32__) || defined(_WIN64))) && !defined(CS_UNDEFINED_STRING)
|
||||
#undef EA_PLATFORM_WINDOWS
|
||||
#define EA_PLATFORM_WINDOWS 1
|
||||
#define EA_PLATFORM_NAME "Windows"
|
||||
#ifdef _WIN64 // VC++ defines both _WIN32 and _WIN64 when compiling for Win64.
|
||||
#define EA_PLATFORM_WIN64 1
|
||||
#else
|
||||
#define EA_PLATFORM_WIN32 1
|
||||
#endif
|
||||
#if defined(_M_AMD64) || defined(_AMD64_) || defined(__x86_64__)
|
||||
#define EA_PROCESSOR_X86_64 1
|
||||
#define EA_SYSTEM_LITTLE_ENDIAN 1
|
||||
#define EA_PLATFORM_DESCRIPTION "Windows on x64"
|
||||
#elif defined(_M_IX86) || defined(_X86_)
|
||||
#define EA_PROCESSOR_X86 1
|
||||
#define EA_SYSTEM_LITTLE_ENDIAN 1
|
||||
#define EA_PLATFORM_DESCRIPTION "Windows on X86"
|
||||
#elif defined(_M_IA64) || defined(_IA64_)
|
||||
#define EA_PROCESSOR_IA64 1
|
||||
#define EA_SYSTEM_LITTLE_ENDIAN 1
|
||||
#define EA_PLATFORM_DESCRIPTION "Windows on IA-64"
|
||||
#elif defined(_M_ARM)
|
||||
#define EA_ABI_ARM_WINCE 1
|
||||
#define EA_PROCESSOR_ARM32 1
|
||||
#define EA_SYSTEM_LITTLE_ENDIAN 1
|
||||
#define EA_PLATFORM_DESCRIPTION "Windows on ARM"
|
||||
#elif defined(_M_ARM64)
|
||||
#define EA_PROCESSOR_ARM64 1
|
||||
#define EA_SYSTEM_LITTLE_ENDIAN 1
|
||||
#define EA_PLATFORM_DESCRIPTION "Windows on ARM64"
|
||||
#else //Possibly other Windows CE variants
|
||||
#error Unknown processor
|
||||
#error Unknown endianness
|
||||
#endif
|
||||
#if defined(__GNUC__)
|
||||
#define EA_ASM_STYLE_ATT 1
|
||||
#elif defined(_MSC_VER) || defined(__BORLANDC__) || defined(__ICL)
|
||||
#define EA_ASM_STYLE_INTEL 1
|
||||
#endif
|
||||
#define EA_PLATFORM_DESKTOP 1
|
||||
#define EA_PLATFORM_MICROSOFT 1
|
||||
|
||||
// WINAPI_FAMILY defines to support Windows 8 Metro Apps - mirroring winapifamily.h in the Windows 8 SDK
|
||||
#define EA_WINAPI_FAMILY_APP 1000
|
||||
#define EA_WINAPI_FAMILY_DESKTOP_APP 1001
|
||||
#define EA_WINAPI_FAMILY_GAMES 1006
|
||||
|
||||
#if defined(WINAPI_FAMILY)
|
||||
#if defined(_MSC_VER)
|
||||
#pragma warning(push, 0)
|
||||
#endif
|
||||
#include <winapifamily.h>
|
||||
#if defined(_MSC_VER)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
#if defined(WINAPI_FAMILY_DESKTOP_APP) && WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP
|
||||
#define EA_WINAPI_FAMILY EA_WINAPI_FAMILY_DESKTOP_APP
|
||||
#elif defined(WINAPI_FAMILY_APP) && WINAPI_FAMILY == WINAPI_FAMILY_APP
|
||||
#define EA_WINAPI_FAMILY EA_WINAPI_FAMILY_APP
|
||||
#elif defined(WINAPI_FAMILY_GAMES) && WINAPI_FAMILY == WINAPI_FAMILY_GAMES
|
||||
#define EA_WINAPI_FAMILY EA_WINAPI_FAMILY_GAMES
|
||||
#else
|
||||
#error Unsupported WINAPI_FAMILY
|
||||
#endif
|
||||
#else
|
||||
#define EA_WINAPI_FAMILY EA_WINAPI_FAMILY_DESKTOP_APP
|
||||
#endif
|
||||
|
||||
#define EA_WINAPI_PARTITION_DESKTOP 1
|
||||
#define EA_WINAPI_PARTITION_APP 1
|
||||
#define EA_WINAPI_PARTITION_GAMES (EA_WINAPI_FAMILY == EA_WINAPI_FAMILY_GAMES)
|
||||
|
||||
#define EA_WINAPI_FAMILY_PARTITION(Partition) (Partition)
|
||||
|
||||
// EA_PLATFORM_WINRT
|
||||
// This is a subset of Windows which is used for tablets and the "Metro" (restricted) Windows user interface.
|
||||
// WinRT doesn't doesn't have access to the Windows "desktop" API, but WinRT can nevertheless run on
|
||||
// desktop computers in addition to tablets. The Windows Phone API is a subset of WinRT and is not included
|
||||
// in it due to it being only a part of the API.
|
||||
#if defined(__cplusplus_winrt)
|
||||
#define EA_PLATFORM_WINRT 1
|
||||
#endif
|
||||
|
||||
// Sun (Solaris)
|
||||
// __SUNPRO_CC is defined by the Sun compiler.
|
||||
// __sun is defined by the GCC compiler.
|
||||
// __i386 is defined by the Sun and GCC compilers.
|
||||
// __sparc is defined by the Sun and GCC compilers.
|
||||
#else
|
||||
#error Unknown platform
|
||||
#error Unknown processor
|
||||
#error Unknown endianness
|
||||
#endif
|
||||
|
||||
#ifndef EA_PROCESSOR_ARM
|
||||
#if defined(EA_PROCESSOR_ARM32) || defined(EA_PROCESSOR_ARM64) || defined(EA_PROCESSOR_ARM7)
|
||||
#define EA_PROCESSOR_ARM
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// EA_PLATFORM_PTR_SIZE
|
||||
// Platform pointer size; same as sizeof(void*).
|
||||
// This is not the same as sizeof(int), as int is usually 32 bits on
|
||||
// even 64 bit platforms.
|
||||
//
|
||||
// _WIN64 is defined by Win64 compilers, such as VC++.
|
||||
// _M_IA64 is defined by VC++ and Intel compilers for IA64 processors.
|
||||
// __LP64__ is defined by HP compilers for the LP64 standard.
|
||||
// _LP64 is defined by the GCC and Sun compilers for the LP64 standard.
|
||||
// __ia64__ is defined by the GCC compiler for IA64 processors.
|
||||
// __arch64__ is defined by the Sparc compiler for 64 bit processors.
|
||||
// __mips64__ is defined by the GCC compiler for MIPS processors.
|
||||
// __powerpc64__ is defined by the GCC compiler for PowerPC processors.
|
||||
// __64BIT__ is defined by the AIX compiler for 64 bit processors.
|
||||
// __sizeof_ptr is defined by the ARM compiler (armcc, armcpp).
|
||||
//
|
||||
#ifndef EA_PLATFORM_PTR_SIZE
|
||||
#if defined(__WORDSIZE) // Defined by some variations of GCC.
|
||||
#define EA_PLATFORM_PTR_SIZE ((__WORDSIZE) / 8)
|
||||
#elif defined(_WIN64) || defined(__LP64__) || defined(_LP64) || defined(_M_IA64) || defined(__ia64__) || defined(__arch64__) || defined(__aarch64__) || defined(__mips64__) || defined(__64BIT__) || defined(__Ptr_Is_64)
|
||||
#define EA_PLATFORM_PTR_SIZE 8
|
||||
#elif defined(__CC_ARM) && (__sizeof_ptr == 8)
|
||||
#define EA_PLATFORM_PTR_SIZE 8
|
||||
#else
|
||||
#define EA_PLATFORM_PTR_SIZE 4
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
// EA_PLATFORM_WORD_SIZE
|
||||
// This defines the size of a machine word. This will be the same as
|
||||
// the size of registers on the machine but not necessarily the same
|
||||
// as the size of pointers on the machine. A number of 64 bit platforms
|
||||
// have 64 bit registers but 32 bit pointers.
|
||||
//
|
||||
#ifndef EA_PLATFORM_WORD_SIZE
|
||||
#define EA_PLATFORM_WORD_SIZE EA_PLATFORM_PTR_SIZE
|
||||
#endif
|
||||
|
||||
// EA_PLATFORM_MIN_MALLOC_ALIGNMENT
|
||||
// This defines the minimal alignment that the platform's malloc
|
||||
// implementation will return. This should be used when writing custom
|
||||
// allocators to ensure that the alignment matches that of malloc
|
||||
#ifndef EA_PLATFORM_MIN_MALLOC_ALIGNMENT
|
||||
#if defined(EA_PLATFORM_APPLE)
|
||||
#define EA_PLATFORM_MIN_MALLOC_ALIGNMENT 16
|
||||
#elif defined(EA_PLATFORM_ANDROID) && defined(EA_PROCESSOR_ARM)
|
||||
#define EA_PLATFORM_MIN_MALLOC_ALIGNMENT 8
|
||||
#elif defined(EA_PLATFORM_ANDROID) && defined(EA_PROCESSOR_X86_64)
|
||||
#define EA_PLATFORM_MIN_MALLOC_ALIGNMENT 8
|
||||
#else
|
||||
#define EA_PLATFORM_MIN_MALLOC_ALIGNMENT (EA_PLATFORM_PTR_SIZE * 2)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
// EA_MISALIGNED_SUPPORT_LEVEL
|
||||
// Specifies if the processor can read and write built-in types that aren't
|
||||
// naturally aligned.
|
||||
// 0 - not supported. Likely causes an exception.
|
||||
// 1 - supported but slow.
|
||||
// 2 - supported and fast.
|
||||
//
|
||||
#ifndef EA_MISALIGNED_SUPPORT_LEVEL
|
||||
#if defined(EA_PROCESSOR_X86_64)
|
||||
#define EA_MISALIGNED_SUPPORT_LEVEL 2
|
||||
#else
|
||||
#define EA_MISALIGNED_SUPPORT_LEVEL 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Macro to determine if a Windows API partition is enabled. Always false on non Microsoft platforms.
|
||||
#if !defined(EA_WINAPI_FAMILY_PARTITION)
|
||||
#define EA_WINAPI_FAMILY_PARTITION(Partition) (0)
|
||||
#endif
|
||||
|
||||
|
||||
// EA_CACHE_LINE_SIZE
|
||||
// Specifies the cache line size broken down by compile target.
|
||||
// This the expected best guess values for the targets that we can make at compilation time.
|
||||
|
||||
#ifndef EA_CACHE_LINE_SIZE
|
||||
#if defined(EA_PROCESSOR_X86)
|
||||
#define EA_CACHE_LINE_SIZE 32 // This is the minimum possible value.
|
||||
#elif defined(EA_PROCESSOR_X86_64)
|
||||
#define EA_CACHE_LINE_SIZE 64 // This is the minimum possible value
|
||||
#elif defined(EA_PROCESSOR_ARM32)
|
||||
#define EA_CACHE_LINE_SIZE 32 // This varies between implementations and is usually 32 or 64.
|
||||
#elif defined(EA_PROCESSOR_ARM64)
|
||||
#define EA_CACHE_LINE_SIZE 64 // Cache line Cortex-A8 (64 bytes) http://shervinemami.info/armAssembly.html however this remains to be mostly an assumption at this stage
|
||||
#elif (EA_PLATFORM_WORD_SIZE == 4)
|
||||
#define EA_CACHE_LINE_SIZE 32 // This is the minimum possible value
|
||||
#else
|
||||
#define EA_CACHE_LINE_SIZE 64 // This is the minimum possible value
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#endif // INCLUDED_eaplatform_H
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,877 @@
|
||||
/*-----------------------------------------------------------------------------
|
||||
* eahave.h
|
||||
*
|
||||
* Copyright (c) Electronic Arts Inc. All rights reserved.
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------------
|
||||
This file's functionality is preliminary and won't be considered stable until
|
||||
a future EABase version.
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------------
|
||||
This header identifies if the given facilities are available in the
|
||||
standard build environment the current compiler/linker/standard library/
|
||||
operating system combination. This file may in some cases #include standard
|
||||
headers in order to make availability determinations, such as to check
|
||||
compiler or SDK version numbers. However, it cannot be perfect.
|
||||
This header does not identify compiler features, as those are defined in
|
||||
eacompiler.h and eacompilertraits.h. Rather this header is about library support.
|
||||
This header does not identify platform or library conventions either, such
|
||||
as whether the file paths use \ or / for directory separators.
|
||||
|
||||
We provide three types of HAVE features here:
|
||||
|
||||
- EA_HAVE_XXX_FEATURE - Have compiler feature.
|
||||
Identifies if the compiler has or lacks some feature in the
|
||||
current build. Sometimes you need to check to see if the
|
||||
compiler is running in some mode in able to write portable code
|
||||
against it. For example, some compilers (e.g. VC++) have a
|
||||
mode in which all language extensions are disabled. If you want
|
||||
to write code that works with that but still uses the extensions
|
||||
when available then you can check #if defined(EA_HAVE_EXTENSIONS_FEATURE).
|
||||
Features can be forcibly cancelled via EA_NO_HAVE_XXX_FEATURE.
|
||||
EA_NO_HAVE is useful for a build system or user to override the
|
||||
defaults because it happens to know better.
|
||||
|
||||
- EA_HAVE_XXX_H - Have header file information.
|
||||
Identifies if a given header file is available to the current
|
||||
compile configuration. For example, some compilers provide a
|
||||
malloc.h header, while others don't. For the former we define
|
||||
EA_HAVE_MALLOC_H, while for the latter it remains undefined.
|
||||
If a header is missing then it may still be that the functions
|
||||
the header usually declares are declared in some other header.
|
||||
EA_HAVE_XXX does not include the possibility that our own code
|
||||
provides versions of these headers, and in fact a purpose of
|
||||
EA_HAVE_XXX is to decide if we should be using our own because
|
||||
the system doesn't provide one.
|
||||
Header availability can be forcibly cancelled via EA_NO_HAVE_XXX_H.
|
||||
EA_NO_HAVE is useful for a build system or user to override the
|
||||
defaults because it happens to know better.
|
||||
|
||||
- EA_HAVE_XXX_DECL - Have function declaration information.
|
||||
Identifies if a given function declaration is provided by
|
||||
the current compile configuration. For example, some compiler
|
||||
standard libraries declare a wcslen function, while others
|
||||
don't. For the former we define EA_HAVE_WCSLEN_DECL, while for
|
||||
the latter it remains undefined. If a declaration of a function
|
||||
is missing then we assume the implementation is missing as well.
|
||||
EA_HAVE_XXX_DECL does not include the possibility that our
|
||||
own code provides versions of these declarations, and in fact a
|
||||
purpose of EA_HAVE_XXX_DECL is to decide if we should be using
|
||||
our own because the system doesn't provide one.
|
||||
Declaration availability can be forcibly cancelled via EA_NO_HAVE_XXX_DECL.
|
||||
EA_NO_HAVE is useful for a build system or user to override the
|
||||
defaults because it happens to know better.
|
||||
|
||||
- EA_HAVE_XXX_IMPL - Have function implementation information.
|
||||
Identifies if a given function implementation is provided by
|
||||
the current compile and link configuration. For example, it's
|
||||
commonly the case that console platforms declare a getenv function
|
||||
but don't provide a linkable implementation.
|
||||
In this case the user needs to provide such a function manually
|
||||
as part of the link. If the implementation is available then
|
||||
we define EA_HAVE_GETENV_IMPL, otherwise it remains undefined.
|
||||
Beware that sometimes a function may not seem to be present in
|
||||
the Standard Library but in reality you need to link some auxiliary
|
||||
provided library for it. An example of this is the Unix real-time
|
||||
functions such as clock_gettime.
|
||||
EA_HAVE_XXX_IMPL does not include the possibility that our
|
||||
own code provides versions of these implementations, and in fact a
|
||||
purpose of EA_HAVE_XXX_IMPL is to decide if we should be using
|
||||
our own because the system doesn't provide one.
|
||||
Implementation availability can be forcibly cancelled via EA_NO_HAVE_XXX_IMPL.
|
||||
EA_NO_HAVE is useful for a build system or user to override the
|
||||
defaults because it happens to know better.
|
||||
|
||||
It's not practical to define EA_HAVE macros for every possible header,
|
||||
declaration, and implementation, and so the user must simply know that
|
||||
some headers, declarations, and implementations tend to require EA_HAVE
|
||||
checking. Nearly every C Standard Library we've seen has a <string.h>
|
||||
header, a strlen declaration, and a linkable strlen implementation,
|
||||
so there's no need to provide EA_HAVE support for this. On the other hand
|
||||
it's commonly the case that the C Standard Library doesn't have a malloc.h
|
||||
header or an inet_ntop declaration.
|
||||
|
||||
---------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
#ifndef INCLUDED_eahave_H
|
||||
#define INCLUDED_eahave_H
|
||||
|
||||
|
||||
#include <EABase/eabase.h>
|
||||
|
||||
|
||||
#if defined(EA_PRAGMA_ONCE_SUPPORTED)
|
||||
#pragma once // Some compilers (e.g. VC++) benefit significantly from using this. We've measured 3-4% build speed improvements in apps as a result.
|
||||
#endif
|
||||
|
||||
/* EA_HAVE_XXX_FEATURE */
|
||||
|
||||
#if !defined(EA_HAVE_EXTENSIONS_FEATURE) && !defined(EA_NO_HAVE_EXTENSIONS_FEATURE)
|
||||
#define EA_HAVE_EXTENSIONS_FEATURE 1
|
||||
#endif
|
||||
|
||||
|
||||
/* EA_HAVE_XXX_LIBRARY */
|
||||
|
||||
// Dinkumware
|
||||
#if !defined(EA_HAVE_DINKUMWARE_CPP_LIBRARY) && !defined(EA_NO_HAVE_DINKUMWARE_CPP_LIBRARY)
|
||||
#if defined(__cplusplus)
|
||||
EA_DISABLE_ALL_VC_WARNINGS()
|
||||
#include <cstddef> // Need to trigger the compilation of yvals.h without directly using <yvals.h> because it might not exist.
|
||||
EA_RESTORE_ALL_VC_WARNINGS()
|
||||
#endif
|
||||
|
||||
#if defined(__cplusplus) && defined(_CPPLIB_VER) /* If using the Dinkumware Standard library... */
|
||||
#define EA_HAVE_DINKUMWARE_CPP_LIBRARY 1
|
||||
#else
|
||||
#define EA_NO_HAVE_DINKUMWARE_CPP_LIBRARY 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// GCC libstdc++
|
||||
#if !defined(EA_HAVE_LIBSTDCPP_LIBRARY) && !defined(EA_NO_HAVE_LIBSTDCPP_LIBRARY)
|
||||
#if defined(__GLIBCXX__) /* If using libstdc++ ... */
|
||||
#define EA_HAVE_LIBSTDCPP_LIBRARY 1
|
||||
#else
|
||||
#define EA_NO_HAVE_LIBSTDCPP_LIBRARY 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Clang libc++
|
||||
#if !defined(EA_HAVE_LIBCPP_LIBRARY) && !defined(EA_NO_HAVE_LIBCPP_LIBRARY)
|
||||
#if EA_HAS_INCLUDE_AVAILABLE
|
||||
#if EA_HAS_INCLUDE(<__config>)
|
||||
#define EA_HAVE_LIBCPP_LIBRARY 1 // We could also #include <ciso646> and check if defined(_LIBCPP_VERSION).
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !defined(EA_HAVE_LIBCPP_LIBRARY)
|
||||
#define EA_NO_HAVE_LIBCPP_LIBRARY 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
/* EA_HAVE_XXX_H */
|
||||
|
||||
// #include <sys/types.h>
|
||||
#if !defined(EA_HAVE_SYS_TYPES_H) && !defined(EA_NO_HAVE_SYS_TYPES_H)
|
||||
#define EA_HAVE_SYS_TYPES_H 1
|
||||
#endif
|
||||
|
||||
// #include <io.h> (and not sys/io.h or asm/io.h)
|
||||
#if !defined(EA_HAVE_IO_H) && !defined(EA_NO_HAVE_IO_H)
|
||||
// Unix doesn't have Microsoft's <io.h> but has the same functionality in <fcntl.h> and <sys/stat.h>.
|
||||
#if defined(EA_PLATFORM_MICROSOFT)
|
||||
#define EA_HAVE_IO_H 1
|
||||
#else
|
||||
#define EA_NO_HAVE_IO_H 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// #include <inttypes.h>
|
||||
#if !defined(EA_HAVE_INTTYPES_H) && !defined(EA_NO_HAVE_INTTYPES_H)
|
||||
#if !defined(EA_PLATFORM_MICROSOFT)
|
||||
#define EA_HAVE_INTTYPES_H 1
|
||||
#else
|
||||
#define EA_NO_HAVE_INTTYPES_H 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// #include <unistd.h>
|
||||
#if !defined(EA_HAVE_UNISTD_H) && !defined(EA_NO_HAVE_UNISTD_H)
|
||||
#if defined(EA_PLATFORM_UNIX)
|
||||
#define EA_HAVE_UNISTD_H 1
|
||||
#else
|
||||
#define EA_NO_HAVE_UNISTD_H 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// #include <sys/time.h>
|
||||
#if !defined(EA_HAVE_SYS_TIME_H) && !defined(EA_NO_HAVE_SYS_TIME_H)
|
||||
#if !defined(EA_PLATFORM_MICROSOFT) && !defined(_CPPLIB_VER) /* _CPPLIB_VER indicates Dinkumware. */
|
||||
#define EA_HAVE_SYS_TIME_H 1 /* defines struct timeval */
|
||||
#else
|
||||
#define EA_NO_HAVE_SYS_TIME_H 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// #include <ptrace.h>
|
||||
#if !defined(EA_HAVE_SYS_PTRACE_H) && !defined(EA_NO_HAVE_SYS_PTRACE_H)
|
||||
#if defined(EA_PLATFORM_UNIX) && !defined(__CYGWIN__) && (defined(EA_PLATFORM_DESKTOP) || defined(EA_PLATFORM_SERVER))
|
||||
#define EA_HAVE_SYS_PTRACE_H 1 /* declares the ptrace function */
|
||||
#else
|
||||
#define EA_NO_HAVE_SYS_PTRACE_H 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// #include <sys/stat.h>
|
||||
#if !defined(EA_HAVE_SYS_STAT_H) && !defined(EA_NO_HAVE_SYS_STAT_H)
|
||||
#if (defined(EA_PLATFORM_UNIX) && !(defined(EA_PLATFORM_SONY) && defined(EA_PLATFORM_CONSOLE))) || defined(__APPLE__) || defined(EA_PLATFORM_ANDROID)
|
||||
#define EA_HAVE_SYS_STAT_H 1 /* declares the stat struct and function */
|
||||
#else
|
||||
#define EA_NO_HAVE_SYS_STAT_H 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// #include <locale.h>
|
||||
#if !defined(EA_HAVE_LOCALE_H) && !defined(EA_NO_HAVE_LOCALE_H)
|
||||
#define EA_HAVE_LOCALE_H 1
|
||||
#endif
|
||||
|
||||
// #include <signal.h>
|
||||
#if !defined(EA_HAVE_SIGNAL_H) && !defined(EA_NO_HAVE_SIGNAL_H)
|
||||
#if !defined(EA_PLATFORM_BSD) && !defined(EA_PLATFORM_SONY) && !defined(CS_UNDEFINED_STRING)
|
||||
#define EA_HAVE_SIGNAL_H 1
|
||||
#else
|
||||
#define EA_NO_HAVE_SIGNAL_H 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// #include <sys/signal.h>
|
||||
#if !defined(EA_HAVE_SYS_SIGNAL_H) && !defined(EA_NO_HAVE_SYS_SIGNAL_H)
|
||||
#if defined(EA_PLATFORM_BSD) || defined(EA_PLATFORM_SONY)
|
||||
#define EA_HAVE_SYS_SIGNAL_H 1
|
||||
#else
|
||||
#define EA_NO_HAVE_SYS_SIGNAL_H 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// #include <pthread.h>
|
||||
#if !defined(EA_HAVE_PTHREAD_H) && !defined(EA_NO_HAVE_PTHREAD_H)
|
||||
#if defined(EA_PLATFORM_UNIX) || defined(EA_PLATFORM_APPLE) || defined(EA_PLATFORM_POSIX)
|
||||
#define EA_HAVE_PTHREAD_H 1 /* It can be had under Microsoft/Windows with the http://sourceware.org/pthreads-win32/ library */
|
||||
#else
|
||||
#define EA_NO_HAVE_PTHREAD_H 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// #include <wchar.h>
|
||||
#if !defined(EA_HAVE_WCHAR_H) && !defined(EA_NO_HAVE_WCHAR_H)
|
||||
#if defined(EA_PLATFORM_DESKTOP) && defined(EA_PLATFORM_UNIX) && defined(EA_PLATFORM_SONY) && defined(EA_PLATFORM_APPLE)
|
||||
#define EA_HAVE_WCHAR_H 1
|
||||
#else
|
||||
#define EA_NO_HAVE_WCHAR_H 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// #include <malloc.h>
|
||||
#if !defined(EA_HAVE_MALLOC_H) && !defined(EA_NO_HAVE_MALLOC_H)
|
||||
#if defined(_MSC_VER) || defined(__MINGW32__)
|
||||
#define EA_HAVE_MALLOC_H 1
|
||||
#else
|
||||
#define EA_NO_HAVE_MALLOC_H 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// #include <alloca.h>
|
||||
#if !defined(EA_HAVE_ALLOCA_H) && !defined(EA_NO_HAVE_ALLOCA_H)
|
||||
#if !defined(EA_HAVE_MALLOC_H) && !defined(EA_PLATFORM_SONY)
|
||||
#define EA_HAVE_ALLOCA_H 1
|
||||
#else
|
||||
#define EA_NO_HAVE_ALLOCA_H 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// #include <execinfo.h>
|
||||
#if !defined(EA_HAVE_EXECINFO_H) && !defined(EA_NO_HAVE_EXECINFO_H)
|
||||
#if (defined(EA_PLATFORM_LINUX) || defined(EA_PLATFORM_OSX)) && !defined(EA_PLATFORM_ANDROID)
|
||||
#define EA_HAVE_EXECINFO_H 1
|
||||
#else
|
||||
#define EA_NO_HAVE_EXECINFO_H 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// #include <semaphore.h> (Unix semaphore support)
|
||||
#if !defined(EA_HAVE_SEMAPHORE_H) && !defined(EA_NO_HAVE_SEMAPHORE_H)
|
||||
#if defined(EA_PLATFORM_UNIX)
|
||||
#define EA_HAVE_SEMAPHORE_H 1
|
||||
#else
|
||||
#define EA_NO_HAVE_SEMAPHORE_H 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// #include <dirent.h> (Unix semaphore support)
|
||||
#if !defined(EA_HAVE_DIRENT_H) && !defined(EA_NO_HAVE_DIRENT_H)
|
||||
#if defined(EA_PLATFORM_UNIX) && !defined(EA_PLATFORM_CONSOLE)
|
||||
#define EA_HAVE_DIRENT_H 1
|
||||
#else
|
||||
#define EA_NO_HAVE_DIRENT_H 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// #include <array>, <forward_list>, <ununordered_set>, <unordered_map>
|
||||
#if !defined(EA_HAVE_CPP11_CONTAINERS) && !defined(EA_NO_HAVE_CPP11_CONTAINERS)
|
||||
#if defined(EA_HAVE_DINKUMWARE_CPP_LIBRARY) && (_CPPLIB_VER >= 520) // Dinkumware. VS2010+
|
||||
#define EA_HAVE_CPP11_CONTAINERS 1
|
||||
#elif defined(EA_COMPILER_CPP11_ENABLED) && defined(EA_HAVE_LIBSTDCPP_LIBRARY) && defined(EA_COMPILER_GNUC) && (EA_COMPILER_VERSION >= 4004) // Actually GCC 4.3 supports array and unordered_
|
||||
#define EA_HAVE_CPP11_CONTAINERS 1
|
||||
#elif defined(EA_HAVE_LIBCPP_LIBRARY) && (_LIBCPP_VERSION >= 1)
|
||||
#define EA_HAVE_CPP11_CONTAINERS 1
|
||||
#else
|
||||
#define EA_NO_HAVE_CPP11_CONTAINERS 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// #include <atomic>
|
||||
#if !defined(EA_HAVE_CPP11_ATOMIC) && !defined(EA_NO_HAVE_CPP11_ATOMIC)
|
||||
#if defined(EA_HAVE_DINKUMWARE_CPP_LIBRARY) && (_CPPLIB_VER >= 540) // Dinkumware. VS2012+
|
||||
#define EA_HAVE_CPP11_ATOMIC 1
|
||||
#elif defined(EA_COMPILER_CPP11_ENABLED) && defined(EA_HAVE_LIBSTDCPP_LIBRARY) && defined(EA_COMPILER_GNUC) && (EA_COMPILER_VERSION >= 4007)
|
||||
#define EA_HAVE_CPP11_ATOMIC 1
|
||||
#elif defined(EA_HAVE_LIBCPP_LIBRARY) && (_LIBCPP_VERSION >= 1)
|
||||
#define EA_HAVE_CPP11_ATOMIC 1
|
||||
#else
|
||||
#define EA_NO_HAVE_CPP11_ATOMIC 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// #include <condition_variable>
|
||||
#if !defined(EA_HAVE_CPP11_CONDITION_VARIABLE) && !defined(EA_NO_HAVE_CPP11_CONDITION_VARIABLE)
|
||||
#if defined(EA_HAVE_DINKUMWARE_CPP_LIBRARY) && (_CPPLIB_VER >= 540) // Dinkumware. VS2012+
|
||||
#define EA_HAVE_CPP11_CONDITION_VARIABLE 1
|
||||
#elif defined(EA_COMPILER_CPP11_ENABLED) && defined(EA_HAVE_LIBSTDCPP_LIBRARY) && defined(EA_COMPILER_GNUC) && (EA_COMPILER_VERSION >= 4007)
|
||||
#define EA_HAVE_CPP11_CONDITION_VARIABLE 1
|
||||
#elif defined(EA_HAVE_LIBCPP_LIBRARY) && (_LIBCPP_VERSION >= 1)
|
||||
#define EA_HAVE_CPP11_CONDITION_VARIABLE 1
|
||||
#else
|
||||
#define EA_NO_HAVE_CPP11_CONDITION_VARIABLE 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// #include <mutex>
|
||||
#if !defined(EA_HAVE_CPP11_MUTEX) && !defined(EA_NO_HAVE_CPP11_MUTEX)
|
||||
#if defined(EA_HAVE_DINKUMWARE_CPP_LIBRARY) && (_CPPLIB_VER >= 540) // Dinkumware. VS2012+
|
||||
#define EA_HAVE_CPP11_MUTEX 1
|
||||
#elif defined(EA_COMPILER_CPP11_ENABLED) && defined(EA_HAVE_LIBSTDCPP_LIBRARY) && defined(EA_COMPILER_GNUC) && (EA_COMPILER_VERSION >= 4007)
|
||||
#define EA_HAVE_CPP11_MUTEX 1
|
||||
#elif defined(EA_HAVE_LIBCPP_LIBRARY) && (_LIBCPP_VERSION >= 1)
|
||||
#define EA_HAVE_CPP11_MUTEX 1
|
||||
#else
|
||||
#define EA_NO_HAVE_CPP11_MUTEX 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// #include <thread>
|
||||
#if !defined(EA_HAVE_CPP11_THREAD) && !defined(EA_NO_HAVE_CPP11_THREAD)
|
||||
#if defined(EA_HAVE_DINKUMWARE_CPP_LIBRARY) && (_CPPLIB_VER >= 540) // Dinkumware. VS2012+
|
||||
#define EA_HAVE_CPP11_THREAD 1
|
||||
#elif defined(EA_COMPILER_CPP11_ENABLED) && defined(EA_HAVE_LIBSTDCPP_LIBRARY) && defined(EA_COMPILER_GNUC) && (EA_COMPILER_VERSION >= 4007)
|
||||
#define EA_HAVE_CPP11_THREAD 1
|
||||
#elif defined(EA_HAVE_LIBCPP_LIBRARY) && (_LIBCPP_VERSION >= 1)
|
||||
#define EA_HAVE_CPP11_THREAD 1
|
||||
#else
|
||||
#define EA_NO_HAVE_CPP11_THREAD 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// #include <future>
|
||||
#if !defined(EA_HAVE_CPP11_FUTURE) && !defined(EA_NO_HAVE_CPP11_FUTURE)
|
||||
#if defined(EA_HAVE_DINKUMWARE_CPP_LIBRARY) && (_CPPLIB_VER >= 540) // Dinkumware. VS2012+
|
||||
#define EA_HAVE_CPP11_FUTURE 1
|
||||
#elif defined(EA_COMPILER_CPP11_ENABLED) && defined(EA_HAVE_LIBSTDCPP_LIBRARY) && defined(EA_COMPILER_GNUC) && (EA_COMPILER_VERSION >= 4005)
|
||||
#define EA_HAVE_CPP11_FUTURE 1
|
||||
#elif defined(EA_HAVE_LIBCPP_LIBRARY) && (_LIBCPP_VERSION >= 1)
|
||||
#define EA_HAVE_CPP11_FUTURE 1
|
||||
#else
|
||||
#define EA_NO_HAVE_CPP11_FUTURE 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
// #include <type_traits>
|
||||
#if !defined(EA_HAVE_CPP11_TYPE_TRAITS) && !defined(EA_NO_HAVE_CPP11_TYPE_TRAITS)
|
||||
#if defined(EA_HAVE_DINKUMWARE_CPP_LIBRARY) && (_CPPLIB_VER >= 540) // Dinkumware. VS2012+
|
||||
#define EA_HAVE_CPP11_TYPE_TRAITS 1
|
||||
#elif defined(EA_COMPILER_CPP11_ENABLED) && defined(EA_HAVE_LIBSTDCPP_LIBRARY) && defined(EA_COMPILER_GNUC) && (EA_COMPILER_VERSION >= 4007) // Prior versions of libstdc++ have incomplete support for C++11 type traits.
|
||||
#define EA_HAVE_CPP11_TYPE_TRAITS 1
|
||||
#elif defined(EA_HAVE_LIBCPP_LIBRARY) && (_LIBCPP_VERSION >= 1)
|
||||
#define EA_HAVE_CPP11_TYPE_TRAITS 1
|
||||
#else
|
||||
#define EA_NO_HAVE_CPP11_TYPE_TRAITS 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// #include <tuple>
|
||||
#if !defined(EA_HAVE_CPP11_TUPLES) && !defined(EA_NO_HAVE_CPP11_TUPLES)
|
||||
#if defined(EA_HAVE_DINKUMWARE_CPP_LIBRARY) && (_CPPLIB_VER >= 520) // Dinkumware. VS2010+
|
||||
#define EA_HAVE_CPP11_TUPLES 1
|
||||
#elif defined(EA_COMPILER_CPP11_ENABLED) && defined(EA_HAVE_LIBSTDCPP_LIBRARY) && defined(EA_COMPILER_GNUC) && (EA_COMPILER_VERSION >= 4003)
|
||||
#define EA_HAVE_CPP11_TUPLES 1
|
||||
#elif defined(EA_HAVE_LIBCPP_LIBRARY) && (_LIBCPP_VERSION >= 1)
|
||||
#define EA_HAVE_CPP11_TUPLES 1
|
||||
#else
|
||||
#define EA_NO_HAVE_CPP11_TUPLES 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// #include <regex>
|
||||
#if !defined(EA_HAVE_CPP11_REGEX) && !defined(EA_NO_HAVE_CPP11_REGEX)
|
||||
#if defined(EA_HAVE_DINKUMWARE_CPP_LIBRARY) && (_CPPLIB_VER >= 540) && (defined(_HAS_EXCEPTIONS) && _HAS_EXCEPTIONS) // Dinkumware. VS2012+
|
||||
#define EA_HAVE_CPP11_REGEX 1
|
||||
#elif defined(EA_COMPILER_CPP11_ENABLED) && defined(EA_HAVE_LIBSTDCPP_LIBRARY) && defined(EA_COMPILER_GNUC) && (EA_COMPILER_VERSION >= 4003)
|
||||
#define EA_HAVE_CPP11_REGEX 1
|
||||
#elif defined(EA_HAVE_LIBCPP_LIBRARY) && (_LIBCPP_VERSION >= 1)
|
||||
#define EA_HAVE_CPP11_REGEX 1
|
||||
#else
|
||||
#define EA_NO_HAVE_CPP11_REGEX 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// #include <random>
|
||||
#if !defined(EA_HAVE_CPP11_RANDOM) && !defined(EA_NO_HAVE_CPP11_RANDOM)
|
||||
#if defined(EA_HAVE_DINKUMWARE_CPP_LIBRARY) && (_CPPLIB_VER >= 520) // Dinkumware. VS2010+
|
||||
#define EA_HAVE_CPP11_RANDOM 1
|
||||
#elif defined(EA_COMPILER_CPP11_ENABLED) && defined(EA_HAVE_LIBSTDCPP_LIBRARY) && defined(EA_COMPILER_GNUC) && (EA_COMPILER_VERSION >= 4005)
|
||||
#define EA_HAVE_CPP11_RANDOM 1
|
||||
#elif defined(EA_HAVE_LIBCPP_LIBRARY) && (_LIBCPP_VERSION >= 1)
|
||||
#define EA_HAVE_CPP11_RANDOM 1
|
||||
#else
|
||||
#define EA_NO_HAVE_CPP11_RANDOM 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// #include <chrono>
|
||||
#if !defined(EA_HAVE_CPP11_CHRONO) && !defined(EA_NO_HAVE_CPP11_CHRONO)
|
||||
#if defined(EA_HAVE_DINKUMWARE_CPP_LIBRARY) && (_CPPLIB_VER >= 540) // Dinkumware. VS2012+
|
||||
#define EA_HAVE_CPP11_CHRONO 1
|
||||
#elif defined(EA_COMPILER_CPP11_ENABLED) && defined(EA_HAVE_LIBSTDCPP_LIBRARY) && defined(EA_COMPILER_GNUC) && (EA_COMPILER_VERSION >= 4007) // chrono was broken in glibc prior to 4.7.
|
||||
#define EA_HAVE_CPP11_CHRONO 1
|
||||
#elif defined(EA_HAVE_LIBCPP_LIBRARY) && (_LIBCPP_VERSION >= 1)
|
||||
#define EA_HAVE_CPP11_CHRONO 1
|
||||
#else
|
||||
#define EA_NO_HAVE_CPP11_CHRONO 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// #include <scoped_allocator>
|
||||
#if !defined(EA_HAVE_CPP11_SCOPED_ALLOCATOR) && !defined(EA_NO_HAVE_CPP11_SCOPED_ALLOCATOR)
|
||||
#if defined(EA_HAVE_DINKUMWARE_CPP_LIBRARY) && (_CPPLIB_VER >= 540) // Dinkumware. VS2012+
|
||||
#define EA_HAVE_CPP11_SCOPED_ALLOCATOR 1
|
||||
#elif defined(EA_COMPILER_CPP11_ENABLED) && defined(EA_HAVE_LIBSTDCPP_LIBRARY) && defined(EA_COMPILER_GNUC) && (EA_COMPILER_VERSION >= 4007)
|
||||
#define EA_HAVE_CPP11_SCOPED_ALLOCATOR 1
|
||||
#elif defined(EA_HAVE_LIBCPP_LIBRARY) && (_LIBCPP_VERSION >= 1)
|
||||
#define EA_HAVE_CPP11_SCOPED_ALLOCATOR 1
|
||||
#else
|
||||
#define EA_NO_HAVE_CPP11_SCOPED_ALLOCATOR 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// #include <initializer_list>
|
||||
#if !defined(EA_HAVE_CPP11_INITIALIZER_LIST) && !defined(EA_NO_HAVE_CPP11_INITIALIZER_LIST)
|
||||
#if defined(EA_HAVE_DINKUMWARE_CPP_LIBRARY) && (_CPPLIB_VER >= 520) && !defined(EA_COMPILER_NO_INITIALIZER_LISTS) // Dinkumware. VS2010+
|
||||
#define EA_HAVE_CPP11_INITIALIZER_LIST 1
|
||||
#elif defined(EA_COMPILER_CPP11_ENABLED) && defined(EA_HAVE_LIBSTDCPP_LIBRARY) && defined(EA_COMPILER_CLANG) && (EA_COMPILER_VERSION >= 301) && !defined(EA_COMPILER_NO_INITIALIZER_LISTS) && !defined(EA_PLATFORM_APPLE)
|
||||
#define EA_HAVE_CPP11_INITIALIZER_LIST 1
|
||||
#elif defined(EA_COMPILER_CPP11_ENABLED) && defined(EA_HAVE_LIBCPP_LIBRARY) && defined(EA_COMPILER_CLANG) && (EA_COMPILER_VERSION >= 301) && !defined(EA_COMPILER_NO_INITIALIZER_LISTS) && !defined(EA_PLATFORM_APPLE)
|
||||
#define EA_HAVE_CPP11_INITIALIZER_LIST 1
|
||||
#elif defined(EA_COMPILER_CPP11_ENABLED) && defined(EA_HAVE_LIBSTDCPP_LIBRARY) && defined(EA_COMPILER_GNUC) && (EA_COMPILER_VERSION >= 4004) && !defined(EA_COMPILER_NO_INITIALIZER_LISTS) && !defined(EA_PLATFORM_APPLE)
|
||||
#define EA_HAVE_CPP11_INITIALIZER_LIST 1
|
||||
#elif defined(EA_HAVE_LIBCPP_LIBRARY) && (_LIBCPP_VERSION >= 1) && !defined(EA_COMPILER_NO_INITIALIZER_LISTS)
|
||||
#define EA_HAVE_CPP11_INITIALIZER_LIST 1
|
||||
#else
|
||||
#define EA_NO_HAVE_CPP11_INITIALIZER_LIST 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// #include <system_error>
|
||||
#if !defined(EA_HAVE_CPP11_SYSTEM_ERROR) && !defined(EA_NO_HAVE_CPP11_SYSTEM_ERROR)
|
||||
#if defined(EA_HAVE_DINKUMWARE_CPP_LIBRARY) && (_CPPLIB_VER >= 520) && !(defined(_HAS_CPP0X) && _HAS_CPP0X) // Dinkumware. VS2010+
|
||||
#define EA_HAVE_CPP11_SYSTEM_ERROR 1
|
||||
#elif defined(EA_COMPILER_CPP11_ENABLED) && defined(EA_HAVE_LIBSTDCPP_LIBRARY) && defined(EA_COMPILER_CLANG) && (EA_COMPILER_VERSION >= 301) && !defined(EA_PLATFORM_APPLE)
|
||||
#define EA_HAVE_CPP11_SYSTEM_ERROR 1
|
||||
#elif defined(EA_COMPILER_CPP11_ENABLED) && defined(EA_HAVE_LIBSTDCPP_LIBRARY) && defined(EA_COMPILER_GNUC) && (EA_COMPILER_VERSION >= 4004) && !defined(EA_PLATFORM_APPLE)
|
||||
#define EA_HAVE_CPP11_SYSTEM_ERROR 1
|
||||
#elif defined(EA_HAVE_LIBCPP_LIBRARY) && (_LIBCPP_VERSION >= 1)
|
||||
#define EA_HAVE_CPP11_SYSTEM_ERROR 1
|
||||
#else
|
||||
#define EA_NO_HAVE_CPP11_SYSTEM_ERROR 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// #include <codecvt>
|
||||
#if !defined(EA_HAVE_CPP11_CODECVT) && !defined(EA_NO_HAVE_CPP11_CODECVT)
|
||||
#if defined(EA_HAVE_DINKUMWARE_CPP_LIBRARY) && (_CPPLIB_VER >= 520) // Dinkumware. VS2010+
|
||||
#define EA_HAVE_CPP11_CODECVT 1
|
||||
// Future versions of libc++ may support this header. However, at the moment there isn't
|
||||
// a reliable way of detecting if this header is available.
|
||||
//#elif defined(EA_COMPILER_CPP11_ENABLED) && defined(EA_HAVE_LIBSTDCPP_LIBRARY) && defined(EA_COMPILER_GNUC) && (EA_COMPILER_VERSION >= 4008)
|
||||
// #define EA_HAVE_CPP11_CODECVT 1
|
||||
#elif defined(EA_HAVE_LIBCPP_LIBRARY) && (_LIBCPP_VERSION >= 1)
|
||||
#define EA_HAVE_CPP11_CODECVT 1
|
||||
#else
|
||||
#define EA_NO_HAVE_CPP11_CODECVT 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// #include <typeindex>
|
||||
#if !defined(EA_HAVE_CPP11_TYPEINDEX) && !defined(EA_NO_HAVE_CPP11_TYPEINDEX)
|
||||
#if defined(EA_HAVE_DINKUMWARE_CPP_LIBRARY) && (_CPPLIB_VER >= 520) // Dinkumware. VS2010+
|
||||
#define EA_HAVE_CPP11_TYPEINDEX 1
|
||||
#elif defined(EA_COMPILER_CPP11_ENABLED) && defined(EA_HAVE_LIBSTDCPP_LIBRARY) && defined(EA_COMPILER_GNUC) && (EA_COMPILER_VERSION >= 4006)
|
||||
#define EA_HAVE_CPP11_TYPEINDEX 1
|
||||
#elif defined(EA_HAVE_LIBCPP_LIBRARY) && (_LIBCPP_VERSION >= 1)
|
||||
#define EA_HAVE_CPP11_TYPEINDEX 1
|
||||
#else
|
||||
#define EA_NO_HAVE_CPP11_TYPEINDEX 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
/* EA_HAVE_XXX_DECL */
|
||||
|
||||
#if !defined(EA_HAVE_mkstemps_DECL) && !defined(EA_NO_HAVE_mkstemps_DECL)
|
||||
#if defined(EA_PLATFORM_APPLE) || defined(CS_UNDEFINED_STRING)
|
||||
#define EA_HAVE_mkstemps_DECL 1
|
||||
#else
|
||||
#define EA_NO_HAVE_mkstemps_DECL 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !defined(EA_HAVE_gettimeofday_DECL) && !defined(EA_NO_HAVE_gettimeofday_DECL)
|
||||
#if defined(EA_PLATFORM_POSIX) /* Posix means Linux, Unix, and Macintosh OSX, among others (including Linux-based mobile platforms). */
|
||||
#define EA_HAVE_gettimeofday_DECL 1
|
||||
#else
|
||||
#define EA_NO_HAVE_gettimeofday_DECL 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !defined(EA_HAVE_strcasecmp_DECL) && !defined(EA_NO_HAVE_strcasecmp_DECL)
|
||||
#if !defined(EA_PLATFORM_MICROSOFT)
|
||||
#define EA_HAVE_strcasecmp_DECL 1 /* This is found as stricmp when not found as strcasecmp */
|
||||
#define EA_HAVE_strncasecmp_DECL 1
|
||||
#else
|
||||
#define EA_HAVE_stricmp_DECL 1
|
||||
#define EA_HAVE_strnicmp_DECL 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !defined(EA_HAVE_mmap_DECL) && !defined(EA_NO_HAVE_mmap_DECL)
|
||||
#if defined(EA_PLATFORM_POSIX)
|
||||
#define EA_HAVE_mmap_DECL 1 /* mmap functionality varies significantly between systems. */
|
||||
#else
|
||||
#define EA_NO_HAVE_mmap_DECL 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !defined(EA_HAVE_fopen_DECL) && !defined(EA_NO_HAVE_fopen_DECL)
|
||||
#define EA_HAVE_fopen_DECL 1 /* C FILE functionality such as fopen */
|
||||
#endif
|
||||
|
||||
#if !defined(EA_HAVE_ISNAN) && !defined(EA_NO_HAVE_ISNAN)
|
||||
#if defined(EA_PLATFORM_MICROSOFT) && !defined(EA_PLATFORM_MINGW)
|
||||
#define EA_HAVE_ISNAN(x) _isnan(x) /* declared in <math.h> */
|
||||
#define EA_HAVE_ISINF(x) !_finite(x)
|
||||
#elif defined(EA_PLATFORM_APPLE)
|
||||
#define EA_HAVE_ISNAN(x) std::isnan(x) /* declared in <cmath> */
|
||||
#define EA_HAVE_ISINF(x) std::isinf(x)
|
||||
#elif defined(EA_PLATFORM_ANDROID)
|
||||
#define EA_HAVE_ISNAN(x) __builtin_isnan(x) /* There are a number of standard libraries for Android and it's hard to tell them apart, so just go with builtins */
|
||||
#define EA_HAVE_ISINF(x) __builtin_isinf(x)
|
||||
#elif defined(__GNUC__) && defined(__CYGWIN__)
|
||||
#define EA_HAVE_ISNAN(x) __isnand(x) /* declared nowhere, it seems. */
|
||||
#define EA_HAVE_ISINF(x) __isinfd(x)
|
||||
#else
|
||||
#define EA_HAVE_ISNAN(x) std::isnan(x) /* declared in <cmath> */
|
||||
#define EA_HAVE_ISINF(x) std::isinf(x)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !defined(EA_HAVE_itoa_DECL) && !defined(EA_NO_HAVE_itoa_DECL)
|
||||
#if defined(EA_COMPILER_MSVC)
|
||||
#define EA_HAVE_itoa_DECL 1
|
||||
#else
|
||||
#define EA_NO_HAVE_itoa_DECL 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !defined(EA_HAVE_nanosleep_DECL) && !defined(EA_NO_HAVE_nanosleep_DECL)
|
||||
#if (defined(EA_PLATFORM_UNIX) && !defined(EA_PLATFORM_SONY)) || defined(EA_PLATFORM_IPHONE) || defined(EA_PLATFORM_OSX) || defined(EA_PLATFORM_SONY) || defined(CS_UNDEFINED_STRING)
|
||||
#define EA_HAVE_nanosleep_DECL 1
|
||||
#else
|
||||
#define EA_NO_HAVE_nanosleep_DECL 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !defined(EA_HAVE_utime_DECL) && !defined(EA_NO_HAVE_utime_DECL)
|
||||
#if defined(EA_PLATFORM_MICROSOFT)
|
||||
#define EA_HAVE_utime_DECL _utime
|
||||
#elif EA_PLATFORM_UNIX
|
||||
#define EA_HAVE_utime_DECL utime
|
||||
#else
|
||||
#define EA_NO_HAVE_utime_DECL 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !defined(EA_HAVE_ftruncate_DECL) && !defined(EA_NO_HAVE_ftruncate_DECL)
|
||||
#if !defined(__MINGW32__)
|
||||
#define EA_HAVE_ftruncate_DECL 1
|
||||
#else
|
||||
#define EA_NO_HAVE_ftruncate_DECL 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !defined(EA_HAVE_localtime_DECL) && !defined(EA_NO_HAVE_localtime_DECL)
|
||||
#define EA_HAVE_localtime_DECL 1
|
||||
#endif
|
||||
|
||||
#if !defined(EA_HAVE_pthread_getattr_np_DECL) && !defined(EA_NO_HAVE_pthread_getattr_np_DECL)
|
||||
#if defined(EA_PLATFORM_LINUX)
|
||||
#define EA_HAVE_pthread_getattr_np_DECL 1
|
||||
#else
|
||||
#define EA_NO_HAVE_pthread_getattr_np_DECL 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/* EA_HAVE_XXX_IMPL*/
|
||||
|
||||
#if !defined(EA_HAVE_WCHAR_IMPL) && !defined(EA_NO_HAVE_WCHAR_IMPL)
|
||||
#if defined(EA_PLATFORM_DESKTOP)
|
||||
#define EA_HAVE_WCHAR_IMPL 1 /* Specifies if wchar_t string functions are provided, such as wcslen, wprintf, etc. Implies EA_HAVE_WCHAR_H */
|
||||
#else
|
||||
#define EA_NO_HAVE_WCHAR_IMPL 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !defined(EA_HAVE_getenv_IMPL) && !defined(EA_NO_HAVE_getenv_IMPL)
|
||||
#if (defined(EA_PLATFORM_DESKTOP) || defined(EA_PLATFORM_UNIX)) && !defined(EA_PLATFORM_WINRT)
|
||||
#define EA_HAVE_getenv_IMPL 1
|
||||
#else
|
||||
#define EA_NO_HAVE_getenv_IMPL 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !defined(EA_HAVE_setenv_IMPL) && !defined(EA_NO_HAVE_setenv_IMPL)
|
||||
#if defined(EA_PLATFORM_UNIX) && defined(EA_PLATFORM_POSIX)
|
||||
#define EA_HAVE_setenv_IMPL 1
|
||||
#else
|
||||
#define EA_NO_HAVE_setenv_IMPL 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !defined(EA_HAVE_unsetenv_IMPL) && !defined(EA_NO_HAVE_unsetenv_IMPL)
|
||||
#if defined(EA_PLATFORM_UNIX) && defined(EA_PLATFORM_POSIX)
|
||||
#define EA_HAVE_unsetenv_IMPL 1
|
||||
#else
|
||||
#define EA_NO_HAVE_unsetenv_IMPL 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !defined(EA_HAVE_putenv_IMPL) && !defined(EA_NO_HAVE_putenv_IMPL)
|
||||
#if (defined(EA_PLATFORM_DESKTOP) || defined(EA_PLATFORM_UNIX)) && !defined(EA_PLATFORM_WINRT)
|
||||
#define EA_HAVE_putenv_IMPL 1 /* With Microsoft compilers you may need to use _putenv, as they have deprecated putenv. */
|
||||
#else
|
||||
#define EA_NO_HAVE_putenv_IMPL 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !defined(EA_HAVE_time_IMPL) && !defined(EA_NO_HAVE_time_IMPL)
|
||||
#define EA_HAVE_time_IMPL 1
|
||||
#define EA_HAVE_clock_IMPL 1
|
||||
#endif
|
||||
|
||||
// <cstdio> fopen()
|
||||
#if !defined(EA_HAVE_fopen_IMPL) && !defined(EA_NO_HAVE_fopen_IMPL)
|
||||
#define EA_HAVE_fopen_IMPL 1 /* C FILE functionality such as fopen */
|
||||
#endif
|
||||
|
||||
// <arpa/inet.h> inet_ntop()
|
||||
#if !defined(EA_HAVE_inet_ntop_IMPL) && !defined(EA_NO_HAVE_inet_ntop_IMPL)
|
||||
#if (defined(EA_PLATFORM_UNIX) || defined(EA_PLATFORM_POSIX)) && !defined(EA_PLATFORM_SONY) && !defined(CS_UNDEFINED_STRING)
|
||||
#define EA_HAVE_inet_ntop_IMPL 1 /* This doesn't identify if the platform SDK has some alternative function that does the same thing; */
|
||||
#define EA_HAVE_inet_pton_IMPL 1 /* it identifies strictly the <arpa/inet.h> inet_ntop and inet_pton functions. For example, Microsoft has InetNtop in <Ws2tcpip.h> */
|
||||
#else
|
||||
#define EA_NO_HAVE_inet_ntop_IMPL 1
|
||||
#define EA_NO_HAVE_inet_pton_IMPL 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// <time.h> clock_gettime()
|
||||
#if !defined(EA_HAVE_clock_gettime_IMPL) && !defined(EA_NO_HAVE_clock_gettime_IMPL)
|
||||
#if defined(EA_PLATFORM_LINUX) || defined(__CYGWIN__) || (defined(_POSIX_TIMERS) && (_POSIX_TIMERS > 0)) || (defined(EA_PLATFORM_POSIX) && defined(_CPPLIB_VER) /*Dinkumware*/)
|
||||
#define EA_HAVE_clock_gettime_IMPL 1 /* You need to link the 'rt' library to get this */
|
||||
#else
|
||||
#define EA_NO_HAVE_clock_gettime_IMPL 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !defined(EA_HAVE_getcwd_IMPL) && !defined(EA_NO_HAVE_getcwd_IMPL)
|
||||
#if (defined(EA_PLATFORM_DESKTOP) || defined(EA_PLATFORM_UNIX)) && !defined(EA_PLATFORM_ANDROID) && !defined(EA_PLATFORM_WINRT)
|
||||
#define EA_HAVE_getcwd_IMPL 1 /* With Microsoft compilers you may need to use _getcwd, as they have deprecated getcwd. And in any case it's present at <direct.h> */
|
||||
#else
|
||||
#define EA_NO_HAVE_getcwd_IMPL 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !defined(EA_HAVE_tmpnam_IMPL) && !defined(EA_NO_HAVE_tmpnam_IMPL)
|
||||
#if (defined(EA_PLATFORM_DESKTOP) || defined(EA_PLATFORM_UNIX)) && !defined(EA_PLATFORM_ANDROID)
|
||||
#define EA_HAVE_tmpnam_IMPL 1
|
||||
#else
|
||||
#define EA_NO_HAVE_tmpnam_IMPL 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// nullptr, the built-in C++11 type.
|
||||
// This EA_HAVE is deprecated, as EA_COMPILER_NO_NULLPTR is more appropriate, given that nullptr is a compiler-level feature and not a library feature.
|
||||
#if !defined(EA_HAVE_nullptr_IMPL) && !defined(EA_NO_HAVE_nullptr_IMPL)
|
||||
#if defined(EA_COMPILER_NO_NULLPTR)
|
||||
#define EA_NO_HAVE_nullptr_IMPL 1
|
||||
#else
|
||||
#define EA_HAVE_nullptr_IMPL 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// <cstddef> std::nullptr_t
|
||||
// Note that <EABase/nullptr.h> implements a portable nullptr implementation, but this
|
||||
// EA_HAVE specifically refers to std::nullptr_t from the standard libraries.
|
||||
#if !defined(EA_HAVE_nullptr_t_IMPL) && !defined(EA_NO_HAVE_nullptr_t_IMPL)
|
||||
#if defined(EA_COMPILER_CPP11_ENABLED)
|
||||
// VS2010+ with its default Dinkumware standard library.
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1600) && defined(EA_HAVE_DINKUMWARE_CPP_LIBRARY)
|
||||
#define EA_HAVE_nullptr_t_IMPL 1
|
||||
|
||||
#elif defined(EA_HAVE_LIBCPP_LIBRARY) // clang/llvm libc++
|
||||
#define EA_HAVE_nullptr_t_IMPL 1
|
||||
|
||||
#elif defined(EA_HAVE_LIBSTDCPP_LIBRARY) // GNU libstdc++
|
||||
// Unfortunately __GLIBCXX__ date values don't go strictly in version ordering.
|
||||
#if (__GLIBCXX__ >= 20110325) && (__GLIBCXX__ != 20120702) && (__GLIBCXX__ != 20110428)
|
||||
#define EA_HAVE_nullptr_t_IMPL 1
|
||||
#else
|
||||
#define EA_NO_HAVE_nullptr_t_IMPL 1
|
||||
#endif
|
||||
|
||||
// We simply assume that the standard library (e.g. Dinkumware) provides std::nullptr_t.
|
||||
#elif defined(__clang__)
|
||||
#define EA_HAVE_nullptr_t_IMPL 1
|
||||
|
||||
// With GCC compiler >= 4.6, std::nullptr_t is always defined in <cstddef>, in practice.
|
||||
#elif defined(EA_COMPILER_GNUC) && (EA_COMPILER_VERSION >= 4006)
|
||||
#define EA_HAVE_nullptr_t_IMPL 1
|
||||
|
||||
// The EDG compiler provides nullptr, but uses an older standard library that doesn't support std::nullptr_t.
|
||||
#elif defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 403)
|
||||
#define EA_HAVE_nullptr_t_IMPL 1
|
||||
|
||||
#else
|
||||
#define EA_NO_HAVE_nullptr_t_IMPL 1
|
||||
#endif
|
||||
#else
|
||||
#define EA_NO_HAVE_nullptr_t_IMPL 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// <exception> std::terminate
|
||||
#if !defined(EA_HAVE_std_terminate_IMPL) && !defined(EA_NO_HAVE_std_terminate_IMPL)
|
||||
#if !defined(EA_PLATFORM_IPHONE) && !defined(EA_PLATFORM_ANDROID)
|
||||
#define EA_HAVE_std_terminate_IMPL 1 /* iOS doesn't appear to provide an implementation for std::terminate under the armv6 target. */
|
||||
#else
|
||||
#define EA_NO_HAVE_std_terminate_IMPL 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// <iterator>: std::begin, std::end, std::prev, std::next, std::move_iterator.
|
||||
#if !defined(EA_HAVE_CPP11_ITERATOR_IMPL) && !defined(EA_NO_HAVE_CPP11_ITERATOR_IMPL)
|
||||
#if defined(EA_HAVE_DINKUMWARE_CPP_LIBRARY) && (_CPPLIB_VER >= 520) && !(defined(_HAS_CPP0X) && _HAS_CPP0X) // Dinkumware. VS2010+
|
||||
#define EA_HAVE_CPP11_ITERATOR_IMPL 1
|
||||
#elif defined(EA_COMPILER_CPP11_ENABLED) && defined(EA_HAVE_LIBSTDCPP_LIBRARY) && defined(EA_COMPILER_GNUC) && (EA_COMPILER_VERSION >= 4006)
|
||||
#define EA_HAVE_CPP11_ITERATOR_IMPL 1
|
||||
#elif defined(EA_HAVE_LIBCPP_LIBRARY) && (_LIBCPP_VERSION >= 1)
|
||||
#define EA_HAVE_CPP11_ITERATOR_IMPL 1
|
||||
#else
|
||||
#define EA_NO_HAVE_CPP11_ITERATOR_IMPL 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// <memory>: std::weak_ptr, std::shared_ptr, std::unique_ptr, std::bad_weak_ptr, std::owner_less
|
||||
#if !defined(EA_HAVE_CPP11_SMART_POINTER_IMPL) && !defined(EA_NO_HAVE_CPP11_SMART_POINTER_IMPL)
|
||||
#if defined(EA_HAVE_DINKUMWARE_CPP_LIBRARY) && (_CPPLIB_VER >= 520) && !(defined(_HAS_CPP0X) && _HAS_CPP0X) // Dinkumware. VS2010+
|
||||
#define EA_HAVE_CPP11_SMART_POINTER_IMPL 1
|
||||
#elif defined(EA_COMPILER_CPP11_ENABLED) && defined(EA_HAVE_LIBSTDCPP_LIBRARY) && defined(EA_COMPILER_GNUC) && (EA_COMPILER_VERSION >= 4004)
|
||||
#define EA_HAVE_CPP11_SMART_POINTER_IMPL 1
|
||||
#elif defined(EA_HAVE_LIBCPP_LIBRARY) && (_LIBCPP_VERSION >= 1)
|
||||
#define EA_HAVE_CPP11_SMART_POINTER_IMPL 1
|
||||
#else
|
||||
#define EA_NO_HAVE_CPP11_SMART_POINTER_IMPL 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// <functional>: std::function, std::mem_fn, std::bad_function_call, std::is_bind_expression, std::is_placeholder, std::reference_wrapper, std::hash, std::bind, std::ref, std::cref.
|
||||
#if !defined(EA_HAVE_CPP11_FUNCTIONAL_IMPL) && !defined(EA_NO_HAVE_CPP11_FUNCTIONAL_IMPL)
|
||||
#if defined(EA_HAVE_DINKUMWARE_CPP_LIBRARY) && (_CPPLIB_VER >= 520) && !(defined(_HAS_CPP0X) && _HAS_CPP0X) // Dinkumware. VS2010+
|
||||
#define EA_HAVE_CPP11_FUNCTIONAL_IMPL 1
|
||||
#elif defined(EA_COMPILER_CPP11_ENABLED) && defined(EA_HAVE_LIBSTDCPP_LIBRARY) && defined(EA_COMPILER_GNUC) && (EA_COMPILER_VERSION >= 4004)
|
||||
#define EA_HAVE_CPP11_FUNCTIONAL_IMPL 1
|
||||
#elif defined(EA_HAVE_LIBCPP_LIBRARY) && (_LIBCPP_VERSION >= 1)
|
||||
#define EA_HAVE_CPP11_FUNCTIONAL_IMPL 1
|
||||
#else
|
||||
#define EA_NO_HAVE_CPP11_FUNCTIONAL_IMPL 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// <exception> std::current_exception, std::rethrow_exception, std::exception_ptr, std::make_exception_ptr
|
||||
#if !defined(EA_HAVE_CPP11_EXCEPTION_IMPL) && !defined(EA_NO_HAVE_CPP11_EXCEPTION_IMPL)
|
||||
#if defined(EA_HAVE_DINKUMWARE_CPP_LIBRARY) && (_CPPLIB_VER >= 520) && !(defined(_HAS_CPP0X) && _HAS_CPP0X) // Dinkumware. VS2010+
|
||||
#define EA_HAVE_CPP11_EXCEPTION_IMPL 1
|
||||
#elif defined(EA_COMPILER_CPP11_ENABLED) && defined(EA_HAVE_LIBSTDCPP_LIBRARY) && defined(EA_COMPILER_GNUC) && (EA_COMPILER_VERSION >= 4004)
|
||||
#define EA_HAVE_CPP11_EXCEPTION_IMPL 1
|
||||
#elif defined(EA_HAVE_LIBCPP_LIBRARY) && (_LIBCPP_VERSION >= 1)
|
||||
#define EA_HAVE_CPP11_EXCEPTION_IMPL 1
|
||||
#else
|
||||
#define EA_NO_HAVE_CPP11_EXCEPTION_IMPL 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
/* Implementations that all platforms seem to have: */
|
||||
/*
|
||||
alloca
|
||||
malloc
|
||||
calloc
|
||||
strtoll
|
||||
strtoull
|
||||
vsprintf
|
||||
vsnprintf
|
||||
*/
|
||||
|
||||
/* Implementations that we don't care about: */
|
||||
/*
|
||||
bcopy -- Just use memmove or some customized equivalent. bcopy offers no practical benefit.
|
||||
strlcpy -- So few platforms have this built-in that we get no benefit from using it. Use EA::StdC::Strlcpy instead.
|
||||
strlcat -- "
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------------
|
||||
EABASE_USER_HAVE_HEADER
|
||||
|
||||
This allows the user to define a header file to be #included after the
|
||||
eahave.h's contents are compiled. A primary use of this is to override
|
||||
the contents of this header file. You can define the overhead header
|
||||
file name in-code or define it globally as part of your build file.
|
||||
|
||||
Example usage:
|
||||
#define EABASE_USER_HAVE_HEADER "MyHaveOverrides.h"
|
||||
#include <EABase/eahave.h>
|
||||
---------------------------------------------------------------------------*/
|
||||
|
||||
#ifdef EABASE_USER_HAVE_HEADER
|
||||
#include EABASE_USER_HAVE_HEADER
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* Header include guard */
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
/*-----------------------------------------------------------------------------
|
||||
* earesult.h
|
||||
*
|
||||
* Copyright (c) Electronic Arts Inc. All rights reserved.
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
#ifndef INCLUDED_earesult_H
|
||||
#define INCLUDED_earesult_H
|
||||
|
||||
|
||||
#include <EABase/eabase.h>
|
||||
|
||||
#if defined(EA_PRAGMA_ONCE_SUPPORTED)
|
||||
#pragma once /* Some compilers (e.g. VC++) benefit significantly from using this. We've measured 3-4% build speed improvements in apps as a result. */
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/* This result type is width-compatible with most systems. */
|
||||
typedef int32_t ea_result_type;
|
||||
|
||||
|
||||
namespace EA
|
||||
{
|
||||
typedef int32_t result_type;
|
||||
|
||||
enum
|
||||
{
|
||||
#ifndef SUCCESS
|
||||
// Deprecated
|
||||
// Note: a public MS header has created a define of this name which causes a build error. Fortunately they
|
||||
// define it to 0 which is compatible.
|
||||
// see: WindowsSDK\8.1.51641-fb\installed\Include\um\RasError.h
|
||||
SUCCESS = 0,
|
||||
#endif
|
||||
// Deprecated
|
||||
FAILURE = -1,
|
||||
|
||||
// These values are now the preferred constants
|
||||
EA_SUCCESS = 0,
|
||||
EA_FAILURE = -1,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/* Macro to simplify testing for success. */
|
||||
#ifndef EA_SUCCEEDED
|
||||
#define EA_SUCCEEDED(result) ((result) >= 0)
|
||||
#endif
|
||||
|
||||
/* Macro to simplfify testing for general failure. */
|
||||
#ifndef EA_FAILED
|
||||
#define EA_FAILED(result) ((result) < 0)
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
/*-----------------------------------------------------------------------------
|
||||
* eastdarg.h
|
||||
*
|
||||
* Copyright (c) Electronic Arts Inc. All rights reserved.
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
#ifndef INCLUDED_eastdarg_H
|
||||
#define INCLUDED_eastdarg_H
|
||||
|
||||
|
||||
#include <EABase/eabase.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
|
||||
// VA_ARG_COUNT
|
||||
//
|
||||
// Returns the number of arguments passed to a macro's ... argument.
|
||||
// This applies to macros only and not functions.
|
||||
//
|
||||
// Example usage:
|
||||
// assert(VA_ARG_COUNT() == 0);
|
||||
// assert(VA_ARG_COUNT(a) == 1);
|
||||
// assert(VA_ARG_COUNT(a, b) == 2);
|
||||
// assert(VA_ARG_COUNT(a, b, c) == 3);
|
||||
//
|
||||
#if !defined(VA_ARG_COUNT)
|
||||
#define VA_ARG_COUNT(...) VA_ARG_COUNT_II((VA_ARG_COUNT_PREFIX_ ## __VA_ARGS__ ## _VA_ARG_COUNT_POSTFIX,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0))
|
||||
#define VA_ARG_COUNT_II(__args) VA_ARG_COUNT_I __args
|
||||
#define VA_ARG_COUNT_PREFIX__VA_ARG_COUNT_POSTFIX ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0
|
||||
#define VA_ARG_COUNT_I(_0,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20,_21,_22,_23,_24,_25,_26,_27,_28,_29,_30,_31,N,...) N
|
||||
#endif
|
||||
|
||||
|
||||
// va_copy
|
||||
//
|
||||
// va_copy is required by C++11
|
||||
// C++11 and C99 require va_copy to be #defined and implemented.
|
||||
// http://en.cppreference.com/w/cpp/utility/variadic/va_copy
|
||||
//
|
||||
// Example usage:
|
||||
// void Func(char* p, ...){
|
||||
// va_list args, argsCopy;
|
||||
// va_start(args, p);
|
||||
// va_copy(argsCopy, args);
|
||||
// (use args)
|
||||
// (use argsCopy, which acts the same as args)
|
||||
// va_end(args);
|
||||
// va_end(argsCopy);
|
||||
// }
|
||||
//
|
||||
#ifndef va_copy
|
||||
#if defined(__va_copy) // GCC and others define this for non-C99 compatibility.
|
||||
#define va_copy(dest, src) __va_copy((dest), (src))
|
||||
#else
|
||||
// This may not work for some platforms, depending on their ABI.
|
||||
// It works for Microsoft x86,x64, and PowerPC-based platforms.
|
||||
#define va_copy(dest, src) memcpy(&(dest), &(src), sizeof(va_list))
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
// va_list_reference
|
||||
//
|
||||
// va_list_reference is not part of the C or C++ standards.
|
||||
// It allows you to pass a va_list by reference to another
|
||||
// function instead of by value. You cannot simply use va_list&
|
||||
// as that won't work with many va_list implementations because
|
||||
// they are implemented as arrays (which can't be passed by
|
||||
// reference to a function without decaying to a pointer).
|
||||
//
|
||||
// Example usage:
|
||||
// void Test(va_list_reference args){
|
||||
// printf("%d", va_arg(args, int));
|
||||
// }
|
||||
// void Func(char* p, ...){
|
||||
// va_list args;
|
||||
// va_start(args, p);
|
||||
// Test(args); // Upon return args will be modified.
|
||||
// va_end(args);
|
||||
// }
|
||||
#ifndef va_list_reference
|
||||
#if defined(EA_PLATFORM_MICROSOFT) || (EA_PLATFORM_PTR_SIZE == 4) || (defined(EA_PLATFORM_APPLE) && defined(EA_PROCESSOR_ARM64)) || defined(CS_UNDEFINED_STRING) || (defined(EA_PLATFORM_ANDROID) && defined(EA_PROCESSOR_ARM64))
|
||||
// This is required for platform ABIs in which va_list is a struct or pointer.
|
||||
#define va_list_reference va_list&
|
||||
#else
|
||||
// This is required for platform ABIs in which va_list is defined to be an array.
|
||||
#define va_list_reference va_list
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* Header include guard */
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
/*-----------------------------------------------------------------------------
|
||||
* eaunits.h
|
||||
*
|
||||
* Copyright (c) Electronic Arts Inc. All rights reserved.
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
#ifndef INCLUDED_eaunits_h
|
||||
#define INCLUDED_eaunits_h
|
||||
|
||||
#include <EABase/eabase.h>
|
||||
|
||||
#if defined(EA_PRAGMA_ONCE_SUPPORTED)
|
||||
#pragma once // Some compilers (e.g. VC++) benefit significantly from using this. We've measured 3-4% build speed improvements in apps as a result.
|
||||
#endif
|
||||
|
||||
// Defining common SI unit macros.
|
||||
//
|
||||
// The mebibyte is a multiple of the unit byte for digital information. Technically a
|
||||
// megabyte (MB) is a power of ten, while a mebibyte (MiB) is a power of two,
|
||||
// appropriate for binary machines. Many Linux distributions use the unit, but it is
|
||||
// not widely acknowledged within the industry or media.
|
||||
// Reference: https://en.wikipedia.org/wiki/Mebibyte
|
||||
//
|
||||
// Examples:
|
||||
// auto size1 = EA_KILOBYTE(16);
|
||||
// auto size2 = EA_MEGABYTE(128);
|
||||
// auto size3 = EA_MEBIBYTE(8);
|
||||
// auto size4 = EA_GIBIBYTE(8);
|
||||
|
||||
// define byte for completeness
|
||||
#define EA_BYTE(x) (x)
|
||||
|
||||
// Decimal SI units
|
||||
#define EA_KILOBYTE(x) (size_t(x) * 1000)
|
||||
#define EA_MEGABYTE(x) (size_t(x) * 1000 * 1000)
|
||||
#define EA_GIGABYTE(x) (size_t(x) * 1000 * 1000 * 1000)
|
||||
#define EA_TERABYTE(x) (size_t(x) * 1000 * 1000 * 1000 * 1000)
|
||||
#define EA_PETABYTE(x) (size_t(x) * 1000 * 1000 * 1000 * 1000 * 1000)
|
||||
#define EA_EXABYTE(x) (size_t(x) * 1000 * 1000 * 1000 * 1000 * 1000 * 1000)
|
||||
|
||||
// Binary SI units
|
||||
#define EA_KIBIBYTE(x) (size_t(x) * 1024)
|
||||
#define EA_MEBIBYTE(x) (size_t(x) * 1024 * 1024)
|
||||
#define EA_GIBIBYTE(x) (size_t(x) * 1024 * 1024 * 1024)
|
||||
#define EA_TEBIBYTE(x) (size_t(x) * 1024 * 1024 * 1024 * 1024)
|
||||
#define EA_PEBIBYTE(x) (size_t(x) * 1024 * 1024 * 1024 * 1024 * 1024)
|
||||
#define EA_EXBIBYTE(x) (size_t(x) * 1024 * 1024 * 1024 * 1024 * 1024 * 1024)
|
||||
|
||||
#endif // INCLUDED_earesult_H
|
||||
|
||||
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,102 @@
|
||||
/*-----------------------------------------------------------------------------
|
||||
* nullptr.h
|
||||
*
|
||||
* Copyright (c) Electronic Arts Inc. All rights reserved.
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
#include <EABase/eabase.h>
|
||||
#include <EABase/eahave.h>
|
||||
|
||||
|
||||
#if defined(EA_PRAGMA_ONCE_SUPPORTED)
|
||||
#pragma once /* Some compilers (e.g. VC++) benefit significantly from using this. We've measured 3-4% build speed improvements in apps as a result. */
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(EA_COMPILER_CPP11_ENABLED) && !defined(EA_COMPILER_NO_NULLPTR) && !defined(EA_HAVE_nullptr_t_IMPL)
|
||||
// The compiler supports nullptr, but the standard library doesn't implement a declaration for std::nullptr_t. So we provide one.
|
||||
namespace std { typedef decltype(nullptr) nullptr_t; }
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#if defined(EA_COMPILER_NO_NULLPTR) // If the compiler lacks a native version...
|
||||
|
||||
namespace std
|
||||
{
|
||||
class nullptr_t
|
||||
{
|
||||
public:
|
||||
template<class T> // When tested a pointer, acts as 0.
|
||||
operator T*() const
|
||||
{ return 0; }
|
||||
|
||||
template<class C, class T> // When tested as a member pointer, acts as 0.
|
||||
operator T C::*() const
|
||||
{ return 0; }
|
||||
|
||||
typedef void* (nullptr_t::*bool_)() const;
|
||||
operator bool_() const // An rvalue of type std::nullptr_t can be converted to an rvalue of type bool; the resulting value is false.
|
||||
{ return false; } // We can't use operator bool(){ return false; } because bool is convertable to int which breaks other required functionality.
|
||||
|
||||
// We can't enable this without generating warnings about nullptr being uninitialized after being used when created without "= {}".
|
||||
//void* mSizeofVoidPtr; // sizeof(nullptr_t) == sizeof(void*). Needs to be public if nullptr_t is to be a POD.
|
||||
|
||||
private:
|
||||
void operator&() const; // Address cannot be taken.
|
||||
};
|
||||
|
||||
inline nullptr_t nullptr_get()
|
||||
{
|
||||
nullptr_t n = { }; // std::nullptr exists.
|
||||
return n;
|
||||
}
|
||||
|
||||
#if !defined(nullptr) // If somebody hasn't already defined nullptr in a custom way...
|
||||
#define nullptr nullptr_get()
|
||||
#endif
|
||||
|
||||
} // namespace std
|
||||
|
||||
|
||||
template<class T>
|
||||
inline bool operator==(T* p, const std::nullptr_t)
|
||||
{ return p == 0; }
|
||||
|
||||
template<class T>
|
||||
inline bool operator==(const std::nullptr_t, T* p)
|
||||
{ return p == 0; }
|
||||
|
||||
template<class T, class U>
|
||||
inline bool operator==(T U::* p, const std::nullptr_t)
|
||||
{ return p == 0; }
|
||||
|
||||
template<class T, class U>
|
||||
inline bool operator==(const std::nullptr_t, T U::* p)
|
||||
{ return p == 0; }
|
||||
|
||||
inline bool operator==(const std::nullptr_t, const std::nullptr_t)
|
||||
{ return true; }
|
||||
|
||||
inline bool operator!=(const std::nullptr_t, const std::nullptr_t)
|
||||
{ return false; }
|
||||
|
||||
inline bool operator<(const std::nullptr_t, const std::nullptr_t)
|
||||
{ return false; }
|
||||
|
||||
inline bool operator>(const std::nullptr_t, const std::nullptr_t)
|
||||
{ return false; }
|
||||
|
||||
inline bool operator<=(const std::nullptr_t, const std::nullptr_t)
|
||||
{ return true; }
|
||||
|
||||
inline bool operator>=(const std::nullptr_t, const std::nullptr_t)
|
||||
{ return true; }
|
||||
|
||||
|
||||
using std::nullptr_t; // exported to global namespace.
|
||||
using std::nullptr_get; // exported to global namespace.
|
||||
|
||||
#endif // EA_COMPILER_NO_NULLPTR
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
/*-----------------------------------------------------------------------------
|
||||
* version.h
|
||||
*
|
||||
* Copyright (c) Electronic Arts Inc. All rights reserved.
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef INCLUDED_EABASE_VERSION_H
|
||||
#define INCLUDED_EABASE_VERSION_H
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// EABASE_VERSION
|
||||
//
|
||||
// We more or less follow the conventional EA packaging approach to versioning
|
||||
// here. A primary distinction here is that minor versions are defined as two
|
||||
// digit entities (e.g. .03") instead of minimal digit entities ".3"). The logic
|
||||
// here is that the value is a counter and not a floating point fraction.
|
||||
// Note that the major version doesn't have leading zeros.
|
||||
//
|
||||
// Example version strings:
|
||||
// "0.91.00" // Major version 0, minor version 91, patch version 0.
|
||||
// "1.00.00" // Major version 1, minor and patch version 0.
|
||||
// "3.10.02" // Major version 3, minor version 10, patch version 02.
|
||||
// "12.03.01" // Major version 12, minor version 03, patch version
|
||||
//
|
||||
// Example usage:
|
||||
// printf("EABASE version: %s", EABASE_VERSION);
|
||||
// printf("EABASE version: %d.%d.%d", EABASE_VERSION_N / 10000 % 100, EABASE_VERSION_N / 100 % 100, EABASE_VERSION_N % 100);
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef EABASE_VERSION
|
||||
#define EABASE_VERSION "2.09.12"
|
||||
#define EABASE_VERSION_N 20912
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,67 @@
|
||||
#-------------------------------------------------------------------------------------------
|
||||
# Copyright (C) Electronic Arts Inc. All rights reserved.
|
||||
#-------------------------------------------------------------------------------------------
|
||||
|
||||
#-------------------------------------------------------------------------------------------
|
||||
# CMake info
|
||||
#-------------------------------------------------------------------------------------------
|
||||
cmake_minimum_required(VERSION 3.1)
|
||||
project(EABaseTest CXX)
|
||||
include(CTest)
|
||||
|
||||
#-------------------------------------------------------------------------------------------
|
||||
# Defines
|
||||
#-------------------------------------------------------------------------------------------
|
||||
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
|
||||
add_definitions(-D_SCL_SECURE_NO_WARNINGS)
|
||||
add_definitions(-D_CHAR16T)
|
||||
|
||||
#-------------------------------------------------------------------------------------------
|
||||
# Compiler Flags
|
||||
#-------------------------------------------------------------------------------------------
|
||||
set (CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${CMAKE_CURRENT_SOURCE_DIR}/packages/EASTL/scripts/CMake")
|
||||
include(CommonCppFlags)
|
||||
|
||||
#-------------------------------------------------------------------------------------------
|
||||
# Source files
|
||||
#-------------------------------------------------------------------------------------------
|
||||
file(GLOB EABASETEST_SOURCES "source/TestEABase.cpp" "source/TestEABase.h")
|
||||
set(SOURCES ${EABASETEST_SOURCES})
|
||||
|
||||
#-------------------------------------------------------------------------------------------
|
||||
# Executable definition
|
||||
#-------------------------------------------------------------------------------------------
|
||||
add_executable(EABaseTest ${SOURCES})
|
||||
|
||||
#-------------------------------------------------------------------------------------------
|
||||
# Dependencies
|
||||
#-------------------------------------------------------------------------------------------
|
||||
add_subdirectory(packages/EAAssert)
|
||||
add_subdirectory(packages/EAMain)
|
||||
add_subdirectory(packages/EASTL)
|
||||
add_subdirectory(packages/EAStdC)
|
||||
add_subdirectory(packages/EATest)
|
||||
add_subdirectory(packages/EAThread)
|
||||
|
||||
target_link_libraries(EABaseTest EAAssert)
|
||||
target_link_libraries(EABaseTest EAMain)
|
||||
target_link_libraries(EABaseTest EASTL)
|
||||
target_link_libraries(EABaseTest EAStdC)
|
||||
target_link_libraries(EABaseTest EATest)
|
||||
target_link_libraries(EABaseTest EAThread)
|
||||
|
||||
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
||||
find_package(Threads REQUIRED)
|
||||
|
||||
if((NOT APPLE) AND (NOT WIN32))
|
||||
target_link_libraries(EABaseTest ${EASTLTest_Libraries} Threads::Threads rt)
|
||||
else()
|
||||
target_link_libraries(EABaseTest ${EASTLTest_Libraries} Threads::Threads)
|
||||
endif()
|
||||
|
||||
#-------------------------------------------------------------------------------------------
|
||||
# Run Unit tests and verify the results.
|
||||
#-------------------------------------------------------------------------------------------
|
||||
add_test(EABaseTestRuns EABaseTest)
|
||||
set_tests_properties (EABaseTestRuns PROPERTIES PASS_REGULAR_EXPRESSION "RETURNCODE=0")
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
// EAMain/EAEntryPointMain.inl contains C++ code but it exposes the application entry point with C linkage.
|
||||
|
||||
#include "EAMain/EAEntryPointMain.inl"
|
||||
#include "EATest/EASTLNewOperatorGuard.inl"
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,40 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (c) Electronic Arts Inc. All rights reserved.
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <EABase/eabase.h>
|
||||
#include <EABase/version.h>
|
||||
|
||||
|
||||
// What we do here is verify that EA_PRAGMA_ONCE_SUPPORTED works as intended.
|
||||
// This header file should be #included two times by TestEABase.cpp
|
||||
// in order to test this.
|
||||
|
||||
#if defined(EA_PRAGMA_ONCE_SUPPORTED)
|
||||
#pragma once
|
||||
const int EABaseOncePerTranslationUnitTestVariable = 0; // This should get compiled only once ever for a compilation unit.
|
||||
#else
|
||||
// Just implement a classic manual header include guard.
|
||||
// In this case we aren't really testing anything.
|
||||
#ifndef TESTEABASE_H
|
||||
#define TESTEABASE_H
|
||||
const int EABaseOncePerTranslationUnitTestVariable = 0;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
// EA_EXTERN_TEMPLATE / EA_COMPILER_NO_EXTERN_TEMPLATE
|
||||
|
||||
#if defined(__cplusplus)
|
||||
template <typename T>
|
||||
struct eabase_template
|
||||
{
|
||||
T value;
|
||||
T GetValue() const { return value; }
|
||||
};
|
||||
|
||||
EA_EXTERN_TEMPLATE(struct eabase_template<char>);
|
||||
#endif
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,34 @@
|
||||
// The purpose of this compilation unit is to test EABase in the absence of other system headers.
|
||||
// For example TestEABase.cpp directly includes system headers like ctype.h, stddef.h, stdarg, etc.
|
||||
// However, these headers make it impossible to verify that certain definitions are being provided
|
||||
// by EABase instead of the system headers being included directly.
|
||||
|
||||
#include <EABase/eabase.h>
|
||||
|
||||
// This structure tests that EABase types are properly defined.
|
||||
struct EABaseDefinedTypesStruct
|
||||
{
|
||||
char8_t mChar8_t;
|
||||
char16_t mChar16_t;
|
||||
char32_t mChar32_t;
|
||||
wchar_t mWchar_t;
|
||||
bool8_t mBool8_t;
|
||||
int8_t mInt8_t;
|
||||
int16_t mInt16_t;
|
||||
int32_t mInt32_t;
|
||||
int64_t mInt64_t;
|
||||
uint8_t mUint8_t;
|
||||
uint16_t mUint16_t;
|
||||
uint32_t mUint32_t;
|
||||
uint64_t mUint64_t;
|
||||
intmax_t mIntmax_t;
|
||||
uintmax_t mUintmax_t;
|
||||
size_t mSize_t;
|
||||
ssize_t mSsize_t;
|
||||
float_t mFloat_t;
|
||||
double_t mDouble_t;
|
||||
intptr_t mIntptr_t;
|
||||
uintptr_t mUintptr_t;
|
||||
ptrdiff_t mPtrdiff_t;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user