Skip to content

Commit

Permalink
book: Add missing docs for QT_MODULES argument
Browse files Browse the repository at this point in the history
  • Loading branch information
LeonMatthesKDAB authored and ahayzen-kdab committed Oct 30, 2024
1 parent 3111cfd commit fe12cfe
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ cxx-qt-lib = { path = "crates/cxx-qt-lib", version = "0.6.1" }
qt-build-utils = { path = "crates/qt-build-utils", version = "0.6.1" }
cxx-qt-lib-extras = { path = "crates/cxx-qt-lib-extras", version = "0.6.1" }

cc = { version = "1.0.89", features = ["parallel"] }
cc = { version = "1.0.100", features = ["parallel"] }
# Ensure that the example comments are kept in sync
# ./examples/cargo_without_cmake/Cargo.toml
# ./examples/qml_minimal/rust/Cargo.toml
Expand Down
7 changes: 4 additions & 3 deletions book/src/getting-started/5-cmake-integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,11 @@ Download CXX-Qts CMake code with FetchContent:

This provides you with a few wrappers around [Corrosion](https://github.com/corrosion-rs/corrosion), a tool for integrating Rust libraries into CMake:

1. `cxx_qt_import_crate` - A wrapper around [corrosion_import_crate](https://corrosion-rs.github.io/corrosion/usage.html). It supports the same arguments as corrosion_import_crate, with two new optional arguments:
- `CXX_QT_EXPORT_DIR` - Manually specify the path where CXX-Qt artifacts will be exported to.
1. `cxx_qt_import_crate` - A wrapper around [corrosion_import_crate](https://corrosion-rs.github.io/corrosion/usage.html). It supports the same arguments as corrosion_import_crate, with three new arguments:
- `QT_MODULES` *(required)* - The Qt modules to link to. Specify the corresponding CMake targets here.
- `CXX_QT_EXPORT_DIR` (optional) - Manually specify the path where CXX-Qt artifacts will be exported to.
- This is usually not necessary. However, if you're importing the same crate with different feature sets in the same CMake build configuration, you will need to specify seperate `CXX_QT_EXPORT_DIR`s to avoid multiple versions of the crate exporting to the same directory.
- `QMAKE` - Override the path to the QMAKE executable
- `QMAKE` (optional) - Override the path to the QMAKE executable
2. `cxx_qt_import_qml_module` - This function imports a QML modules as a new target. It requires the following arguments:
- `TARGET_NAME` - Specify the name of the CMake target that this function will create
- `URI` - The URI of the qml module to import - this needs to exactly match the URI in the `CxxQtBuilder::qml_module` call in your build script.
Expand Down
6 changes: 4 additions & 2 deletions examples/qml_minimal/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,10 @@ endif()

# ANCHOR: book_cmake_use_cxx_qt
# CXX-Qt (using Corrosion) creates a CMake target with the same name as the crate.
cxx_qt_import_crate(MANIFEST_PATH rust/Cargo.toml CRATES qml_minimal QT_MODULES Qt::Core Qt::Gui Qt::Qml Qt::QuickControls2)
target_link_libraries(qml_minimal INTERFACE Qt::Core)
cxx_qt_import_crate(
MANIFEST_PATH rust/Cargo.toml
CRATES qml_minimal
QT_MODULES Qt::Core Qt::Gui Qt::Qml Qt::QuickControls2)

cxx_qt_import_qml_module(qml_minimal_qml_module
URI "com.kdab.cxx_qt.demo"
Expand Down

0 comments on commit fe12cfe

Please sign in to comment.