def _get_host_build_target_flags(self): """Based on google search for build/host triplets, it could need a lot and complex verification""" arch_detected = detected_architecture() or platform.machine() os_detected = platform.system() arch_settings = self._conanfile.settings.get_safe("arch") os_settings = self._conanfile.settings.get_safe("os") compiler = self._conanfile.settings.get_safe("compiler") if (os_detected is None or arch_detected is None or arch_settings is None or os_settings is None): return False, False, False if not cross_building(self._conanfile.settings, os_detected, arch_detected): return False, False, False try: build = get_gnu_triplet(os_detected, arch_detected, compiler) except ConanException: build = None try: host = get_gnu_triplet(os_settings, arch_settings, compiler) except ConanException: host = None return build, host, None
def _build_install_binutils(self, target): autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) conf_args = [ "--prefix={}".format(os.path.join(self.package_folder, target).replace("\\", "/")), "--disable-build-warnings", "--target={}".format(target), ] autotools.flags.extend(["-DSTDC_HEADERS", "-D_FORTIFY_SOURCE=0"]) host = tools.get_gnu_triplet(str(self.settings.os), str(self.settings.arch), str(self.settings.compiler)) build = tools.get_gnu_triplet(tools.detected_os(), tools.detected_architecture(), "gcc") if tools.os_info.is_windows: build = "{}-w64-mingw32".format({ "x86": "i686", }.get(str(tools.detected_architecture()), str(tools.detected_architecture()))) if self.settings.os == "Windows": host = "{}-w64-mingw32".format({ "x86": "i686", }.get(str(self.settings.arch), str(self.settings.arch))) build_folder = os.path.join("build_binutils_{}".format(target)) tools.mkdir(build_folder) with tools.chdir(build_folder): self.output.info("Building binutils for target={}".format(target)) autotools.configure(args=conf_args, configure_dir=os.path.join(self.source_folder, "binutils"), build=build, host=host) autotools.make() autotools.install()
def get_values(this_os, this_arch, setting_os, setting_arch, compiler=None): build = tools.get_gnu_triplet(this_os, this_arch, compiler) host = tools.get_gnu_triplet(setting_os, setting_arch, compiler) return build, host
def test(self): triplet = tools.get_gnu_triplet(str(self.settings.os), str(self.settings.arch), str(self.settings.compiler)) self.run("config.guess", run_environment=True, win_bash=tools.os_info.is_windows) try: self.run("config.sub {}".format(triplet), run_environment=True, win_bash=tools.os_info.is_windows) except ConanException: self.output.info("Current configuration is not supported by GNU config.\nIgnoring...")
def _configure_autotools(self): if self._autotools: return self._autotools self._autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) if self.settings.compiler in ("apple-clang", ): if self.settings.arch in ("armv7", ): self._autotools.link_flags.append("-arch armv7") elif self.settings.arch in ("armv8", ): self._autotools.link_flags.append("-arch arm64") vars = self._autotools.vars conf_args = [ # librhash's configure script does not understand `--enable-opt1=yes` "--enable-openssl" if self.options.with_openssl else "--disable-openssl", "--disable-gettext", # librhash's configure script is custom and does not understand "--bindir=${prefix}/bin" arguments "--prefix={}".format(tools.unix_path(self.package_folder)), "--bindir={}".format(tools.unix_path(os.path.join(self.package_folder, "bin"))), "--libdir={}".format(tools.unix_path(os.path.join(self.package_folder, "lib"))), # the configure script does not use CPPFLAGS, so add it to CFLAGS/CXXFLAGS "--extra-cflags={}".format("{} {}".format(vars["CFLAGS"], vars["CPPFLAGS"])), "--extra-ldflags={}".format(vars["LDFLAGS"]), ] if self.options.shared: conf_args.extend(["--enable-lib-shared", "--disable-lib-static"]) else: conf_args.extend(["--disable-lib-shared", "--enable-lib-static"]) with tools.environment_append({ "BUILD_TARGET": tools.get_gnu_triplet(str(self.settings.os), str(self.settings.arch), str(self.settings.compiler)), }): self._autotools.configure(args=conf_args, use_default_install_dirs=False, build=False, host=False) return self._autotools
def _target_arch(self): target_arch, _, _ = tools.get_gnu_triplet( "Macos" if tools.is_apple_os( self.settings.os) else str(self.settings.os), str(self.settings.arch), str(self.settings.compiler) if self.settings.os == "Windows" else None, ).split("-") return target_arch
def _build_config_cmd(self): prefix = self.package_folder.replace("\\", "/") arch64 = ['x86_64', 'sparcv9', 'ppc64', 'ppc64le', 'armv8', 'armv8.3', 'mips64'] bits = "64" if self.settings.arch in arch64 else "32" args = [self._platform, "--prefix={0}".format(prefix), "--disable-samples", "--disable-layout", "--disable-layoutex", "--disable-extras"] if not self.options.with_dyload: args += ["--disable-dyload"] if not self._enable_icu_tools: args.append("--disable-tools") env_build = self._configure_autotools() if tools.cross_building(self, skip_x64_x86=True): if self.settings.os in ["iOS", "tvOS", "watchOS"]: args.append("--host={}".format(tools.get_gnu_triplet("Macos", str(self.settings.arch)))) elif env_build.host: args.append("--host={}".format(env_build.host)) bin_path = self.deps_env_info["icu"].PATH[0] base_path, _ = bin_path.rsplit('/', 1) args.append("--with-cross-build={}".format(base_path)) else: args.append("--with-library-bits={0}".format(bits),) if self.settings.os != "Windows": # http://userguide.icu-project.org/icudata # This is the only directly supported behavior on Windows builds. args.append("--with-data-packaging={0}".format(self.options.data_packaging)) datadir = os.path.join(self.package_folder, "lib") datadir = datadir.replace("\\", "/") if tools.os_info.is_windows else datadir args.append("--datarootdir=%s" % datadir) # do not use share bindir = os.path.join(self.package_folder, "bin") bindir = bindir.replace("\\", "/") if tools.os_info.is_windows else bindir args.append("--sbindir=%s" % bindir) libdir = os.path.join(self.package_folder, "lib") libdir = libdir.replace("\\", "/") if tools.os_info.is_windows else libdir args.append("--libdir=%s" % libdir) if self._is_mingw: mingw_chost = "i686-w64-mingw32" if self.settings.arch == "x86" else "x86_64-w64-mingw32" args.extend(["--build={0}".format(mingw_chost), "--host={0}".format(mingw_chost)]) if self.settings.build_type == "Debug": args.extend(["--disable-release", "--enable-debug"]) if self.options.shared: args.extend(["--disable-static", "--enable-shared"]) else: args.extend(["--enable-static", "--disable-shared"]) if not self.options.with_unit_tests: args.append("--disable-tests") return "../source/runConfigureICU %s" % " ".join(args)
def _configure_cmake(self): if tools.cross_building(self.settings) and self.settings.os != "Windows": host = tools.get_gnu_triplet(str(self.settings.os), str(self.settings.arch)) tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), "execute_process(COMMAND ./configure ", "execute_process(COMMAND ./configure --host %s " % host) cmake = CMake(self) cmake.configure(build_folder=self._build_subfolder) return cmake
def _configure_autotools(self): if self._autotools: return self._autotools self._autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) self._autotools.libs = [] yes_no = lambda v: "yes" if v else "no" conf_args = [ "--enable-shared={}".format(yes_no(self.options.shared)), "--with-doc-strings={}".format(yes_no(self.options.docstrings)), "--with-pymalloc={}".format(yes_no(self.options.pymalloc)), "--with-system-expat", "--with-system-ffi", "--enable-optimizations={}".format(yes_no(self.options.optimizations)), "--with-lto={}".format(yes_no(self.options.lto)), "--with-pydebug={}".format(yes_no(self.settings.build_type == "Debug")), ] if self._is_py2: conf_args.extend([ "--enable-unicode={}".format(yes_no(self.options.unicode)), ]) if self._is_py3: conf_args.extend([ "--with-system-libmpdec", "--with-openssl={}".format(self.deps_cpp_info["openssl"].rootpath), "--enable-loadable-sqlite-extensions={}".format(yes_no(not self.options["sqlite3"].omit_load_extension)), ]) if self.settings.compiler == "intel": conf_args.extend(["--with-icc"]) if tools.get_env("CC") or self.settings.compiler != "gcc": conf_args.append("--without-gcc") if self.options.with_tkinter: tcltk_includes = [] tcltk_libs = [] # FIXME: collect using some conan util (https://github.com/conan-io/conan/issues/7656) for dep in ("tcl", "tk", "zlib"): tcltk_includes += ["-I{}".format(d) for d in self.deps_cpp_info[dep].include_paths] tcltk_libs += ["-l{}".format(lib) for lib in self.deps_cpp_info[dep].libs] if self.settings.os == "Linux" and not self.options["tk"].shared: # FIXME: use info from xorg.components (x11, xscrnsaver) tcltk_libs.extend(["-l{}".format(lib) for lib in ("X11", "Xss")]) conf_args.extend([ "--with-tcltk-includes={}".format(" ".join(tcltk_includes)), "--with-tcltk-libs={}".format(" ".join(tcltk_libs)), ]) if self.settings.os in ("Linux", "FreeBSD"): # Building _testembed fails due to missing pthread/rt symbols self._autotools.link_flags.append("-lpthread") build = None if tools.cross_building(self) and not tools.cross_building(self, skip_x64_x86=True): # Building from x86_64 to x86 is not a "real" cross build, so set build == host build = tools.get_gnu_triplet(str(self.settings.os), str(self.settings.arch), str(self.settings.compiler)) self._autotools.configure(args=conf_args, configure_dir=self._source_subfolder, build=build) return self._autotools
def _target_os(self): if self.settings.compiler == "Visual Studio": return "win32" else: _, _, target_os = tools.get_gnu_triplet( "Macos" if tools.is_apple_os(self.settings.os) else str( self.settings.os), str(self.settings.arch), str(self.settings.compiler) if self.settings.os == "Windows" else None, ).split("-") return target_os
def _target_os(self): if self._is_msvc: return "win32" else: _, _, target_os = tools.get_gnu_triplet( "Macos" if tools.is_apple_os( self.settings.os) else str(self.settings.os), str(self.settings.arch), str(self.settings.compiler) if self.settings.os == "Windows" else None, ).split("-") if target_os == "gnueabihf": target_os = "gnu" # could also be "linux" return target_os
def _build_install_newlib(self, target): ff = lambda a: not a.startswith("-m") autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) conf_args = [ "--prefix={}".format(os.path.join(self.package_folder, target).replace("\\", "/")), "--target={}".format(target), ] autotools.flags = list(filter(ff, autotools.flags)) autotools.cxx_flags = list(filter(ff, autotools.cxx_flags)) autotools.link_flags = list(filter(ff, autotools.link_flags)) host = tools.get_gnu_triplet(str(self.settings.os), str(self.settings.arch), str(self.settings.compiler)) build = tools.get_gnu_triplet(tools.detected_os(), tools.detected_architecture()) if tools.os_info.is_windows: build = "{}-w64-mingw32".format({ "x86": "i686" }.get(str(self.settings.arch), str(self.settings.arch))) if self.settings.os == "Windows": host = "{}-w64-mingw32".format({ "x86": "i686" }.get(str(self.settings.arch), str(self.settings.arch))) env = { "PATH": [os.path.join(self.package_folder, target, "bin")], "CPPFLAGS_FOR_TARGET": "-G0", } self.output.info("env={}".format(env)) build_folder = os.path.join("build_newlib_{}".format(target)) tools.mkdir(build_folder) with tools.chdir(build_folder): with tools.environment_append(env): self.output.info("Building newlib for target={}".format(target)) autotools.configure(args=conf_args, configure_dir=os.path.join(self.source_folder, "newlib"), build=build, host=host) autotools.make(args=["-j1"]) autotools.install()
def _get_host_build_target_flags(self): """Based on google search for build/host triplets, it could need a lot and complex verification""" arch_detected = detected_architecture() or platform.machine() os_detected = platform.system() if os_detected is None or arch_detected is None or self._arch is None or self._os is None: return False, False, False if not cross_building(self._conanfile.settings, os_detected, arch_detected): return False, False, False try: build = get_gnu_triplet(os_detected, arch_detected, self._compiler) except ConanException as exc: self._conanfile.output.warn(str(exc)) build = None try: host = get_gnu_triplet(self._os, self._arch, self._compiler) except ConanException as exc: self._conanfile.output.warn(str(exc)) host = None return build, host, None
def _configure_cmake(self): if self._cmake: return self._cmake if tools.Version(self.version) <= "0.13.1" and \ tools.cross_building(self.settings) and self.settings.os != "Windows": host = tools.get_gnu_triplet(str(self.settings.os), str(self.settings.arch)) tools.replace_in_file( os.path.join(self._source_subfolder, "CMakeLists.txt"), "execute_process(COMMAND ./configure ", "execute_process(COMMAND ./configure --host %s " % host) self._cmake = CMake(self) if tools.Version(self.version) >= "0.15": self._cmake.definitions[ "BUILD_STATIC_LIBS"] = not self.options.shared self._cmake.definitions[ "DISABLE_STATIC_FPIC"] = not self.options.get_safe( "fPIC", True) self._cmake.configure(build_folder=self._build_subfolder) return self._cmake
def host(self): return tools.get_gnu_triplet(self.settings.os.value, self.settings.arch.value, "gcc")
def get_gnu_triplet_test(self): def get_values(this_os, this_arch, setting_os, setting_arch, compiler=None): build = tools.get_gnu_triplet(this_os, this_arch, compiler) host = tools.get_gnu_triplet(setting_os, setting_arch, compiler) return build, host build, host = get_values("Linux", "x86_64", "Linux", "armv7hf") self.assertEquals(build, "x86_64-linux-gnu") self.assertEquals(host, "arm-linux-gnueabihf") build, host = get_values("Linux", "x86", "Linux", "armv7hf") self.assertEquals(build, "x86-linux-gnu") self.assertEquals(host, "arm-linux-gnueabihf") build, host = get_values("Linux", "x86_64", "Linux", "x86") self.assertEquals(build, "x86_64-linux-gnu") self.assertEquals(host, "x86-linux-gnu") build, host = get_values("Linux", "x86_64", "Windows", "x86", compiler="gcc") self.assertEquals(build, "x86_64-linux-gnu") self.assertEquals(host, "i686-w64-mingw32") build, host = get_values("Linux", "x86_64", "Windows", "x86", compiler="Visual Studio") self.assertEquals(build, "x86_64-linux-gnu") self.assertEquals( host, "i686-windows-msvc") # Not very common but exists sometimes build, host = get_values("Linux", "x86_64", "Linux", "armv7hf") self.assertEquals(build, "x86_64-linux-gnu") self.assertEquals(host, "arm-linux-gnueabihf") build, host = get_values("Linux", "x86_64", "Linux", "armv7") self.assertEquals(build, "x86_64-linux-gnu") self.assertEquals(host, "arm-linux-gnueabi") build, host = get_values("Linux", "x86_64", "Linux", "armv6") self.assertEquals(build, "x86_64-linux-gnu") self.assertEquals(host, "arm-linux-gnueabi") build, host = get_values("Linux", "x86_64", "Android", "x86") self.assertEquals(build, "x86_64-linux-gnu") self.assertEquals(host, "i686-linux-android") build, host = get_values("Linux", "x86_64", "Android", "x86_64") self.assertEquals(build, "x86_64-linux-gnu") self.assertEquals(host, "x86_64-linux-android") build, host = get_values("Linux", "x86_64", "Android", "armv7") self.assertEquals(build, "x86_64-linux-gnu") self.assertEquals(host, "arm-linux-androideabi") build, host = get_values("Linux", "x86_64", "Android", "armv7hf") self.assertEquals(build, "x86_64-linux-gnu") self.assertEquals(host, "arm-linux-androideabi") build, host = get_values("Linux", "x86_64", "Android", "armv8") self.assertEquals(build, "x86_64-linux-gnu") self.assertEquals(host, "aarch64-linux-android") build, host = get_values("Linux", "x86_64", "Android", "armv6") self.assertEquals(build, "x86_64-linux-gnu") self.assertEquals(host, "arm-linux-androideabi") build, host = get_values("Linux", "x86_64", "Windows", "x86", compiler="gcc") self.assertEquals(build, "x86_64-linux-gnu") self.assertEquals(host, "i686-w64-mingw32") build, host = get_values("Linux", "x86_64", "Windows", "x86_64", compiler="gcc") self.assertEquals(build, "x86_64-linux-gnu") self.assertEquals(host, "x86_64-w64-mingw32") build, host = get_values("Windows", "x86_64", "Windows", "x86", compiler="gcc") self.assertEquals(build, "x86_64-w64-mingw32") self.assertEquals(host, "i686-w64-mingw32") build, host = get_values("Windows", "x86_64", "Linux", "armv7hf", compiler="gcc") self.assertEquals(build, "x86_64-w64-mingw32") self.assertEquals(host, "arm-linux-gnueabihf") build, host = get_values("Darwin", "x86_64", "Android", "armv7hf") self.assertEquals(build, "x86_64-apple-darwin") self.assertEquals(host, "arm-linux-androideabi") build, host = get_values("Darwin", "x86_64", "Macos", "x86") self.assertEquals(build, "x86_64-apple-darwin") self.assertEquals(host, "i686-apple-darwin") build, host = get_values("Darwin", "x86_64", "iOS", "armv7") self.assertEquals(build, "x86_64-apple-darwin") self.assertEquals(host, "arm-apple-darwin") build, host = get_values("Darwin", "x86_64", "watchOS", "armv7k") self.assertEquals(build, "x86_64-apple-darwin") self.assertEquals(host, "arm-apple-darwin") build, host = get_values("Darwin", "x86_64", "tvOS", "armv8") self.assertEquals(build, "x86_64-apple-darwin") self.assertEquals(host, "aarch64-apple-darwin") for os in ["Windows", "Linux"]: for arch in ["x86_64", "x86"]: triplet = tools.get_gnu_triplet(os, arch, "gcc") output = "" if arch == "x86_64": output += "x86_64" else: output += "i686" if os != "Linux" else "x86" output += "-" if os == "Windows": output += "w64-mingw32" else: output += "linux-gnu" self.assertIn(output, triplet) # Compiler not specified for os="Windows" with self.assertRaises(ConanException): tools.get_gnu_triplet("Windows", "x86")
def _build_install_gcc(self, target, stage): autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) conf_args = [ "--prefix={}".format(os.path.join(self.package_folder, target).replace("\\", "/")), "--disable-build-warnings", "--target={}".format(target), "--with-newlib", ] env = {} if stage == 1: conf_args.extend([ "--enable-languages=c", "--without-headers", ]) else: conf_args.extend([ "--enable-languages=c,c++", "--with-headers={}".format(tools.unix_path(os.path.join(self.package_folder, target, target, "include"))), ]) ff = lambda a: not a.startswith("-m") env.update({ "CFLAGS_FOR_BUILD": " ".join(autotools.flags), "CXXFLAGS_FOR_BUILD": " ".join(autotools.cxx_flags), "LDFLAGS_FOR_BUILD": " ".join(autotools.link_flags), "CFLAGS_FOR_TARGET": " ".join(filter(ff, autotools.flags)), "CXXFLAGS_FOR_TARGET": " ".join(filter(ff, autotools.cxx_flags)), "LDFLAGS_FOR_TARGET": " ".join(filter(ff, autotools.link_flags)), }) autotools.flags = [] autotools.cxx_flags = [] autotools.link_flags = [] autotools.flags.append("-DSTDC_HEADERS") host = tools.get_gnu_triplet(str(self.settings.os), str(self.settings.arch), str(self.settings.compiler)) build = tools.get_gnu_triplet(tools.detected_os(), tools.detected_architecture()) if tools.os_info.is_windows: build = "{}-w64-mingw32".format({ "x86": "i686" }.get(str(tools.detected_architecture()), str(tools.detected_architecture()))) if self.settings.os == "Windows": host = "{}-w64-mingw32".format({ "x86": "i686" }.get(str(self.settings.arch), str(self.settings.arch))) # Apple needs to pretend to be linux if tools.os_info.is_macos: build = "{}-linux-gnu".format({ "x86": "i686" }.get(str(tools.detected_architecture()), str(tools.detected_architecture()))) if tools.is_apple_os(self.settings.os): host = "{}-linux-gnu".format({ "x86": "i686" }.get(str(self.settings.arch), str(self.settings.arch))) build_folder = os.path.join("build_gcc_stage{}_{}".format(stage, target)) tools.mkdir(build_folder) with tools.chdir(build_folder): with tools.environment_append(env): with tools.environment_append({"PATH": [os.path.join(self.package_folder, target, "bin")]}): self.output.info("Building gcc stage1 for target={}".format(target)) autotools.configure(args=conf_args, configure_dir=os.path.join(self.source_folder, "gcc"), build=build, host=host) autotools.make() autotools.install()
def get_gnu_triplet_test(self): def get_values(this_os, this_arch, setting_os, setting_arch, compiler=None): build = tools.get_gnu_triplet(this_os, this_arch, compiler) host = tools.get_gnu_triplet(setting_os, setting_arch, compiler) return build, host build, host = get_values("Linux", "x86_64", "Linux", "armv7hf") self.assertEquals(build, "x86_64-linux-gnu") self.assertEquals(host, "arm-linux-gnueabihf") build, host = get_values("Linux", "x86", "Linux", "armv7hf") self.assertEquals(build, "x86-linux-gnu") self.assertEquals(host, "arm-linux-gnueabihf") build, host = get_values("Linux", "x86_64", "Linux", "x86") self.assertEquals(build, "x86_64-linux-gnu") self.assertEquals(host, "x86-linux-gnu") build, host = get_values("Linux", "x86_64", "Windows", "x86", compiler="gcc") self.assertEquals(build, "x86_64-linux-gnu") self.assertEquals(host, "i686-w64-mingw32") build, host = get_values("Linux", "x86_64", "Windows", "x86", compiler="Visual Studio") self.assertEquals(build, "x86_64-linux-gnu") self.assertEquals(host, "i686-windows-msvc") # Not very common but exists sometimes build, host = get_values("Linux", "x86_64", "Linux", "armv7hf") self.assertEquals(build, "x86_64-linux-gnu") self.assertEquals(host, "arm-linux-gnueabihf") build, host = get_values("Linux", "x86_64", "Linux", "armv7") self.assertEquals(build, "x86_64-linux-gnu") self.assertEquals(host, "arm-linux-gnueabi") build, host = get_values("Linux", "x86_64", "Linux", "armv6") self.assertEquals(build, "x86_64-linux-gnu") self.assertEquals(host, "arm-linux-gnueabi") build, host = get_values("Linux", "x86_64", "Android", "x86") self.assertEquals(build, "x86_64-linux-gnu") self.assertEquals(host, "i686-linux-android") build, host = get_values("Linux", "x86_64", "Android", "x86_64") self.assertEquals(build, "x86_64-linux-gnu") self.assertEquals(host, "x86_64-linux-android") build, host = get_values("Linux", "x86_64", "Android", "armv7") self.assertEquals(build, "x86_64-linux-gnu") self.assertEquals(host, "arm-linux-androideabi") build, host = get_values("Linux", "x86_64", "Android", "armv7hf") self.assertEquals(build, "x86_64-linux-gnu") self.assertEquals(host, "arm-linux-androideabi") build, host = get_values("Linux", "x86_64", "Android", "armv8") self.assertEquals(build, "x86_64-linux-gnu") self.assertEquals(host, "aarch64-linux-android") build, host = get_values("Linux", "x86_64", "Android", "armv6") self.assertEquals(build, "x86_64-linux-gnu") self.assertEquals(host, "arm-linux-androideabi") build, host = get_values("Linux", "x86_64", "Windows", "x86", compiler="gcc") self.assertEquals(build, "x86_64-linux-gnu") self.assertEquals(host, "i686-w64-mingw32") build, host = get_values("Linux", "x86_64", "Windows", "x86_64", compiler="gcc") self.assertEquals(build, "x86_64-linux-gnu") self.assertEquals(host, "x86_64-w64-mingw32") build, host = get_values("Windows", "x86_64", "Windows", "x86", compiler="gcc") self.assertEquals(build, "x86_64-w64-mingw32") self.assertEquals(host, "i686-w64-mingw32") build, host = get_values("Windows", "x86_64", "Linux", "armv7hf", compiler="gcc") self.assertEquals(build, "x86_64-w64-mingw32") self.assertEquals(host, "arm-linux-gnueabihf") build, host = get_values("Darwin", "x86_64", "Android", "armv7hf") self.assertEquals(build, "x86_64-apple-darwin") self.assertEquals(host, "arm-linux-androideabi") build, host = get_values("Darwin", "x86_64", "Macos", "x86") self.assertEquals(build, "x86_64-apple-darwin") self.assertEquals(host, "i686-apple-darwin") build, host = get_values("Darwin", "x86_64", "iOS", "armv7") self.assertEquals(build, "x86_64-apple-darwin") self.assertEquals(host, "arm-apple-darwin") build, host = get_values("Darwin", "x86_64", "watchOS", "armv7k") self.assertEquals(build, "x86_64-apple-darwin") self.assertEquals(host, "arm-apple-darwin") build, host = get_values("Darwin", "x86_64", "tvOS", "armv8") self.assertEquals(build, "x86_64-apple-darwin") self.assertEquals(host, "aarch64-apple-darwin") for os in ["Windows", "Linux"]: for arch in ["x86_64", "x86"]: triplet = tools.get_gnu_triplet(os, arch, "gcc") output = "" if arch == "x86_64": output += "x86_64" else: output += "i686" if os != "Linux" else "x86" output += "-" if os == "Windows": output += "w64-mingw32" else: output += "linux-gnu" self.assertIn(output, triplet) # Compiler not specified for os="Windows" with self.assertRaises(ConanException): tools.get_gnu_triplet("Windows", "x86")