Skip to content

WIP: cxx-qt-build: use init method rather than WHOLE_ARCHIVE for CMake#964

Closed
ahayzen-kdab wants to merge 2 commits intoKDAB:mainfrom
ahayzen-kdab:963-use-init-methods
Closed

WIP: cxx-qt-build: use init method rather than WHOLE_ARCHIVE for CMake#964
ahayzen-kdab wants to merge 2 commits intoKDAB:mainfrom
ahayzen-kdab:963-use-init-methods

Conversation

@ahayzen-kdab
Copy link
Copy Markdown
Collaborator

No description provided.

@ahayzen-kdab ahayzen-kdab force-pushed the 963-use-init-methods branch 8 times, most recently from 712d09a to 7b515c0 Compare May 24, 2024 16:18
int
main(int argc, char* argv[])
{
cxx_qt::init();
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

we need to document this in the book and changelog

// https://doc.qt.io/qt-6/qtresource-qtcore-proxy.html#Q_INIT_RESOURCE
let qrc_name = file_stem.replace('-', "_");
// Note this cannot be inside a namespace
format!(" Q_INIT_RESOURCE({qrc_name};")
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

need to check this works with qrc files as we don't have any in our tests?

}

// Generate init method
cc_builder_whole_archive.file(self.write_init_method());
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

appears we still need the +whole-archive internally though? Unless is there a way of removing this too 🤔

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

it might only be Cargo builds that now need it? As seems they can't tell that the extern's from Rust are linking through to the init method.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I think so, but this also means we don't need the init method at all in our cargo-only builds, right?
Initialization can just work "as-is" in that case, as we don't have a problem there iirc.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Yes it means we don't need the init currently in Cargo, although it'd be nice to remove this whole-archive and have the linker figure things out.

However i wonder if we still document that you should use it, as later it gives us a place to register/setup anything globally. Eg what if we wanted to setup Qt logging or something?

@ahayzen-kdab ahayzen-kdab force-pushed the 963-use-init-methods branch from 7b515c0 to f6a5730 Compare May 24, 2024 16:37
This reverts commit 40f5ad1.

We have changed to using an init method rather than
whole-archive which fixes Windows CI.
@ahayzen-kdab
Copy link
Copy Markdown
Collaborator Author

The build system has changed instead as described in #983

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.

2 participants