build: Build resources with meson instead of build.rs
Allows us to get rid of build.rs, which was only used to compile resources. static_resource.rs is now created by meson, and the meson path is used for include_bytes!. Closes https://gitlab.gnome.org/World/podcasts/issues/55
This commit is contained in:
committed by
Jordan Petridis
parent
395e31ff85
commit
5b2edc73ec
@@ -15,12 +15,29 @@ run_command(
|
||||
check: true
|
||||
)
|
||||
|
||||
# include_bytes! only takes a string literal
|
||||
resource_conf = configuration_data()
|
||||
resource_conf.set_quoted('RESOURCEFILE', podcasts_resources.full_path())
|
||||
resource_rs = configure_file(
|
||||
input: 'static_resource.rs.in',
|
||||
output: 'static_resource.rs',
|
||||
configuration: resource_conf
|
||||
)
|
||||
|
||||
run_command(
|
||||
'cp',
|
||||
resource_rs,
|
||||
meson.current_source_dir(),
|
||||
check: true
|
||||
)
|
||||
|
||||
cargo_release = custom_target('cargo-build',
|
||||
build_always_stale: true,
|
||||
output: ['gnome-podcasts'],
|
||||
install: true,
|
||||
install_dir: podcasts_bindir,
|
||||
console: true,
|
||||
depends: podcasts_resources,
|
||||
command: [cargo_script,
|
||||
'@SOURCE_ROOT@',
|
||||
'@OUTPUT@',
|
||||
|
||||
@@ -23,7 +23,7 @@ use glib::Bytes;
|
||||
pub(crate) fn init() -> Result<(), Error> {
|
||||
// load the gresource binary at build time and include/link it into the final
|
||||
// binary.
|
||||
let res_bytes = include_bytes!("../resources/resources.gresource");
|
||||
let res_bytes = include_bytes!(@RESOURCEFILE@);
|
||||
|
||||
// Create Resource it will live as long the value lives.
|
||||
let gbytes = Bytes::from_static(res_bytes.as_ref());
|
||||
Reference in New Issue
Block a user