Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

- use major-only for Clang >= 8.0 #3643

Merged
merged 2 commits into from
Oct 26, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions conans/client/cmd/new_ci.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,8 @@ def get_travis(name, version, user, channel, linux_gcc_versions, linux_clang_ver
xcode_map = {"7.3": "7.3",
"8.1": "8.3",
"9.0": "9.2",
"9.1": "9.3"}
"9.1": "9.3",
"10.0": "10"}
for apple_clang in osx_clang_versions:
xcode = xcode_map[apple_clang]
config.append(osx_config.format(xcode=xcode, version=apple_clang))
Expand Down Expand Up @@ -361,8 +362,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 +379,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
4 changes: 3 additions & 1 deletion conans/client/conf/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@
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.0", "6.0", "7.0",
"8"]
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