Skip to content

Commit

Permalink
travis test for clang v 3.9 on osx; fix AppleClang detection (#86)
Browse files Browse the repository at this point in the history
  • Loading branch information
theryee authored and rparolin committed Feb 13, 2017
1 parent cd72aa5 commit 651281e
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 58 deletions.
17 changes: 17 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ os:
compiler:
- gcc
- clang

env:
- EASTL_CONFIG=Debug
- EASTL_CONFIG=Release
Expand All @@ -21,6 +22,13 @@ addons:
- clang

matrix:
include:
- compiler: clang "debug build with clang3.9"
env: EASTL_CONFIG=Debug USE_CLANG_39=yes
os: osx
- compiler: clang "release build with clang3.9"
env: EASTL_CONFIG=Release USE_CLANG_39=yes
os: osx
exclude:
- os: osx
compiler: gcc
Expand All @@ -35,8 +43,17 @@ install:
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then wget --no-check-certificate http://cmake.org/files/v3.1/cmake-3.1.3-Darwin-x86_64.tar.gz ;fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then tar -xzf cmake-3.1.3-Darwin-x86_64.tar.gz ;fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then export PATH=$PWD/cmake-3.1.3-Darwin-x86_64/CMake.app/Contents/bin:$PATH ;fi
- if [[ "$TRAVIS_OS_NAME" == "osx" && -n "$USE_CLANG_39" ]]; then export CLANG_URL=http://releases.llvm.org/3.9.0/clang+llvm-3.9.0-x86_64-apple-darwin.tar.xz ;fi
- if [[ "$TRAVIS_OS_NAME" == "osx" && -n "$USE_CLANG_39" ]]; then wget --no-check-certificate $CLANG_URL ;fi
- if [[ "$TRAVIS_OS_NAME" == "osx" && -n "$USE_CLANG_39" ]]; then tar -xzf clang+llvm-3.9.0-x86_64-apple-darwin.tar.xz ;fi
- if [[ "$TRAVIS_OS_NAME" == "osx" && -n "$USE_CLANG_39" ]]; then export CLANG_39_PATH=$(PWD)/clang+llvm-3.9.0-x86_64-apple-darwin/ ;fi

before_script:
- if [[ -n "$USE_CLANG_39" ]]; then export PATH="${CLANG_39_PATH}/bin:$PATH" ;fi
- if [[ -n "$USE_CLANG_39" ]]; then export CC="clang"; fi
- if [[ -n "$USE_CLANG_39" ]]; then export CXX="clang++"; fi
- if [[ -n "$USE_CLANG_39" ]]; then export CXXFLAGS="$CXXFLAGS -I${CLANG_39_PATH}/include -std=c++11 -stdlib=libc++" ;fi
- if [[ -n "$USE_CLANG_39" ]]; then export LDFLAGS="$LDFLAGS -L${CLANG_39_PATH}/lib" ;fi
- mkdir build_$EASTL_CONFIG
- cd build_$EASTL_CONFIG
- cmake .. -DEASTL_BUILD_BENCHMARK:BOOL=ON -DEASTL_BUILD_TESTS:BOOL=ON
Expand Down
30 changes: 15 additions & 15 deletions scripts/CMake/CommonCppFlags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,21 @@ if(UNIX AND "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel" )
endif()

# NOT LESS == GREATER_OR_EQUAL; CMake doesn't support this out of the box.
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND NOT APPLE) # Apple clang uses different versioning.
if(CMAKE_CXX_COMPILER_ID MATCHES "AppleClang")
if(NOT (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "6.1"))
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
endif()
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "6.1" AND (NOT (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.3")))
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++1y")
endif()
# It seems Apple started changing version numbers after 3.1, going straight to 4.0 after 3.1.
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.3" AND (NOT (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "3.1")))
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
endif()
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "3.1")
message(FATAL_ERROR "Building with a Apple clang version less than 3.1 is not supported.")
endif()
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang") # non-Apple clangs uses different versioning.
if(NOT (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "3.5.0"))
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
endif()
Expand All @@ -32,20 +46,6 @@ elseif(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.7.3")
message(FATAL_ERROR "Building with a gcc version less than 4.7.3 is not supported.")
endif()
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND APPLE)
if(NOT (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "6.1"))
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
endif()
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "6.1" AND (NOT (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.3")))
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++1y")
endif()
# It seems Apple started changing version numbers after 3.1, going straight to 4.0 after 3.1.
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.3" AND (NOT (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "3.1")))
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
endif()
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "3.1")
message(FATAL_ERROR "Building with a Apple clang version less than 3.1 is not supported.")
endif()
endif()


Expand Down
Loading

0 comments on commit 651281e

Please sign in to comment.