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

Add qobject_header_include() to add support for moc -I<path> #680

Closed
wants to merge 1 commit into from

Conversation

haata
Copy link
Contributor

@haata haata commented Sep 4, 2023

POC, probably not the best way to do this, but it was the simplest.

- Needed when the moc compiler does not have all the necessary files
  present in the cwd.
@ahayzen-kdab
Copy link
Collaborator

Thanks!

This likely needs a bit of thought about the API (maybe moc can take a struct if we are going to add more args and then use default() like QmlModule does).

We also need to look into the use case of Q_INTERFACES and other macros as we haven't explored using that yet.

@@ -531,7 +531,8 @@ impl QtBuild {
/// as well as the path to the generated metatypes.json file, which can be passed to [register_qml_module](Self::register_qml_module).
///
/// * uri - Should be passed if the input_file is part of a QML module
pub fn moc(&mut self, input_file: impl AsRef<Path>, uri: Option<&str>) -> MocProducts {
/// * include_paths - Additional include paths to pass to moc
pub fn moc(&mut self, input_file: impl AsRef<Path>, uri: Option<&str>, include_paths: &Vec<PathBuf>) -> MocProducts {
Copy link
Collaborator

Choose a reason for hiding this comment

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

we should go through the other moc arguments while we are here and consider which others might be useful.

@LeonMatthesKDAB
Copy link
Collaborator

I agree with @ahayzen-kdab's that using a MOCArguments struct would be good.
This struct could just boil everything down to a Vec<String> , which is then passed to the moc.

That would also allow us to provide users an escape hatch to just add any string as an argument, so we don't have to support every moc argument type.

@LeonMatthesKDAB
Copy link
Collaborator

Superceded by #796

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.

How to specify -I (include paths) to moc compiler with CxxQtBuilder.qobject_header()?
3 participants