mirror of
https://github.com/slint-ui/slint.git
synced 2025-10-03 15:14:35 +00:00
Rename embed-resources parameters fro the Slint compiler
This commit is contained in:
parent
bad588e1e4
commit
c5ecade881
3 changed files with 17 additions and 18 deletions
|
@ -2,10 +2,10 @@
|
||||||
# SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial
|
# SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial
|
||||||
|
|
||||||
# Set up machinery to handle SLINT_EMBED_RESOURCES target property
|
# Set up machinery to handle SLINT_EMBED_RESOURCES target property
|
||||||
set(DEFAULT_SLINT_EMBED_RESOURCES as-paths CACHE STRING
|
set(DEFAULT_SLINT_EMBED_RESOURCES as-absolute-path CACHE STRING
|
||||||
"The default resource embedding option to pass to the Slint compiler")
|
"The default resource embedding option to pass to the Slint compiler")
|
||||||
set_property(CACHE DEFAULT_SLINT_EMBED_RESOURCES PROPERTY STRINGS
|
set_property(CACHE DEFAULT_SLINT_EMBED_RESOURCES PROPERTY STRINGS
|
||||||
"as-paths" "as-contents" "as-textures")
|
"as-absolute-path" "embed-files" "embed-for-software-renderer")
|
||||||
define_property(TARGET PROPERTY SLINT_EMBED_RESOURCES
|
define_property(TARGET PROPERTY SLINT_EMBED_RESOURCES
|
||||||
INITIALIZE_FROM_VARIABLE DEFAULT_SLINT_EMBED_RESOURCES)
|
INITIALIZE_FROM_VARIABLE DEFAULT_SLINT_EMBED_RESOURCES)
|
||||||
|
|
||||||
|
|
|
@ -68,18 +68,18 @@ CMake project, install it into a prefix directory of your choice and use `find_p
|
||||||
### Resource Embedding
|
### Resource Embedding
|
||||||
|
|
||||||
You may change the default resource embedding the Slint compiler will use via
|
You may change the default resource embedding the Slint compiler will use via
|
||||||
the `SLINT_EMBED_RESOURCES` target property, which accepts `as-paths`,
|
the `SLINT_EMBED_RESOURCES` target property, which accepts `as-absolute-path`,
|
||||||
`as-contents` and `as-textures`. The latter optimizes for the Slint
|
`embed-files` and `embed-for-software-renderer`. The latter optimizes for the
|
||||||
software-renderer and falls back to `as-contents` if that isn't used.
|
Slint software-renderer and falls back to `embed-files` if that isn't used.
|
||||||
|
|
||||||
Typically you will want to effect resource embedding for all targets in a
|
Typically you will want to effect resource embedding for all targets in a
|
||||||
CMake project. This is done with the `DEFAULT_SLINT_EMBED_RESOURCES` option,
|
CMake project. This is done with the `DEFAULT_SLINT_EMBED_RESOURCES` option,
|
||||||
which initializes the `SLINT_EMBED_RESOURCES` target property.
|
which initializes the `SLINT_EMBED_RESOURCES` target property.
|
||||||
|
|
||||||
Typically you will want to set `DEFAULT_SLINT_EMBED_RESOURCES` to `as-paths`
|
Typically you will want to set `DEFAULT_SLINT_EMBED_RESOURCES` to
|
||||||
for debug builds as this reduces build times. When doing a release, you will
|
`as-absolute-path` for debug builds as this reduces build times. When doing a
|
||||||
want to switch to `as-contents` to create self-contained binary that will work
|
release, you will want to switch to `embed-files` to create self-contained
|
||||||
on all systems.
|
binary that will work on all systems.
|
||||||
|
|
||||||
### Features
|
### Features
|
||||||
|
|
||||||
|
|
|
@ -9,16 +9,15 @@ use std::io::Write;
|
||||||
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, ValueEnum)]
|
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, ValueEnum)]
|
||||||
enum Embedding {
|
enum Embedding {
|
||||||
/// Embed resources using absolute paths on the build system (alias: false)
|
/// Embed resources using absolute paths on the build system (alias: false)
|
||||||
#[value(alias = "false", name = "as-paths")]
|
#[value(alias = "false")]
|
||||||
AsAbsolutePath,
|
AsAbsolutePath,
|
||||||
/// Embed contents of resource files (alias: true)
|
/// Embed contents of resource files (alias: true)
|
||||||
#[value(alias = "true", name = "as-contents")]
|
#[value(alias = "true")]
|
||||||
AsFiles,
|
EmbedFiles,
|
||||||
/// Embed in a format optimized for the software renderer. This
|
/// Embed in a format optimized for the software renderer. This
|
||||||
/// option falls back to as-contents when the software-renderer is not
|
/// option falls back to `embed-files` if the software-renderer is not
|
||||||
/// used
|
/// used
|
||||||
#[value(name = "as-textures")]
|
EmbedForSoftwareRenderer,
|
||||||
SoftwareRenderer,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Parser)]
|
#[derive(Parser)]
|
||||||
|
@ -69,11 +68,11 @@ fn main() -> std::io::Result<()> {
|
||||||
if let Some(embed) = args.embed_resources {
|
if let Some(embed) = args.embed_resources {
|
||||||
compiler_config.embed_resources = match embed {
|
compiler_config.embed_resources = match embed {
|
||||||
Embedding::AsAbsolutePath => EmbedResourcesKind::OnlyBuiltinResources,
|
Embedding::AsAbsolutePath => EmbedResourcesKind::OnlyBuiltinResources,
|
||||||
Embedding::AsFiles => EmbedResourcesKind::EmbedAllResources,
|
Embedding::EmbedFiles => EmbedResourcesKind::EmbedAllResources,
|
||||||
#[cfg(feature = "software-renderer")]
|
#[cfg(feature = "software-renderer")]
|
||||||
Embedding::SoftwareRenderer => EmbedResourcesKind::EmbedTextures,
|
Embedding::EmbedForSoftwareRenderer => EmbedResourcesKind::EmbedTextures,
|
||||||
#[cfg(not(feature = "software-renderer"))]
|
#[cfg(not(feature = "software-renderer"))]
|
||||||
Embedding::SoftwareRenderer => EmbedResourcesKind::EmbedAllResources,
|
Embedding::EmbedForSoftwareRenderer => EmbedResourcesKind::EmbedAllResources,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue