pub struct QtBuild { /* private fields */ }Expand description
Helper for build.rs scripts using Qt
let qt_modules = vec!["Core", "Gui"]
.iter()
.map(|m| String::from(*m))
.collect();
let qtbuild = qt_build_utils::QtBuild::new(qt_modules).expect("Could not find Qt installation");Implementations§
Source§impl QtBuild
impl QtBuild
Sourcepub fn new(qt_modules: Vec<String>) -> Result<Self>
pub fn new(qt_modules: Vec<String>) -> Result<Self>
Create a QtBuild using the default QtInstallation (currently uses QtInstallationQMake)
and specify which Qt modules you are linking, ommitting the Qt prefix ("Core"
rather than "QtCore").
Currently this function is only available when the qmake feature is enabled.
Use Self::with_installation to create a QtBuild with a custom QtInstallation.
Sourcepub fn with_installation(
qt_installation: Box<dyn QtInstallation>,
qt_modules: Vec<String>,
) -> Self
pub fn with_installation( qt_installation: Box<dyn QtInstallation>, qt_modules: Vec<String>, ) -> Self
Create a QtBuild using the given QtInstallation and specify which
Qt modules you are linking, ommitting the Qt prefix ("Core" rather than "QtCore").
Sourcepub fn autorcc_options(
self,
options: impl IntoIterator<Item = impl AsRef<OsStr>>,
) -> Self
pub fn autorcc_options( self, options: impl IntoIterator<Item = impl AsRef<OsStr>>, ) -> Self
Add custom arguments to be passed to the end of the rcc invocation when converting qrc files.
Sourcepub fn cargo_link_libraries(&self, builder: &mut Build)
pub fn cargo_link_libraries(&self, builder: &mut Build)
Tell Cargo to link each Qt module.
Sourcepub fn framework_paths(&self) -> Vec<PathBuf>
pub fn framework_paths(&self) -> Vec<PathBuf>
Get the frmaework paths for Qt. This is intended to be passed to whichever tool you are using to invoke the C++ compiler.
Sourcepub fn include_paths(&self) -> Vec<PathBuf>
pub fn include_paths(&self) -> Vec<PathBuf>
Get the include paths for Qt, including Qt module subdirectories. This is intended to be passed to whichever tool you are using to invoke the C++ compiler.
Sourcepub fn register_qml_module(
&mut self,
metatypes_json: &[impl AsRef<Path>],
uri: &QmlUri,
version_major: usize,
version_minor: usize,
plugin_name: &str,
qml_files: &[QmlFile],
depends: impl IntoIterator<Item = impl Into<QmlUri>>,
plugin_type: PluginType,
) -> QmlModuleRegistrationFiles
pub fn register_qml_module( &mut self, metatypes_json: &[impl AsRef<Path>], uri: &QmlUri, version_major: usize, version_minor: usize, plugin_name: &str, qml_files: &[QmlFile], depends: impl IntoIterator<Item = impl Into<QmlUri>>, plugin_type: PluginType, ) -> QmlModuleRegistrationFiles
Generate C++ files to automatically register a QML module at build time using the JSON output from moc.
This generates a qmldir file for the QML module.
The qml_files and qrc_files are registered with the Qt Resource System in
the default QML import path qrc:/qt/qml/uri/of/module/.
When using Qt 6, this will run qmlcachegen to compile the specified .qml files ahead-of-time.
Sourcepub fn qmltyperegistrar(&self) -> QtToolQmlTypeRegistrar
pub fn qmltyperegistrar(&self) -> QtToolQmlTypeRegistrar
Create a QtToolQmlTypeRegistrar for this QtBuild