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

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

Open
haata opened this issue Sep 4, 2023 · 3 comments
Labels
🔨 build system Issues related to integrating CXX-Qt into CMake/Cargo 🤔 discussion Feedback welcome ⬆️ feature New feature or request

Comments

@haata
Copy link
Contributor

haata commented Sep 4, 2023

For this snippet to pass the moc compiler I need to pass in a -IOpenRGB for it to work correctly.

  class OpenRGBPluginInterfaceWrapper : public QObject, public OpenRGBPluginInterface
  {
      Q_OBJECT
      Q_PLUGIN_METADATA(IID OpenRGBPluginInterface_IID)
      Q_INTERFACES(OpenRGBPluginInterface)
  public:
      OpenRGBPluginInterfaceWrapper(QObject* parent);
      ~OpenRGBPluginInterfaceWrapper();

Otherwise I'll get errors like:

: moc OpenRGBSamplePlugin.h         
OpenRGBSamplePlugin.h:23: Parse error at "IID"

and (commenting out Q_PLUGIN_METADATA).

OpenRGBSamplePlugin.h:24: Error: Undefined interface

This works:

moc -IOpenRGB OpenRGBSamplePlugin.h

I've looked through the code for cxx-qt-build and it's not clear if there is a way to do this.

@ahayzen-kdab
Copy link
Collaborator

Thank for you taking this time to point this out.

We don't support custom arguments for moc yet, this would likely need to go into qt-built-utils and then cxx-qt-build.

Assume these have to be passed to moc and can't be picked up from the C++ includes :-/

We should figure out what other custom arguments might need to be given to moc as well.

For now the workaround would be to do this in CMake or run moc manually if using a cargo build.

@ahayzen-kdab ahayzen-kdab added ⬆️ feature New feature or request 🤔 discussion Feedback welcome 🔨 build system Issues related to integrating CXX-Qt into CMake/Cargo labels Sep 4, 2023
@haata
Copy link
Contributor Author

haata commented Sep 4, 2023

I'm going to try and see if I can work around it with C++ includes.

I'm having some trouble getting my code to compile with 0.6 so it may be my best option for now.
I'll also post a POC PR to add -I to main.

@ahayzen-kdab
Copy link
Collaborator

As part of the build system refactor for #1065 etc we should consider this, cc @LeonMatthesKDAB

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔨 build system Issues related to integrating CXX-Qt into CMake/Cargo 🤔 discussion Feedback welcome ⬆️ feature New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants