@@ -10,18 +10,22 @@ use std::{env, path::Path, process::Command};
10
10
///
11
11
/// ```no_run
12
12
/// glib_build_tools::compile_resources(
13
- /// "resources",
13
+ /// &[ "resources"] ,
14
14
/// "resources/resources.gresource.xml",
15
15
/// "compiled.gresource",
16
16
/// );
17
17
/// ```
18
- pub fn compile_resources < P : AsRef < Path > > ( source_dir : P , gresource : & str , target : & str ) {
18
+ pub fn compile_resources < P : AsRef < Path > > ( source_dirs : & [ P ] , gresource : & str , target : & str ) {
19
19
let out_dir = env:: var ( "OUT_DIR" ) . unwrap ( ) ;
20
20
let out_dir = Path :: new ( & out_dir) ;
21
21
22
- let output = Command :: new ( "glib-compile-resources" )
23
- . arg ( "--sourcedir" )
24
- . arg ( source_dir. as_ref ( ) )
22
+ let mut command = Command :: new ( "glib-compile-resources" ) ;
23
+
24
+ for source_dir in source_dirs {
25
+ command. arg ( "--sourcedir" ) . arg ( source_dir. as_ref ( ) ) ;
26
+ }
27
+
28
+ let output = command
25
29
. arg ( "--target" )
26
30
. arg ( out_dir. join ( target) )
27
31
. arg ( gresource)
@@ -36,9 +40,13 @@ pub fn compile_resources<P: AsRef<Path>>(source_dir: P, gresource: &str, target:
36
40
) ;
37
41
38
42
println ! ( "cargo:rerun-if-changed={gresource}" ) ;
39
- let output = Command :: new ( "glib-compile-resources" )
40
- . arg ( "--sourcedir" )
41
- . arg ( source_dir. as_ref ( ) )
43
+ let mut command = Command :: new ( "glib-compile-resources" ) ;
44
+
45
+ for source_dir in source_dirs {
46
+ command. arg ( "--sourcedir" ) . arg ( source_dir. as_ref ( ) ) ;
47
+ }
48
+
49
+ let output = command
42
50
. arg ( "--generate-dependencies" )
43
51
. arg ( gresource)
44
52
. output ( )
0 commit comments