diff --git a/conans/client/conf/__init__.py b/conans/client/conf/__init__.py index 6a41e172047..905b684c474 100644 --- a/conans/client/conf/__init__.py +++ b/conans/client/conf/__init__.py @@ -13,12 +13,12 @@ default_settings_yml = """ # Only for cross building, 'os_build/arch_build' is the system that runs Conan os_build: [Windows, WindowsStore, Linux, Macos, FreeBSD, SunOS] -arch_build: [x86, x86_64, ppc64le, ppc64, armv6, armv7, armv7hf, armv8, sparc, sparcv9, mips, mips64, avr, armv7s, armv7k] +arch_build: [x86, x86_64, ppc32, ppc64le, ppc64, armv6, armv7, armv7hf, armv7s, armv7k, armv8, armv8_32, armv8.3, sparc, sparcv9, mips, mips64, avr] # 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, Arduino] -arch_target: [x86, x86_64, ppc64le, ppc64, armv6, armv7, armv7hf, armv8, sparc, sparcv9, mips, mips64, avr, armv7s, armv7k] +arch_target: [x86, x86_64, ppc32, ppc64le, ppc64, armv6, armv7, armv7hf, armv7s, armv7k, armv8, armv8_32, armv8.3, sparc, sparcv9, mips, mips64, avr] # Rest of the settings are "host" settings: # - For native building/cross building: Where the library/program will run. @@ -43,7 +43,7 @@ SunOS: Arduino: board: ANY -arch: [x86, x86_64, ppc64le, ppc64, armv6, armv7, armv7hf, armv8, sparc, sparcv9, mips, mips64, avr, armv7s, armv7k] +arch: [x86, x86_64, ppc32, ppc64le, ppc64, armv6, armv7, armv7hf, armv7s, armv7k, armv8, armv8_32, armv8.3, sparc, sparcv9, mips, mips64, avr] compiler: sun-cc: version: ["5.10", "5.11", "5.12", "5.13", "5.14"] diff --git a/conans/client/generators/b2.py b/conans/client/generators/b2.py index 02def18df71..7de7dbd6adf 100644 --- a/conans/client/generators/b2.py +++ b/conans/client/generators/b2.py @@ -14,6 +14,8 @@ class B2Generator(Generator): + _b2_variation_key = None + _b2_variation_id = None @property def filename(self): @@ -21,11 +23,11 @@ def filename(self): @property def content(self): - ''' + """ Generates two content files: conanbuildinfo.jam and conanbuildinfo-ID.jam which the former defines sub-projects for each package and loads the other files and the latter define variables and targets for the packages. - ''' + """ result = { 'conanbuildinfo.jam': None, self.conanbuildinfo_variation_jam: None @@ -56,7 +58,7 @@ def content(self): cbiv = [self.conanbuildinfo_header_text] # The first, 1, set of variables are collective in that they have the info for all # of the packages combined, 1a. - cbiv += ["# global" ] + cbiv += ["# global"] cbiv += self.b2_constants_for_dep('conan', self.deps_build_info) # Now the constants for individual packages, 1b. for dep_name, dep_cpp_info in self.deps_build_info.dependencies: @@ -72,10 +74,10 @@ def content(self): return result def b2_project_for_dep(self, name, info): - ''' + """ Generates a sub-project definition to match the package. Which is used later to define targets for the package libs. - ''' + """ if not info: return [] name = name.lower() @@ -83,11 +85,11 @@ def b2_project_for_dep(self, name, info): return [self.conanbuildinfo_project_template.format(name=name)] def b2_constants_for_dep(self, name, info, user=None): - ''' + """ Generates a list of constant variable definitions for the information in the CppInfo conan data given for the package. If user variables map is also given those are also generated following the package variables. - ''' + """ if not info: return [] name = name.lower() @@ -119,10 +121,10 @@ def b2_constants_for_dep(self, name, info, user=None): return result def b2_targets_for_dep(self, name, info): - ''' + """ Generates individual targets for the libraries in a package and a single "libs" collective alias target that refers to them. - ''' + """ if not info: return [] name = name.lower() @@ -140,10 +142,10 @@ def b2_targets_for_dep(self, name, info): return result def b2_constant(self, name, var, val, is_paths=False): - ''' + """ Generates a constant definition for the given variable and value(s). If is_path - is True the value(s) are reformated to be acceptable to b2. - ''' + is True the value(s) are reformatted to be acceptable to b2. + """ if not val: return [] if is_paths: @@ -158,46 +160,43 @@ def b2_constant(self, name, var, val, is_paths=False): name=name, var=var, variation=self.b2_variation_id, value="\n".join(value) )] - def b2_path(self, p): - ''' - Adjust a ragular path to the form b2 can use in source code. - ''' - return p.replace('\\', '/') - - def b2_features(self, m): - ''' - Generated a b2 requirements list, i.e. value list, from the given - map of key-values. - ''' + @staticmethod + def b2_path(path): + """ + Adjust a regular path to the form b2 can use in source code. + """ + return path.replace('\\', '/') + + @staticmethod + def b2_features(variations): + """ + Generated a b2 requirements list, i.e. value list, from the given 'variations' dict. + """ result = [] - for k, v in sorted(m.items()): + for k, v in sorted(variations.items()): if v: result += ['<%s>%s' % (k, v)] return result @property def conanbuildinfo_variation_jam(self): - return 'conanbuildinfo-%s.jam' % (self.b2_variation_key) - - _b2_variation_key = None + return 'conanbuildinfo-%s.jam' % self.b2_variation_key @property def b2_variation_key(self): - ''' + """ A hashed key of the variation to use a UID for the variation. - ''' + """ if not self._b2_variation_key: self._b2_variation_key = md5(self.b2_variation_id.encode('utf-8')).hexdigest() return self._b2_variation_key - _b2_variation_id = None - @property def b2_variation_id(self): - ''' + """ A compact single comma separated list of the variation where only the values of the b2 variation are included in sorted by feature name order. - ''' + """ if not self._b2_variation_id: vid = [] for k in sorted(self.b2_variation.keys()): @@ -208,34 +207,34 @@ def b2_variation_id(self): @property def b2_variation(self): - ''' + """ Returns a map of b2 features & values as translated from conan settings that can affect the link compatibility of libraries. - ''' + """ if not getattr(self, "_b2_variation_key", None): self._b2_variation = {} self._b2_variation['toolset'] = self.b2_toolset_name + '-' + self.b2_toolset_version self._b2_variation['architecture'] = { 'x86': 'x86', 'x86_64': 'x86', - 'ppc64le': 'power', 'ppc64': 'power', - 'armv6': 'arm', 'armv7': 'arm', 'armv7hf': 'arm', 'armv8': 'arm', - 'armv7s': 'arm', 'armv7k': 'arm', + 'ppc64le': 'power', 'ppc64': 'power', 'ppc32': 'power', + 'armv6': 'arm', 'armv7': 'arm', 'armv7hf': 'arm', 'armv7s': 'arm', 'armv7k': 'arm', + 'armv8': 'arm', 'armv8_32': 'arm', 'armv8.3': 'arm', 'sparc': 'sparc', 'sparcv9': 'sparc', 'mips': 'mips1', 'mips64': 'mips64', }.get(self.conanfile.settings.get_safe('arch')) self._b2_variation['instruction-set'] = { 'armv6': 'armv6', 'armv7': 'armv7', 'armv7hf': None, 'armv7k': None, - 'armv7s': 'armv7s', 'armv8': None, 'avr': None, + 'armv7s': 'armv7s', 'armv8': None, 'armv8_32': None, 'armv8.3': None, 'avr': None, 'mips': None, 'mips64': None, - 'ppc64le': None, 'ppc64': 'powerpc64', + 'ppc64le': None, 'ppc64': 'powerpc64', 'ppc32': None, 'sparc': None, 'sparcv9': 'v9', 'x86': None, 'x86_64': None, }.get(self.conanfile.settings.get_safe('arch')) self._b2_variation['address-model'] = { 'x86': '32', 'x86_64': '64', - 'ppc64le': '64', 'ppc64': '64', - 'armv6': '32', 'armv7': '32', 'armv7hf': '32', 'armv8': '64', - 'armv7s': '32', 'armv7k': '32', + 'ppc64le': '64', 'ppc64': '64', 'ppc32': '32', + 'armv6': '32', 'armv7': '32', 'armv7s': '32', 'armv7k': '32', 'armv7hf': '32', + 'armv8': '64', 'armv8_32': '32', 'armv8.3': "64", 'sparc': '32', 'sparcv9': '64', 'mips': '32', 'mips64': '64', }.get(self.conanfile.settings.get_safe('arch')) @@ -295,14 +294,14 @@ def b2_toolset_version(self): return str(self.conanfile.settings.compiler.version)+'.0' return str(self.conanfile.settings.get_safe('compiler.version')) - conanbuildinfo_header_text = '''\ + conanbuildinfo_header_text = """\ #| B2 definitions for Conan packages. This is a generated file. Edit the corresponding conanfile.txt instead. |# -''' +""" - conanbuildinfo_prefix_text = '''\ + conanbuildinfo_prefix_text = """\ import path ; import project ; import modules ; @@ -380,14 +379,14 @@ def b2_toolset_version(self): call-in-project : include-conanbuildinfo $(__cbi__) ; } } -''' +""" - conanbuildinfo_project_template = '''\ + conanbuildinfo_project_template = """\ # {name} project-define {name} ; -''' +""" - conanbuildinfo_postfix_text = '''\ + conanbuildinfo_postfix_text = """\ { local __define_targets__ = yes ; for local __cbi__ in $(__conanbuildinfo__) @@ -395,15 +394,15 @@ def b2_toolset_version(self): call-in-project : include-conanbuildinfo $(__cbi__) ; } } -''' +""" - conanbuildinfo_variation_constant_template = '''\ + conanbuildinfo_variation_constant_template = """\ constant-if {var}({name},{variation}) : {value} ; -''' +""" - conanbuildinfo_variation_lib_template = '''\ + conanbuildinfo_variation_lib_template = """\ if $(__define_targets__) {{ call-in-project $({name}-mod) : lib {lib} : @@ -411,9 +410,9 @@ def b2_toolset_version(self): : : $(usage-requirements({name},{variation})) ; call-in-project $({name}-mod) : explicit {lib} ; }} -''' +""" - conanbuildinfo_variation_alias_template = '''\ + conanbuildinfo_variation_alias_template = """\ if $(__define_targets__) {{ call-in-project $({name}-mod) : alias libs : {libs} @@ -421,4 +420,4 @@ def b2_toolset_version(self): : : $(usage-requirements({name},{variation})) ; call-in-project $({name}-mod) : explicit libs ; }} -''' +""" diff --git a/conans/client/migrations.py b/conans/client/migrations.py index 9766adf283c..b24b501f942 100644 --- a/conans/client/migrations.py +++ b/conans/client/migrations.py @@ -43,16 +43,16 @@ def _make_migrations(self, old_version): # VERSION 0.1 if old_version is None: return - if old_version < Version("1.9.0"): + if old_version < Version("1.12.0"): old_settings = """ # Only for cross building, 'os_build/arch_build' is the system that runs Conan os_build: [Windows, WindowsStore, Linux, Macos, FreeBSD, SunOS] -arch_build: [x86, x86_64, ppc64le, ppc64, armv6, armv7, armv7hf, armv8, sparc, sparcv9, mips, mips64, avr, armv7s, armv7k] +arch_build: [x86, x86_64, ppc32, ppc64le, ppc64, armv6, armv7, armv7hf, armv7s, armv7k, armv8, armv8_32, armv8.3, sparc, sparcv9, mips, mips64, avr] # 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, Arduino] -arch_target: [x86, x86_64, ppc64le, ppc64, armv6, armv7, armv7hf, armv8, sparc, sparcv9, mips, mips64, avr, armv7s, armv7k] +arch_target: [x86, x86_64, ppc32, ppc64le, ppc64, armv6, armv7, armv7hf, armv7s, armv7k, armv8, armv8_32, armv8.3, sparc, sparcv9, mips, mips64, avr] # Rest of the settings are "host" settings: # - For native building/cross building: Where the library/program will run. @@ -77,7 +77,7 @@ def _make_migrations(self, old_version): SunOS: Arduino: board: ANY -arch: [x86, x86_64, ppc64le, ppc64, armv6, armv7, armv7hf, armv8, sparc, sparcv9, mips, mips64, avr, armv7s, armv7k] +arch: [x86, x86_64, ppc32, ppc64le, ppc64, armv6, armv7, armv7hf, armv7s, armv7k, armv8, armv8_32, armv8.3, sparc, sparcv9, mips, mips64, avr] compiler: sun-cc: version: ["5.10", "5.11", "5.12", "5.13", "5.14"] @@ -88,7 +88,7 @@ def _make_migrations(self, old_version): "5", "5.1", "5.2", "5.3", "5.4", "5.5", "6", "6.1", "6.2", "6.3", "6.4", "7", "7.1", "7.2", "7.3", - "8", "8.1"] + "8", "8.1", "8.2"] libcxx: [libstdc++, libstdc++11] threads: [None, posix, win32] # Windows MinGW exception: [None, dwarf2, sjlj, seh] # Windows MinGW @@ -96,11 +96,13 @@ def _make_migrations(self, old_version): runtime: [MD, MT, MTd, MDd] version: ["8", "9", "10", "11", "12", "14", "15"] 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, + 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] 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"] diff --git a/conans/client/tools/apple.py b/conans/client/tools/apple.py index a57af4a6e22..e6ea26483c0 100644 --- a/conans/client/tools/apple.py +++ b/conans/client/tools/apple.py @@ -15,6 +15,8 @@ def to_apple_arch(arch): 'x86_64': 'x86_64', 'armv7': 'armv7', 'armv8': 'arm64', + 'armv8_32': 'arm64_32', + 'armv8.3': 'arm64e', 'armv7s': 'armv7s', 'armv7k': 'armv7k'}.get(str(arch)) diff --git a/conans/client/tools/oss.py b/conans/client/tools/oss.py index 1a14bfc7600..909025be8b5 100644 --- a/conans/client/tools/oss.py +++ b/conans/client/tools/oss.py @@ -37,6 +37,8 @@ def detected_architecture(): return "ppc64le" elif "ppc64" in machine: return "ppc64" + elif "ppc" in machine: + return "ppc32" elif "mips64" in machine: return "mips64" elif "mips" in machine: @@ -341,7 +343,10 @@ def get_gnu_triplet(os_, arch, compiler=None): # Calculate the arch machine = {"x86": "i686" if os_ != "Linux" else "x86", "x86_64": "x86_64", - "armv8": "aarch64"}.get(arch, None) + "armv8": "aarch64", + "armv8_32": "aarch64", # https://wiki.linaro.org/Platform/arm64-ilp32 + "armv8.3": "aarch64" + }.get(arch, None) if not machine: # https://wiki.debian.org/Multiarch/Tuples @@ -351,7 +356,7 @@ def get_gnu_triplet(os_, arch, compiler=None): machine = "powerpc64le" elif "ppc64" in arch: machine = "powerpc64" - elif "powerpc" in arch: + elif "ppc32" in arch: machine = "powerpc" elif "mips64" in arch: machine = "mips64" @@ -385,10 +390,13 @@ def get_gnu_triplet(os_, arch, compiler=None): "tvOS": "apple-darwin"}.get(os_, os_.lower()) if os_ in ("Linux", "Android"): - if "arm" in arch and arch != "armv8": + if "arm" in arch and "armv8" not in arch: op_system += "eabi" if arch == "armv7hf" and os_ == "Linux": op_system += "hf" + if arch == "armv8_32" and os_ == "Linux": + op_system += "_ilp32" # https://wiki.linaro.org/Platform/arm64-ilp32 + return "%s-%s" % (machine, op_system) diff --git a/conans/test/unittests/util/apple_test.py b/conans/test/unittests/util/apple_test.py index 0ca809451d6..c0ed05a1628 100644 --- a/conans/test/unittests/util/apple_test.py +++ b/conans/test/unittests/util/apple_test.py @@ -37,6 +37,8 @@ def test_to_apple_arch(self): self.assertEqual(tools.to_apple_arch('armv7s'), 'armv7s') self.assertEqual(tools.to_apple_arch('armv7k'), 'armv7k') self.assertEqual(tools.to_apple_arch('armv8'), 'arm64') + self.assertEqual(tools.to_apple_arch('armv8.3'), 'arm64e') + self.assertEqual(tools.to_apple_arch('armv8_32'), 'arm64_32') self.assertIsNone(tools.to_apple_arch('mips')) def test_apple_sdk_name(self): diff --git a/conans/test/unittests/util/tools_test.py b/conans/test/unittests/util/tools_test.py index c3d4b7d0a8c..3da8eb05d8b 100644 --- a/conans/test/unittests/util/tools_test.py +++ b/conans/test/unittests/util/tools_test.py @@ -1025,6 +1025,7 @@ def __call__(self, command, output, log_filepath=None, self.assertIn('^&^& PATH=\\^"/cygdrive/other/path:/cygdrive/path/to/somewhere:$PATH\\^" ' '^&^& MYVAR=34 ^&^& a_command.bat ^', conanfile._conan_runner.command) + @attr("slow") def download_retries_test(self): http_server = StoppableThreadBottle() @@ -1160,6 +1161,10 @@ def get_values(this_os, this_arch, setting_os, setting_arch, compiler=None): self.assertEquals(build, "x86_64-linux-gnu") self.assertEquals(host, "arm-linux-gnueabi") + build, host = get_values("Linux", "x86_64", "Linux", "armv8_32") + self.assertEquals(build, "x86_64-linux-gnu") + self.assertEquals(host, "aarch64-linux-gnu_ilp32") + build, host = get_values("Linux", "x86_64", "Android", "x86") self.assertEquals(build, "x86_64-linux-gnu") self.assertEquals(host, "i686-linux-android") @@ -1220,6 +1225,22 @@ def get_values(this_os, this_arch, setting_os, setting_arch, compiler=None): self.assertEquals(build, "x86_64-apple-darwin") self.assertEquals(host, "aarch64-apple-darwin") + build, host = get_values("Darwin", "x86_64", "tvOS", "armv8.3") + self.assertEquals(build, "x86_64-apple-darwin") + self.assertEquals(host, "aarch64-apple-darwin") + + build, host = get_values("Darwin", "x86_64", "watchOS", "armv8_32") + self.assertEquals(build, "x86_64-apple-darwin") + self.assertEquals(host, "aarch64-apple-darwin") + + build, host = get_values("Linux", "x86_64", "Linux", "ppc32") + self.assertEquals(build, "x86_64-linux-gnu") + self.assertEquals(host, "powerpc-linux-gnu") + + build, host = get_values("Linux", "x86", "Linux", "ppc64") + self.assertEquals(build, "x86-linux-gnu") + self.assertEquals(host, "powerpc64-linux-gnu") + for _os in ["Windows", "Linux"]: for arch in ["x86_64", "x86"]: triplet = tools.get_gnu_triplet(_os, arch, "gcc")