CXX-Qt-build: Goal for 0.8 #1125
Labels
🔨 build system
Issues related to integrating CXX-Qt into CMake/Cargo
🤔 discussion
Feedback welcome
🥳🎉 1.0
This issue is part of stabilization for 1.0 release
Problem Statement
Currently, our build system suffers from some issues.
Proposed solution
CXX actually solves this by explicitly leaving the build configuration to the respective build system in all languages.
For Cargo, CXX relies on the cc crate, for CMake it allows generating the files with
corossion_add_cxxbridge
.CMake then takes care of the actual building and linking.
We want to keep the advantage of our current build system approach, that deduplicates code between Cargo and CMake and allows implementing features like QML Modules for Qt5, but we also want to be prepared to give users more control when needed.
To achieve this, we aim to explicitly split the code generation and the build process itself.
The goal is that cxx_qt_build, like cxx_build just returns a pre-configured compiler, that the users are then free to do what they like with.
However, as Qt extends C++, it also extends the compiler capabilities.
To reflect that, we need to extend cc::Builder with our own QtBuilder (which we basically almost do).
The QtBuilder can then just be a direct wrapper of the cc::Builder, with additional features like
moc
,qrc
, etc.We also plan to move this QtBuilder fully into qt_build_utils, so that it is reusable outside CXX-Qt, and should only be Qt-specific, not CXX-Qt specific.
This cleaner split would also open the door to a tool like cxxbridge, that can just generate the cpp and header files, which could then be driven by CMake, while reusing the existing CMake build system functions.
Example
This is an example of what the new API might look like:
This makes the difference between generating the bridge files (cxx_qt_build::bridge) and configuring the build process itself (QtBuild) clearer and makes everything more reusable.
Open Questions
We're not yet entirely clear about how this all plays together with initializers that are passed between crates and the export to CMake.
Both of these things should ideally only happen once per crate, not per QtBuild instance, so it's unclear what exactly needs to be responsible for that.
Some ideas:
The text was updated successfully, but these errors were encountered: