Skip to content

Commit

Permalink
Appveyor compiler fixes for MinGW and VS2017 support (#127)
Browse files Browse the repository at this point in the history
* adding vs2017 to appveyor script
* removing vs2013 builds
* Update .appveyor.yml
  • Loading branch information
rparolin authored Oct 27, 2017
1 parent 242d863 commit f92de00
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 12 deletions.
5 changes: 5 additions & 0 deletions .appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
version: 1.0.{build}

image:
- Visual Studio 2017

platform:
- MinGW_x86
- MinGW_x64
- MSVC_2015_x86
- MSVC_2015_x64
- MSVC_2017_x86
- MSVC_2017_x64

install:
- scripts\ci-pre.cmd
Expand Down
2 changes: 2 additions & 0 deletions benchmark/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,11 @@ include_directories(../test/source)
set (CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${CMAKE_CURRENT_SOURCE_DIR}/../scripts/CMake")
include(CommonCppFlags)

#-------------------------------------------------------------------------------------------
# Libstdc++ calls new internally, since DLLs have no weak symbols, runtime symbol resolution fails and EASTL's new is not called.
# Linking against static libstdc++ fixes this.
# See https://github.com/electronicarts/EASTL/issues/40 for more info.
#-------------------------------------------------------------------------------------------
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND MINGW)
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} -static-libstdc++")
set(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO} -static-libstdc++")
Expand Down
14 changes: 7 additions & 7 deletions scripts/ci-build.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ if not [x%PLATFORM:MinGW=%]==[x%PLATFORM%] (
mkdir build
cd build

rem Check if the platform variable contains 2013
if not [x%PLATFORM:2013=%]==[x%PLATFORM%] (
set vs_generator=Visual Studio 12 2013
rem Set the request Visual Studio Version
if not [x%PLATFORM:2015=%]==[x%PLATFORM%] (
set vs_generator=Visual Studio 14 2015
) else (
set vs_generator=Visual Studio 14 2015
set vs_generator=Visual Studio 15 2017
)

rem Check if the platform variable contains x64
if not [x%PLATFORM:x64=%]==[x%PLATFORM%] set vs_generator=%vs_generator% Win64
cmake .. -G "%vs_generator%" -DEASTL_BUILD_BENCHMARK:BOOL=ON -DEASTL_BUILD_TESTS:BOOL=ON
Expand Down Expand Up @@ -49,7 +49,7 @@ mkdir build-%PLATFORM%-clang-Debug
rem Build with gcc.
for %%c in (Debug, Release) do (
cd build-%PLATFORM%-gcc-%%~c
cmake .. -GNinja -DCMAKE_BUILD_TYPE=%%~c -DEASTL_BUILD_BENCHMARK:BOOL=ON -DEASTL_BUILD_TESTS:BOOL=ON -DCMAKE_C_COMPILER=%bin_folder%/gcc.exe -DCMAKE_CXX_COMPILER=%bin_folder%/g++.exe -DCMAKE_MAKE_PROGRAM=C:/msys64/mingw64/bin/ninja.exe
cmake .. -GNinja -DCMAKE_BUILD_TYPE=%%~c -DEASTL_BUILD_BENCHMARK:BOOL=OFF -DEASTL_BUILD_TESTS:BOOL=ON -DCMAKE_C_COMPILER=%bin_folder%/gcc.exe -DCMAKE_CXX_COMPILER=%bin_folder%/g++.exe -DCMAKE_MAKE_PROGRAM=C:/msys64/mingw64/bin/ninja.exe
cmake --build . || goto error
cd ..
)
Expand All @@ -64,7 +64,7 @@ if not [x%PLATFORM:x64=%]==[x%PLATFORM%] (

for %%c in (%configurations%) do (
cd build-%PLATFORM%-clang-%%~c
cmake .. -GNinja -DCMAKE_BUILD_TYPE=%%~c -DEASTL_BUILD_BENCHMARK:BOOL=ON -DEASTL_BUILD_TESTS:BOOL=ON -DCMAKE_C_COMPILER=%bin_folder%/clang.exe -DCMAKE_CXX_COMPILER=%bin_folder%/clang++.exe -DCMAKE_MAKE_PROGRAM=C:/msys64/mingw64/bin/ninja.exe
cmake .. -GNinja -DCMAKE_BUILD_TYPE=%%~c -DEASTL_BUILD_BENCHMARK:BOOL=OFF -DEASTL_BUILD_TESTS:BOOL=ON -DCMAKE_C_COMPILER=%bin_folder%/clang.exe -DCMAKE_CXX_COMPILER=%bin_folder%/clang++.exe -DCMAKE_MAKE_PROGRAM=C:/msys64/mingw64/bin/ninja.exe
cmake --build . || goto error
cd ..
)
Expand Down
10 changes: 6 additions & 4 deletions test/packages/EATest/source/EATest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,15 +130,16 @@ namespace UnitTest
EATEST_VERIFY_IMP(bExpression, nErrorCount, pFile, nLine, buffer);
else
{
char* pBuffer = new char[nReturnValue + 1];
const int nExpectedLen = EA::StdC::Vsnprintf(buffer, 0, pFormat, arguments); // calculate string length for allocation
char* pBuffer = new char[nExpectedLen + 1];

if(pBuffer)
{
#if defined(EA_COMPILER_VA_COPY_REQUIRED)
va_end(arguments);
va_copy(arguments, argumentsSaved);
#endif
EA::StdC::Vsnprintf(pBuffer, nReturnValue + 1, pFormat, arguments);
EA::StdC::Vsnprintf(pBuffer, nExpectedLen + 1, pFormat, arguments);
EATEST_VERIFY_IMP(bExpression, nErrorCount, pFile, nLine, pBuffer);
delete[] pBuffer;
}
Expand Down Expand Up @@ -185,15 +186,16 @@ namespace UnitTest
EATEST_VERIFY_IMP(bExpression, nErrorCount, __FILE__, __LINE__, buffer);
else
{
char* pBuffer = new char[nReturnValue + 1];
const int nExpectedLen = EA::StdC::Vsnprintf(buffer, 0, pFormat, arguments); // calculate string length for allocation
char* pBuffer = new char[nExpectedLen + 1];

if(pBuffer)
{
#if defined(EA_COMPILER_VA_COPY_REQUIRED)
va_end(arguments);
va_copy(arguments, argumentsSaved);
#endif
EA::StdC::Vsnprintf(pBuffer, nReturnValue + 1, pFormat, arguments);
EA::StdC::Vsnprintf(pBuffer, nExpectedLen + 1, pFormat, arguments);
EATEST_VERIFY_IMP(bExpression, nErrorCount, __FILE__, __LINE__, pBuffer);
delete[] pBuffer;
}
Expand Down
2 changes: 1 addition & 1 deletion test/source/TestTypeTraits.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ struct NoThrowDestructible
#if !defined(EA_COMPILER_NO_EXCEPTIONS)
struct ThrowDestructible
{
~ThrowDestructible() throw(int) { throw(int()); }
~ThrowDestructible() noexcept(false) { throw(int()); }
};

struct ThrowDestructibleNoexceptFalse
Expand Down

0 comments on commit f92de00

Please sign in to comment.