Skip to content
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

fixes for linking with qtwebengine and qtpdf in qt/6.4.x #15472

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 31 additions & 3 deletions recipes/qt/6.x.x/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,8 +283,12 @@ def validate(self):

if not (self.options.gui and self.options.qtdeclarative and self.options.qtwebchannel):
raise ConanInvalidConfiguration("option qt:qtwebengine requires also qt:gui, qt:qtdeclarative and qt:qtwebchannel")
if not self.options.with_dbus and self.settings.os == "Linux":
raise ConanInvalidConfiguration("option qt:webengine requires also qt:with_dbus on Linux")
if self.settings.os == "Linux":
if not self.options.with_dbus:
raise ConanInvalidConfiguration("option qt:webengine requires also qt:with_dbus on Linux")
if not self.options.with_glib:
# it's not really needed, it's only for the pdf reader inside of chromium
raise ConanInvalidConfiguration("option qt:webengine requires also qt:with_glib on Linux")
Comment on lines +289 to +291
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if it's not actually required, please don't raise an exception. It will break some users which don't care about pdf reader.
Instead, you could either print a warning message, or add an option to the recipe for the pdf reader.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand.
At the moment, the qtpdf is automatically brought in when compiling the qtwebengine and I don't know how to explicitly disable it. Since it's automatically brought it, it does make it a required component in that sense, but if there was a away to disable qtpdf, then it would become optional.

Copy link
Contributor

@jwillikers jwillikers Feb 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My impression has been that qtpdf is really a portion of qtwebengine.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can see why you say that.
So just to confirm that I understand, the suggestion is that I expose the qtpdf module as a build option in conan add that extra check in the validatiion for glib?


if hasattr(self, "settings_build") and cross_building(self, skip_x64_x86=True):
raise ConanInvalidConfiguration("Cross compiling Qt WebEngine is not supported")
Expand Down Expand Up @@ -483,6 +487,22 @@ def generate(self):

tc = CMakeToolchain(self, generator="Ninja")

# work around #14884
if self.settings.os == "Linux" and self.options.get_safe("qtwebengine") and Version(self.version) >= "6.4.0":
lib_paths = []

# for the webengine core
for lib in {"dbus", "sqlite3", "opus", "fontconfig", "freetype",
"libpng", "bzip2", "brotli", "expat", "xkbcommon"}:
lib_paths.extend(self.deps_cpp_info[lib].lib_paths)
tc.variables["CONAN_PRIVATE_WEBENGINE_LIBRARY_DEPENDENCY_PATH"] = ";".join(lib_paths).replace("\\", "/")

# for the pdf reader
lib_paths = []
for lib in {"libffi", "glib", "bzip2", "pcre2"}:
lib_paths.extend(self.deps_cpp_info[lib].lib_paths)
tc.variables["CONAN_PRIVATE_WEBENGINE_PDF_LIBRARY_DEPENDENCY_PATH"] = ";".join(lib_paths).replace("\\", "/")

package_folder = self.package_folder.replace('\\', '/')
tc.variables["INSTALL_MKSPECSDIR"] = f"{package_folder}/res/archdatadir/mkspecs"
tc.variables["INSTALL_ARCHDATADIR"] = f"{package_folder}/res/archdatadir"
Expand Down Expand Up @@ -660,6 +680,14 @@ def source(self):
# use official variable name https://cmake.org/cmake/help/latest/module/FindFontconfig.html
replace_in_file(self, os.path.join(self.source_folder, "qtbase", "src", "gui", "configure.cmake"), "FONTCONFIG_FOUND", "Fontconfig_FOUND")

# work around #14884
if Version(self.version) >= "6.4.0":
content = "target_link_directories(WebEngineCore PRIVATE ${CONAN_PRIVATE_WEBENGINE_LIBRARY_DEPENDENCY_PATH})\n"
save(self, os.path.join(self.source_folder, "qtwebengine", "src", "core", "CMakeLists.txt"), content, append=True)

content = "target_link_directories(Pdf PRIVATE ${CONAN_PRIVATE_WEBENGINE_PDF_LIBRARY_DEPENDENCY_PATH})\n"
save(self, os.path.join(self.source_folder, "qtwebengine", "src", "pdf", "CMakeLists.txt"), content, append=True)

def _xplatform(self):
if self.settings.os == "Linux":
if self.settings.compiler == "gcc":
Expand Down Expand Up @@ -764,7 +792,7 @@ def _build_context(self):
# next lines force cmake package to be in PATH before the one provided by visual studio (vcvars)
build_env = tools.RunEnvironment(self).vars if is_msvc(self) else {}
build_env["MAKEFLAGS"] = "j%d" % build_jobs(self)
build_env["PKG_CONFIG_PATH"] = [self.build_folder]
build_env["PKG_CONFIG_PATH"] = [self.generators_folder, self.build_folder]
if self.settings.os == "Windows":
if "PATH" not in build_env:
build_env["PATH"] = []
Expand Down