From 3d674697c32bded19e08419c8dfd25bc428427dc Mon Sep 17 00:00:00 2001 From: Csaba Szigeti Date: Fri, 19 Nov 2021 15:27:20 +0100 Subject: [PATCH] qt/6.x.x - Adding cross build support (only tested for Windows so far) --- recipes/qt/6.x.x/conanfile.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/recipes/qt/6.x.x/conanfile.py b/recipes/qt/6.x.x/conanfile.py index c320b01f5f3ca..08c0209bec32b 100644 --- a/recipes/qt/6.x.x/conanfile.py +++ b/recipes/qt/6.x.x/conanfile.py @@ -616,6 +616,13 @@ def _configure_cmake(self): self._cmake.definitions["FEATURE_pkg_config"] = "ON" if self.settings.compiler == "gcc" and self.settings.build_type == "Debug" and not self.options.shared: self._cmake.definitions["BUILD_WITH_PCH"]= "OFF" # disabling PCH to save disk space + + if tools.cross_building(self): + qtHostPath = os.getenv("QT_HOST_PATH") + if qtHostPath: + self._cmake.definitions["QT_HOST_PATH"] = qtHostPath + else: + raise ConanInvalidConfiguration("In order to be able to cross-compile, you have to call `conan create` for the build machine (build architecture) first, and pass the path of that package to the cross-building `conan create` call using the `conan create` option : `--env QT_HOST_PATH=`") try: self._cmake.configure(source_folder="qt6") @@ -691,19 +698,11 @@ def package(self): if module != "qtbase" and not self.options.get_safe(module): tools.rmdir(os.path.join(self.package_folder, "licenses", module)) tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - for mask in ["Find*.cmake", "*Config.cmake", "*-config.cmake"]: - tools.remove_files_by_mask(self.package_folder, mask) tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.la*") tools.remove_files_by_mask(self.package_folder, "*.pdb*") tools.remove_files_by_mask(self.package_folder, "ensure_pro_file.cmake") os.remove(os.path.join(self.package_folder, "bin", "qt-cmake-private-install.cmake")) - for m in os.listdir(os.path.join(self.package_folder, "lib", "cmake")): - module = os.path.join(self.package_folder, "lib", "cmake", m, "%sMacros.cmake" % m) - helper_modules = glob.glob(os.path.join(self.package_folder, "lib", "cmake", m, "QtPublic*Helpers.cmake")) - if not os.path.isfile(module) and not helper_modules: - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake", m)) - extension = "" if self.settings.os == "Windows": extension = ".exe"