Skip to content

Commit

Permalink
fixes for cross compiling
Browse files Browse the repository at this point in the history
  • Loading branch information
sabelka committed Feb 2, 2023
1 parent 22af0ef commit 53e21a8
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions recipes/qt/6.x.x/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import os
import textwrap

from conan import ConanFile
from conan import ConanFile, conan_version
from conan.tools.apple import is_apple_os
from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout
from conan.tools.build import cross_building, check_min_cppstd, build_jobs, default_cppstd
Expand Down Expand Up @@ -158,6 +158,11 @@ class QtConan(ConanFile):

_submodules_tree = None

@property
def _settings_build(self):
return getattr(self, "settings_build", self.settings)


@property
def _get_module_tree(self):
if self._submodules_tree:
Expand Down Expand Up @@ -353,8 +358,8 @@ def validate(self):
if self.options.get_safe("qtwayland", False) and not self.dependencies.direct_host["xkbcommon"].options.with_wayland:
raise ConanInvalidConfiguration("The 'with_wayland' option for the 'xkbcommon' package must be enabled when the 'qtwayland' option is enabled")

if cross_building(self):
raise ConanInvalidConfiguration("cross compiling qt 6 is not yet supported. Contributions are welcome")
if cross_building(self) and Version(conan_version) <"1.58.0":
raise ConanInvalidConfiguration("for cross compiling qt 6 conan version 1.58 or later is required")

def layout(self):
cmake_layout(self, src_folder="src")
Expand Down Expand Up @@ -436,14 +441,14 @@ def build_requirements(self):
self.tool_requires("cmake/3.25.0")
self.tool_requires("ninja/1.11.1")
self.tool_requires("pkgconf/1.9.3")
if self.settings.os == "Windows":
if self._settings_build.os == "Windows":
self.tool_requires('strawberryperl/5.32.1.1')

if self.options.get_safe("qtwebengine"):
self.tool_requires("nodejs/16.3.0")
self.tool_requires("gperf/3.1")
# gperf, bison, flex, python >= 2.7.5 & < 3
if self.settings.os != "Windows":
if self._settings_build.os != "Windows":
self.tool_requires("bison/3.8.2")
self.tool_requires("flex/2.6.4")
else:
Expand Down Expand Up @@ -605,7 +610,7 @@ def generate(self):
if self.settings.compiler == "gcc" and self.settings.build_type == "Debug" and not self.options.shared:
tc.variables["BUILD_WITH_PCH"]= "OFF" # disabling PCH to save disk space

if self.settings.os == "Windows":
if self._settings_build.os == "Windows":
tc.variables["HOST_PERL"] = getattr(self, "user_info_build", self.deps_user_info)["strawberryperl"].perl
#"set(QT_EXTRA_INCLUDEPATHS ${CONAN_INCLUDE_DIRS})\n"
#"set(QT_EXTRA_DEFINES ${CONAN_DEFINES})\n"
Expand All @@ -625,7 +630,7 @@ def generate(self):

def source(self):
destination = self.source_folder
if self.settings.os == "Windows":
if self._settings_build.os == "Windows":
# Don't use os.path.join, or it removes the \\?\ prefix, which enables long paths
destination = f"\\\\?\\{self.source_folder}"
get(self, **self.conan_data["sources"][self.version],
Expand Down

0 comments on commit 53e21a8

Please sign in to comment.