Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add SLINT_TARGET_CARGO_FLAGS cmake variable #3095

Merged
merged 2 commits into from Jul 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Expand Up @@ -3,6 +3,10 @@ All notable changes to this project are documented in this file.

## Unreleased

### C++

- Added `SLINT_TARGET_CARGO_FLAGS` cmake variable

## [1.1.1] - 2023-07-10

### General
Expand Down
7 changes: 7 additions & 0 deletions api/cpp/CMakeLists.txt
Expand Up @@ -27,6 +27,13 @@ endif()
corrosion_import_crate(MANIFEST_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../../Cargo.toml"
CRATES slint-cpp ${slint_compiler_crate})

set(SLINT_TARGET_CARGO_FLAGS "" CACHE STRING
"Flags to pass to cargo when building the Slint runtime library")
if(SLINT_TARGET_CARGO_FLAGS)
corrosion_set_cargo_flags(slint-cpp ${SLINT_TARGET_CARGO_FLAGS})
endif()


# When doing "make install" package builds, set install_name to rpath, so that the installed
# binaries don't have a load-command pointing back to their build directory.
# Don't do this when Slint is used via FetchContent. While we could set CMAKE_BUILD_RPATH to
Expand Down
6 changes: 6 additions & 0 deletions api/cpp/docs/cmake.md
Expand Up @@ -100,6 +100,12 @@ to discover and toggle features.
This works when compiling Slint as a package, using `cmake --build` and
`cmake --install`, or when including Slint using `FetchContent`.

### Rust Flags

Slint uses [Corrosion](https://github.com/corrosion-rs/corrosion) to build Slint, which is developed in Rust. You can utilize [Corrosion's global CMake variables](https://corrosion-rs.github.io/corrosion/usage.html#global-corrosion-options) to control certain aspects of the Rust build process.

Furthermore, you can set the `SLINT_TARGET_CARGO_FLAGS` cache variable to specify additional flags for the Slint runtime during the build.

### Back-Ends

Slint needs a back-end that acts as liaison between Slint and the OS. Several
Expand Down