Skip to content

Commit

Permalink
Port apple-clang new versions and compatibility to 1.46.1 (#10807)
Browse files Browse the repository at this point in the history
* conan 1.46.1

* use major as version for apple-clang >= 13

* add 13 fallback to 13.0

* check compiler exists

* Update conans/client/conf/detect.py

Co-authored-by: Luis Martinez <lasote@gmail.com>

* test only mac

Co-authored-by: Luis Martinez <lasote@gmail.com>
  • Loading branch information
czoido and lasote committed Mar 17, 2022
1 parent b20dc02 commit 72f3918
Show file tree
Hide file tree
Showing 7 changed files with 205 additions and 11 deletions.
2 changes: 1 addition & 1 deletion conans/__init__.py
Expand Up @@ -20,4 +20,4 @@
SERVER_CAPABILITIES = [COMPLEX_SEARCH_CAPABILITY, REVISIONS] # Server is always with revisions
DEFAULT_REVISION_V1 = "0"

__version__ = '1.46.0'
__version__ = '1.46.1'
19 changes: 10 additions & 9 deletions conans/client/conf/__init__.py
Expand Up @@ -37,32 +37,33 @@
Macos:
version: [None, "10.6", "10.7", "10.8", "10.9", "10.10", "10.11", "10.12", "10.13", "10.14", "10.15", "11.0", "12.0", "13.0"]
sdk: [None, "macosx"]
sdk_version: [None, "10.13", "10.14", "10.15", "11.0", "11.1", "11.3", "12.0", "12.1"]
sdk_version: [None, "10.13", "10.14", "10.15", "11.0", "11.1", "11.3", "12.0", "12.1", "12.3"]
subsystem: [None, catalyst]
Android:
api_level: ANY
iOS:
version: ["7.0", "7.1", "8.0", "8.1", "8.2", "8.3", "9.0", "9.1", "9.2", "9.3", "10.0", "10.1", "10.2", "10.3",
"11.0", "11.1", "11.2", "11.3", "11.4", "12.0", "12.1", "12.2", "12.3", "12.4",
"13.0", "13.1", "13.2", "13.3", "13.4", "13.5", "13.6", "13.7",
"14.0", "14.1", "14.2", "14.3", "14.4", "14.5", "14.6", "14.7", "14.8", "15.0", "15.1"]
"14.0", "14.1", "14.2", "14.3", "14.4", "14.5", "14.6", "14.7", "14.8",
"15.0", "15.1", "15.2", "15.3", "15.4"]
sdk: [None, "iphoneos", "iphonesimulator"]
sdk_version: [None, "11.3", "11.4", "12.0", "12.1", "12.2", "12.4",
"13.0", "13.1", "13.2", "13.4", "13.5", "13.6", "13.7",
"14.0", "14.1", "14.2", "14.3", "14.4", "14.5", "15.0", "15.2"]
"14.0", "14.1", "14.2", "14.3", "14.4", "14.5", "15.0", "15.2", "15.4"]
watchOS:
version: ["4.0", "4.1", "4.2", "4.3", "5.0", "5.1", "5.2", "5.3", "6.0", "6.1", "6.2",
"7.0", "7.1", "7.2", "7.3", "7.4", "7.5", "7.6", "8.0", "8.1"]
"7.0", "7.1", "7.2", "7.3", "7.4", "7.5", "7.6", "8.0", "8.1", "8.3", "8.4", "8.5"]
sdk: [None, "watchos", "watchsimulator"]
sdk_version: [None, "4.3", "5.0", "5.1", "5.2", "5.3", "6.0", "6.1", "6.2",
"7.0", "7.1", "7.2", "7.4", "8.0", "8.0.1", "8.3"]
"7.0", "7.1", "7.2", "7.4", "8.0", "8.0.1", "8.3", "8.5"]
tvOS:
version: ["11.0", "11.1", "11.2", "11.3", "11.4", "12.0", "12.1", "12.2", "12.3", "12.4",
"13.0", "13.2", "13.3", "13.4", "14.0", "14.2", "14.3", "14.4", "14.5", "14.6", "14.7",
"15.0", "15.1"]
"15.0", "15.1", "15.2", "15.3", "15.4"]
sdk: [None, "appletvos", "appletvsimulator"]
sdk_version: [None, "11.3", "11.4", "12.0", "12.1", "12.2", "12.4",
"13.0", "13.1", "13.2", "13.4", "14.0", "14.2", "14.3", "14.5", "15.0", "15.2"]
"13.0", "13.1", "13.2", "13.4", "14.0", "14.2", "14.3", "14.5", "15.0", "15.2", "15.4"]
FreeBSD:
SunOS:
AIX:
Expand Down Expand Up @@ -112,12 +113,12 @@
clang:
version: ["3.3", "3.4", "3.5", "3.6", "3.7", "3.8", "3.9", "4.0",
"5.0", "6.0", "7.0", "7.1",
"8", "9", "10", "11", "12", "13", "14"]
"8", "9", "10", "11", "12", "13", "14", "15"]
libcxx: [None, libstdc++, libstdc++11, libc++, c++_shared, c++_static]
cppstd: [None, 98, gnu98, 11, gnu11, 14, gnu14, 17, gnu17, 20, gnu20, 23, gnu23]
runtime: [None, MD, MT, MTd, MDd]
apple-clang: &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", "11.0", "12.0", "13.0"]
version: ["5.0", "5.1", "6.0", "6.1", "7.0", "7.3", "8.0", "8.1", "9.0", "9.1", "10.0", "11.0", "12.0", "13", "13.0", "13.1"]
libcxx: [libstdc++, libc++]
cppstd: [None, 98, gnu98, 11, gnu11, 14, gnu14, 17, gnu17, 20, gnu20]
intel:
Expand Down
3 changes: 3 additions & 0 deletions conans/client/conf/detect.py
Expand Up @@ -156,6 +156,9 @@ def _get_profile_compiler_version(compiler, version, output):
elif compiler == "gcc" and int(major) >= 5:
output.info("gcc>=5, using the major as version")
return major
elif compiler == "apple-clang" and int(major) >= 13:
output.info("apple-clang>=13, using the major as version")
return major
elif compiler == "Visual Studio":
return major
elif compiler == "intel" and (int(major) < 19 or (int(major) == 19 and int(minor) == 0)):
Expand Down
4 changes: 4 additions & 0 deletions conans/client/graph/graph_binaries.py
Expand Up @@ -377,6 +377,10 @@ def _compute_package_id(self, node, default_package_id_mode, default_python_requ
if msvc_compatible:
conanfile.compatible_packages.append(msvc_compatible)

apple_clang_compatible = conanfile.info.apple_clang_compatible()
if apple_clang_compatible:
conanfile.compatible_packages.append(apple_clang_compatible)

# Once we are done, call package_id() to narrow and change possible values
with conanfile_exception_formatter(str(conanfile), "package_id"):
with conan_v2_property(conanfile, 'cpp_info',
Expand Down
147 changes: 147 additions & 0 deletions conans/client/migrations_settings.py
Expand Up @@ -3250,5 +3250,152 @@
build_type: [None, Debug, Release, RelWithDebInfo, MinSizeRel]
cppstd: [None, 98, gnu98, 11, gnu11, 14, gnu14, 17, gnu17, 20, gnu20, 23, gnu23] # Deprecated, use compiler.cppstd
"""

settings_1_46_1 = """
# Only for cross building, 'os_build/arch_build' is the system that runs Conan
os_build: [Windows, WindowsStore, Linux, Macos, FreeBSD, SunOS, AIX, VxWorks]
arch_build: [x86, x86_64, ppc32be, ppc32, ppc64le, ppc64, armv5el, armv5hf, armv6, armv7, armv7hf, armv7s, armv7k, armv8, armv8_32, armv8.3, sparc, sparcv9, mips, mips64, avr, s390, s390x, sh4le, e2k-v2, e2k-v3, e2k-v4, e2k-v5, e2k-v6, e2k-v7]
# Only for building cross compilation tools, 'os_target/arch_target' is the system for
# which the tools generate code
os_target: [Windows, Linux, Macos, Android, iOS, watchOS, tvOS, FreeBSD, SunOS, AIX, Arduino, Neutrino]
arch_target: [x86, x86_64, ppc32be, ppc32, ppc64le, ppc64, armv5el, armv5hf, armv6, armv7, armv7hf, armv7s, armv7k, armv8, armv8_32, armv8.3, sparc, sparcv9, mips, mips64, avr, s390, s390x, asm.js, wasm, sh4le, e2k-v2, e2k-v3, e2k-v4, e2k-v5, e2k-v6, e2k-v7, xtensalx6, xtensalx106]
# Rest of the settings are "host" settings:
# - For native building/cross building: Where the library/program will run.
# - For building cross compilation tools: Where the cross compiler will run.
os:
Windows:
subsystem: [None, cygwin, msys, msys2, wsl]
WindowsStore:
version: ["8.1", "10.0"]
WindowsCE:
platform: ANY
version: ["5.0", "6.0", "7.0", "8.0"]
Linux:
Macos:
version: [None, "10.6", "10.7", "10.8", "10.9", "10.10", "10.11", "10.12", "10.13", "10.14", "10.15", "11.0", "12.0", "13.0"]
sdk: [None, "macosx"]
sdk_version: [None, "10.13", "10.14", "10.15", "11.0", "11.1", "11.3", "12.0", "12.1", "12.3"]
subsystem: [None, catalyst]
Android:
api_level: ANY
iOS:
version: ["7.0", "7.1", "8.0", "8.1", "8.2", "8.3", "9.0", "9.1", "9.2", "9.3", "10.0", "10.1", "10.2", "10.3",
"11.0", "11.1", "11.2", "11.3", "11.4", "12.0", "12.1", "12.2", "12.3", "12.4",
"13.0", "13.1", "13.2", "13.3", "13.4", "13.5", "13.6", "13.7",
"14.0", "14.1", "14.2", "14.3", "14.4", "14.5", "14.6", "14.7", "14.8",
"15.0", "15.1", "15.2", "15.3", "15.4"]
sdk: [None, "iphoneos", "iphonesimulator"]
sdk_version: [None, "11.3", "11.4", "12.0", "12.1", "12.2", "12.4",
"13.0", "13.1", "13.2", "13.4", "13.5", "13.6", "13.7",
"14.0", "14.1", "14.2", "14.3", "14.4", "14.5", "15.0", "15.2", "15.4"]
watchOS:
version: ["4.0", "4.1", "4.2", "4.3", "5.0", "5.1", "5.2", "5.3", "6.0", "6.1", "6.2",
"7.0", "7.1", "7.2", "7.3", "7.4", "7.5", "7.6", "8.0", "8.1", "8.3", "8.4", "8.5"]
sdk: [None, "watchos", "watchsimulator"]
sdk_version: [None, "4.3", "5.0", "5.1", "5.2", "5.3", "6.0", "6.1", "6.2",
"7.0", "7.1", "7.2", "7.4", "8.0", "8.0.1", "8.3", "8.5"]
tvOS:
version: ["11.0", "11.1", "11.2", "11.3", "11.4", "12.0", "12.1", "12.2", "12.3", "12.4",
"13.0", "13.2", "13.3", "13.4", "14.0", "14.2", "14.3", "14.4", "14.5", "14.6", "14.7",
"15.0", "15.1", "15.2", "15.3", "15.4"]
sdk: [None, "appletvos", "appletvsimulator"]
sdk_version: [None, "11.3", "11.4", "12.0", "12.1", "12.2", "12.4",
"13.0", "13.1", "13.2", "13.4", "14.0", "14.2", "14.3", "14.5", "15.0", "15.2", "15.4"]
FreeBSD:
SunOS:
AIX:
Arduino:
board: ANY
Emscripten:
Neutrino:
version: ["6.4", "6.5", "6.6", "7.0", "7.1"]
baremetal:
VxWorks:
version: ["7"]
arch: [x86, x86_64, ppc32be, ppc32, ppc64le, ppc64, armv4, armv4i, armv5el, armv5hf, armv6, armv7, armv7hf, armv7s, armv7k, armv8, armv8_32, armv8.3, sparc, sparcv9, mips, mips64, avr, s390, s390x, asm.js, wasm, sh4le, e2k-v2, e2k-v3, e2k-v4, e2k-v5, e2k-v6, e2k-v7, xtensalx6, xtensalx106]
compiler:
sun-cc:
version: ["5.10", "5.11", "5.12", "5.13", "5.14", "5.15"]
threads: [None, posix]
libcxx: [libCstd, libstdcxx, libstlport, libstdc++]
gcc: &gcc
version: ["4.1", "4.4", "4.5", "4.6", "4.7", "4.8", "4.9",
"5", "5.1", "5.2", "5.3", "5.4", "5.5",
"6", "6.1", "6.2", "6.3", "6.4", "6.5",
"7", "7.1", "7.2", "7.3", "7.4", "7.5",
"8", "8.1", "8.2", "8.3", "8.4",
"9", "9.1", "9.2", "9.3",
"10", "10.1", "10.2", "10.3",
"11", "11.1", "11.2",
"12"]
libcxx: [libstdc++, libstdc++11]
threads: [None, posix, win32] # Windows MinGW
exception: [None, dwarf2, sjlj, seh] # Windows MinGW
cppstd: [None, 98, gnu98, 11, gnu11, 14, gnu14, 17, gnu17, 20, gnu20, 23, gnu23]
Visual Studio: &visual_studio
runtime: [MD, MT, MTd, MDd]
version: ["8", "9", "10", "11", "12", "14", "15", "16", "17"]
toolset: [None, v90, v100, v110, v110_xp, v120, v120_xp,
v140, v140_xp, v140_clang_c2, LLVM-vs2012, LLVM-vs2012_xp,
LLVM-vs2013, LLVM-vs2013_xp, LLVM-vs2014, LLVM-vs2014_xp,
LLVM-vs2017, LLVM-vs2017_xp, v141, v141_xp, v141_clang_c2, v142,
llvm, ClangCL, v143]
cppstd: [None, 14, 17, 20, 23]
msvc:
version: [190, 191, 192, 193]
update: [None, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
runtime: [static, dynamic]
runtime_type: [Debug, Release]
cppstd: [14, 17, 20, 23]
clang:
version: ["3.3", "3.4", "3.5", "3.6", "3.7", "3.8", "3.9", "4.0",
"5.0", "6.0", "7.0", "7.1",
"8", "9", "10", "11", "12", "13", "14", "15"]
libcxx: [None, libstdc++, libstdc++11, libc++, c++_shared, c++_static]
cppstd: [None, 98, gnu98, 11, gnu11, 14, gnu14, 17, gnu17, 20, gnu20, 23, gnu23]
runtime: [None, MD, MT, MTd, MDd]
apple-clang: &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", "11.0", "12.0", "13", "13.0", "13.1"]
libcxx: [libstdc++, libc++]
cppstd: [None, 98, gnu98, 11, gnu11, 14, gnu14, 17, gnu17, 20, gnu20]
intel:
version: ["11", "12", "13", "14", "15", "16", "17", "18", "19", "19.1"]
update: [None, ANY]
base:
gcc:
<<: *gcc
threads: [None]
exception: [None]
Visual Studio:
<<: *visual_studio
apple-clang:
<<: *apple_clang
intel-cc:
version: ["2021.1", "2021.2", "2021.3"]
update: [None, ANY]
mode: ["icx", "classic", "dpcpp"]
libcxx: [None, libstdc++, libstdc++11, libc++]
cppstd: [None, 98, gnu98, 03, gnu03, 11, gnu11, 14, gnu14, 17, gnu17, 20, gnu20, 23, gnu23]
runtime: [None, static, dynamic]
runtime_type: [None, Debug, Release]
qcc:
version: ["4.4", "5.4", "8.3"]
libcxx: [cxx, gpp, cpp, cpp-ne, accp, acpp-ne, ecpp, ecpp-ne]
cppstd: [None, 98, gnu98, 11, gnu11, 14, gnu14, 17, gnu17]
mcst-lcc:
version: ["1.19", "1.20", "1.21", "1.22", "1.23", "1.24", "1.25"]
base:
gcc:
<<: *gcc
threads: [None]
exceptions: [None]
build_type: [None, Debug, Release, RelWithDebInfo, MinSizeRel]
cppstd: [None, 98, gnu98, 11, gnu11, 14, gnu14, 17, gnu17, 20, gnu20, 23, gnu23] # Deprecated, use compiler.cppstd
"""
13 changes: 12 additions & 1 deletion conans/model/info.py
Expand Up @@ -591,11 +591,22 @@ def msvc_compatible(self):
visual_version = msvc_version_to_vs_ide_version(version)
compatible.settings.compiler.version = visual_version
runtime = "MT" if runtime == "static" else "MD"
if runtime_type == "Debug":
if runtime_type == "Debug":
runtime = "{}d".format(runtime)
compatible.settings.compiler.runtime = runtime
return compatible

def apple_clang_compatible(self):
# https://github.com/conan-io/conan/pull/10797
# apple-clang compiler version 13 will be compatible with 13.0
if not self.settings.compiler or \
(self.settings.compiler != "apple-clang" and self.settings.compiler.version != "13"):
return

compatible = self.clone()
compatible.settings.compiler.version = "13.0"
return compatible

def vs_toolset_compatible(self):
"""Default behaviour, same package for toolset v140 with compiler=Visual Studio 15 than
using Visual Studio 14"""
Expand Down
28 changes: 28 additions & 0 deletions conans/test/integration/package_id/compatible_test.py
@@ -1,7 +1,10 @@
import platform
import textwrap
import time
import unittest

import pytest

from conans.model.ref import ConanFileReference
from conans.test.utils.tools import TestClient, GenConanfile
from conans.util.files import save
Expand Down Expand Up @@ -576,3 +579,28 @@ def test_msvc_visual_incompatible():
save(client.cache.new_config_path, new_config)
client.run("install pkg/0.1@ -pr=profile", assert_error=True)
assert "ERROR: Missing prebuilt package for 'pkg/0.1'" in client.out


@pytest.mark.skipif(platform.system() != "Darwin", reason="requires OSX")
def test_apple_clang_compatible():
"""
From apple-clang version 13 we detect apple-clang version as 13 and we make
this compiler version compatible with 13.0
"""
conanfile = GenConanfile().with_settings("os", "compiler", "build_type", "arch")
client = TestClient()
profile = textwrap.dedent("""
[settings]
os=Macos
arch=x86_64
compiler=apple-clang
compiler.version=13
compiler.libcxx=libc++
build_type=Release
""")
client.save({"conanfile.py": conanfile,
"profile": profile})
client.run('create . pkg/0.1@ -s os=Macos -s compiler="apple-clang" -s compiler.version=13.0 '
'-s build_type=Release -s arch=x86_64')
client.run("install pkg/0.1@ -pr=profile")
assert "Using compatible package" in client.out

0 comments on commit 72f3918

Please sign in to comment.