Skip to content

qt-build-utils: build system changes to have a QtInstallation #1230

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

Open
wants to merge 22 commits into
base: main
Choose a base branch
from

Conversation

ahayzen-kdab
Copy link
Collaborator

This is part of one of the steps towards #1125 and rewriting qt-build-utils.

Copy link

codecov bot commented Mar 14, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (5d3b2de) to head (79d8437).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #1230   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           73        73           
  Lines        12634     12634           
=========================================
  Hits         12634     12634           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ahayzen-kdab ahayzen-kdab force-pushed the 1125-build-system-changes-qtinstallation branch from 5f33455 to 8dcd7d5 Compare March 14, 2025 17:04
@ahayzen-kdab ahayzen-kdab force-pushed the 1125-build-system-changes-qtinstallation branch 6 times, most recently from 634fb0d to 1ad252a Compare April 22, 2025 15:10
@ahayzen-kdab ahayzen-kdab marked this pull request as ready for review April 22, 2025 15:10
@ahayzen-kdab ahayzen-kdab force-pushed the 1125-build-system-changes-qtinstallation branch from fefe5fc to 155f7a1 Compare April 22, 2025 17:13
@ahayzen-kdab ahayzen-kdab force-pushed the 1125-build-system-changes-qtinstallation branch from 155f7a1 to 86a7f22 Compare April 24, 2025 09:23
Comment on lines 25 to 37
/// TODO: should we hand in a cc::Build or should we instead return a struct
/// with details of the rustc-link-lib / search paths ? and then have the
/// calling function apply those and any flags to the cc::Build?
fn link_modules(&self, builder: &mut cc::Build, qt_modules: &[String]);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

what do we think is the best interface here? Do we pass in a cc::Build and a list of Qt modules and the QtInstallation sets up the builder? Or should we just ask the QtInstallation with a list of Qt modules and it responds with a struct listing all the possible rustc-link options and any flags etc for cc::Build ?

@ahayzen-kdab ahayzen-kdab force-pushed the 1125-build-system-changes-qtinstallation branch from 86a7f22 to cdaf205 Compare April 30, 2025 16:46
@ahayzen-kdab ahayzen-kdab force-pushed the 1125-build-system-changes-qtinstallation branch from 328cc00 to 01dc659 Compare May 1, 2025 14:09
format!(
"{}/{}Qt{}{}.prl",
lib_path, prefix, version_major, qt_module
)
}

/// Tell Cargo to link each Qt module.
pub fn cargo_link_libraries(&self, builder: &mut cc::Build) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

should probably rename to link_qt_modules or something

init_call: Some(format!("Q_INIT_RESOURCE({name});")),
init_declaration: Some(format!("#include <{init_header}>")),
}
pub fn qrc(&mut self, input_file: impl AsRef<Path>) -> Initializer {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

need to remove these old usages and push everything through rcc()

}

/// Run moc on a C++ header file and save the output into [cargo's OUT_DIR](https://doc.rust-lang.org/cargo/reference/environment-variables.html).
/// The return value contains the path to the generated C++ file, which can then be passed to [cc::Build::files](https://docs.rs/cc/latest/cc/struct.Build.html#method.file),
/// as well as the path to the generated metatypes.json file, which can be passed to [register_qml_module](Self::register_qml_module).
///
pub fn moc(&mut self, input_file: impl AsRef<Path>, arguments: MocArguments) -> MocProducts {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

need to just return QtToolMoc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant