@@ -61,11 +61,15 @@ impl InstalledBackend {
61
61
clippy:: struct_excessive_bools,
62
62
reason = "cmdline args have many bools"
63
63
) ]
64
- #[ derive( clap:: Parser , Debug , Clone , serde:: Deserialize , serde:: Serialize ) ]
64
+ #[ derive( Debug , Clone , serde:: Deserialize , serde:: Serialize ) ]
65
+ #[ cfg_attr( feature = "clap" , derive( clap:: Parser ) ) ]
65
66
#[ non_exhaustive]
66
67
pub struct Install {
67
68
/// Directory containing the shader crate to compile.
68
- #[ clap( long, alias( "package" ) , short_alias( 'p' ) , default_value = "./" ) ]
69
+ #[ cfg_attr(
70
+ feature = "clap" ,
71
+ clap( long, alias( "package" ) , short_alias( 'p' ) , default_value = "./" )
72
+ ) ]
69
73
#[ serde( alias = "package" ) ]
70
74
pub shader_crate : PathBuf ,
71
75
@@ -75,30 +79,30 @@ pub struct Install {
75
79
) ]
76
80
/// Source of `spirv-builder` dependency
77
81
/// Eg: "https://github.com/Rust-GPU/rust-gpu"
78
- #[ clap( long) ]
82
+ #[ cfg_attr ( feature = " clap" , clap ( long) ) ]
79
83
pub spirv_builder_source : Option < String > ,
80
84
81
85
/// Version of `spirv-builder` dependency.
82
86
/// * If `--spirv-builder-source` is not set, then this is assumed to be a crates.io semantic
83
87
/// version such as "0.9.0".
84
88
/// * If `--spirv-builder-source` is set, then this is assumed to be a Git "commitsh", such
85
89
/// as a Git commit hash or a Git tag, therefore anything that `git checkout` can resolve.
86
- #[ clap( long, verbatim_doc_comment) ]
90
+ #[ cfg_attr ( feature = " clap" , clap ( long, verbatim_doc_comment) ) ]
87
91
pub spirv_builder_version : Option < String > ,
88
92
89
93
/// Force `rustc_codegen_spirv` to be rebuilt.
90
- #[ clap( long) ]
94
+ #[ cfg_attr ( feature = " clap" , clap ( long) ) ]
91
95
pub rebuild_codegen : bool ,
92
96
93
97
/// Assume "yes" to "Install Rust toolchain: [y/n]" prompt.
94
98
///
95
99
/// Defaults to `false` in cli, `true` in [`Default`]
96
- #[ clap( long, action) ]
100
+ #[ cfg_attr ( feature = " clap" , clap ( long, action) ) ]
97
101
pub auto_install_rust_toolchain : bool ,
98
102
99
103
/// Clear target dir of `rustc_codegen_spirv` build after a successful build, saves about
100
104
/// 200MiB of disk space.
101
- #[ clap( long = "no-clear-target" , default_value = "true" , action = clap:: ArgAction :: SetFalse ) ]
105
+ #[ cfg_attr ( feature = " clap" , clap ( long = "no-clear-target" , default_value = "true" , action = clap:: ArgAction :: SetFalse ) ) ]
102
106
pub clear_target : bool ,
103
107
104
108
/// There is a tricky situation where a shader crate that depends on workspace config can have
@@ -122,7 +126,7 @@ pub struct Install {
122
126
/// way source URLs are encoded. See these PRs for more details:
123
127
/// * <https://github.com/rust-lang/cargo/pull/12280>
124
128
/// * <https://github.com/rust-lang/cargo/pull/14595>
125
- #[ clap( long, action, verbatim_doc_comment) ]
129
+ #[ cfg_attr ( feature = " clap" , clap ( long, action, verbatim_doc_comment) ) ]
126
130
pub force_overwrite_lockfiles_v4_to_v3 : bool ,
127
131
}
128
132
0 commit comments