Skip to content

Commit

Permalink
- use major-only for Clang >= 8.0
Browse files Browse the repository at this point in the history
Signed-off-by: SSE4 <tomskside@gmail.com>
  • Loading branch information
SSE4 committed Oct 22, 2018
1 parent 7e9727e commit 5612c3b
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 5 deletions.
6 changes: 3 additions & 3 deletions conans/client/cmd/new_ci.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,8 +361,8 @@ def ci_get_files(name, version, user, channel, visual_versions, linux_gcc_versio
gitlab_gcc_versions or gitlab_clang_versions or circleci_gcc_versions or
circleci_clang_versions or circleci_osx_versions):
return {}
gcc_versions = ["4.9", "5", "6", "7"]
clang_versions = ["3.9", "4.0"]
gcc_versions = ["4.9", "5", "6", "7", "8"]
clang_versions = ["3.9", "4.0", "5.0", "6.0", "7.0"]
if visual_versions is True:
visual_versions = ["12", "14", "15"]
if linux_gcc_versions is True:
Expand All @@ -378,7 +378,7 @@ def ci_get_files(name, version, user, channel, visual_versions, linux_gcc_versio
if circleci_clang_versions is True:
circleci_clang_versions = clang_versions
if osx_clang_versions is True:
osx_clang_versions = ["7.3", "8.1", "9.0", "9.1"]
osx_clang_versions = ["7.3", "8.1", "9.0", "9.1", "10.0"]
if circleci_osx_versions is True:
circleci_osx_versions = ["7.3", "8.1", "9.0"]
if not visual_versions:
Expand Down
6 changes: 5 additions & 1 deletion conans/client/conf/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,11 @@
LLVM-vs2013, LLVM-vs2013_xp, LLVM-vs2014, LLVM-vs2014_xp,
LLVM-vs2017, LLVM-vs2017_xp, v141, v141_xp, v141_clang_c2]
clang:
version: ["3.3", "3.4", "3.5", "3.6", "3.7", "3.8", "3.9", "4.0", "5.0", "6.0", "7.0"]
version: ["3.3", "3.4", "3.5", "3.6", "3.7", "3.8", "3.9", "4.0",
"5", "5.0",
"6", "6.0",
"7", "7.0",
"8", "8.0"]
libcxx: [libstdc++, libstdc++11, libc++]
apple-clang:
version: ["5.0", "5.1", "6.0", "6.1", "7.0", "7.3", "8.0", "8.1", "9.0", "9.1", "10.0"]
Expand Down
5 changes: 5 additions & 0 deletions conans/client/conf/detect.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,15 @@ def _clang_compiler(output, compiler_exe="clang"):
installed_version = re.search("([0-9]+\.[0-9])", out).group()
if installed_version:
output.success("Found %s %s" % (compiler, installed_version))
major = installed_version.split(".")[0]
if int(major) >= 8 and compiler == "clang":
output.info("clang>=8, using the major as version")
installed_version = major
return compiler, installed_version
except:
return None


def _sun_cc_compiler(output, compiler_exe="cc"):
try:
_, out = _execute('%s -V' % compiler_exe)
Expand Down
15 changes: 14 additions & 1 deletion conans/client/generators/cmake_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,20 @@ def generate_targets_section(dependencies):
if(NOT ${_CHECK_VERSION} VERSION_EQUAL CONAN_COMPILER_VERSION)
conan_error_compiler_version()
endif()
elseif(CONAN_COMPILER MATCHES "clang" OR CONAN_COMPILER STREQUAL "sun-cc")
elseif(CONAN_COMPILER STREQUAL "clang")
set(_CHECK_VERSION ${VERSION_MAJOR}.${VERSION_MINOR})
if(NOT ${CONAN_COMPILER_VERSION} VERSION_LESS 8.0)
message(STATUS "Conan: Compiler Clang>=8, checking major version ${CONAN_COMPILER_VERSION}")
conan_split_version(${CONAN_COMPILER_VERSION} CONAN_COMPILER_MAJOR CONAN_COMPILER_MINOR)
if("${CONAN_COMPILER_MINOR}" STREQUAL "")
set(_CHECK_VERSION ${VERSION_MAJOR})
endif()
endif()
message(STATUS "Conan: Checking correct version: ${_CHECK_VERSION}")
if(NOT ${_CHECK_VERSION} VERSION_EQUAL CONAN_COMPILER_VERSION)
conan_error_compiler_version()
endif()
elseif(CONAN_COMPILER STREQUAL "apple-clang" OR CONAN_COMPILER STREQUAL "sun-cc")
conan_split_version(${CONAN_COMPILER_VERSION} CONAN_COMPILER_MAJOR CONAN_COMPILER_MINOR)
if(NOT ${VERSION_MAJOR}.${VERSION_MINOR} VERSION_EQUAL ${CONAN_COMPILER_MAJOR}.${CONAN_COMPILER_MINOR})
conan_error_compiler_version()
Expand Down
10 changes: 10 additions & 0 deletions conans/test/build_helpers/cpp_std_flags_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,16 @@ def test_clang_cppstd_flags(self):
self.assertEquals(cppstd_flag("clang", "6", "17"), '-std=c++17')
self.assertEquals(cppstd_flag("clang", "6", "20"), '-std=c++2a')

self.assertEquals(cppstd_flag("clang", "7", "11"), '-std=c++11')
self.assertEquals(cppstd_flag("clang", "7", "14"), '-std=c++14')
self.assertEquals(cppstd_flag("clang", "7", "17"), '-std=c++17')
self.assertEquals(cppstd_flag("clang", "7", "20"), '-std=c++2a')

self.assertEquals(cppstd_flag("clang", "8", "11"), '-std=c++11')
self.assertEquals(cppstd_flag("clang", "8", "14"), '-std=c++14')
self.assertEquals(cppstd_flag("clang", "8", "17"), '-std=c++17')
self.assertEquals(cppstd_flag("clang", "8", "20"), '-std=c++2a')

def test_clang_cppstd_defaults(self):
self.assertEquals(cppstd_default("clang", "2"), "gnu98")
self.assertEquals(cppstd_default("clang", "2.1"), "gnu98")
Expand Down

0 comments on commit 5612c3b

Please sign in to comment.