-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
qt/6.x.x - Adding cross build support (only tested for Windows so far) #8116
Closed
szigetics
wants to merge
1
commit into
conan-io:master
from
szigetics:qt/windows-cross-compilation-support
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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=<path/to/the/conan/package/built/for/the/build/machine/architecture>`") | ||
|
||
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) | ||
Comment on lines
-694
to
-695
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
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)) | ||
|
||
Comment on lines
-701
to
-706
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same as above |
||
extension = "" | ||
if self.settings.os == "Windows": | ||
extension = ".exe" | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ericLemanissier
I'm in no way a qt specialist.
I remember reading to cross build qt for android, you first need a native qt.
Would the following be needed instead? + setting the correct appropriate arguments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that's the way qt 6 handles cross compilation yes, but I don't think conan allows it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mean conan does not generate the required cmake modules for build requirements?
Is there missing something else?
Imho, this deserves to be added to conan.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the thing is that you usually want different options for the
build
qt (basically just the minimum) from thehost
qt.Edit: looks like I am wrong!