QtInstallationQMake

Struct QtInstallationQMake 

Source
pub struct QtInstallationQMake { /* private fields */ }
Expand description

A implementation of QtInstallation using qmake

Implementations§

Source§

impl QtInstallationQMake

Source

pub fn new() -> Result<Self>

The directories specified by the PATH environment variable are where qmake is searched for. Alternatively, the QMAKE environment variable may be set to specify an explicit path to qmake.

If multiple major versions (for example, 5 and 6) of Qt could be installed, set the QT_VERSION_MAJOR environment variable to force which one to use. When using Cargo as the build system for the whole build, prefer using QT_VERSION_MAJOR over the QMAKE environment variable because it will account for different names for the qmake executable that some Linux distributions use.

However, when building a Rust staticlib that gets linked to C++ code by a C++ build system, it is best to use the QMAKE environment variable to ensure that the Rust staticlib is linked to the same installation of Qt that the C++ build system has detected. With CMake, this will automatically be set up for you when using cxxqt_import_crate.

Alternatively, you can get this from the Qt::qmake target’s IMPORTED_LOCATION property, for example:

find_package(Qt6 COMPONENTS Core)
if(NOT Qt6_FOUND)
    find_package(Qt5 5.15 COMPONENTS Core REQUIRED)
endif()
get_target_property(QMAKE Qt::qmake IMPORTED_LOCATION)

execute_process(
    COMMAND cmake -E env
        "CARGO_TARGET_DIR=${CMAKE_CURRENT_BINARY_DIR}/cargo"
        "QMAKE=${QMAKE}"
        cargo build
    WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)

Trait Implementations§

Source§

impl QtInstallation for QtInstallationQMake

Source§

fn framework_paths(&self, _qt_modules: &[String]) -> Vec<PathBuf>

Return the framework paths for Qt Read more
Source§

fn include_paths(&self, qt_modules: &[String]) -> Vec<PathBuf>

Return the include paths for Qt, including Qt module subdirectories. Read more
Configure the given cc::Build and cargo to link to the given Qt modules
Source§

fn try_find_tool(&self, tool: QtTool) -> Result<PathBuf>

Find the path to a given Qt tool for the Qt installation
Source§

fn version(&self) -> Version

Version of the detected Qt installation
Source§

impl TryFrom<PathBuf> for QtInstallationQMake

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(qmake_path: PathBuf) -> Result<Self>

Performs the conversion.

Auto Trait Implementations§

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.