@@ -61,11 +61,15 @@ impl InstalledBackend {
6161 clippy:: struct_excessive_bools,
6262 reason = "cmdline args have many bools"
6363) ]
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 ) ) ]
6566#[ non_exhaustive]
6667pub struct Install {
6768 /// 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+ ) ]
6973 #[ serde( alias = "package" ) ]
7074 pub shader_crate : PathBuf ,
7175
@@ -75,30 +79,30 @@ pub struct Install {
7579 ) ]
7680 /// Source of `spirv-builder` dependency
7781 /// Eg: "https://github.com/Rust-GPU/rust-gpu"
78- #[ clap( long) ]
82+ #[ cfg_attr ( feature = " clap" , clap ( long) ) ]
7983 pub spirv_builder_source : Option < String > ,
8084
8185 /// Version of `spirv-builder` dependency.
8286 /// * If `--spirv-builder-source` is not set, then this is assumed to be a crates.io semantic
8387 /// version such as "0.9.0".
8488 /// * If `--spirv-builder-source` is set, then this is assumed to be a Git "commitsh", such
8589 /// 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) ) ]
8791 pub spirv_builder_version : Option < String > ,
8892
8993 /// Force `rustc_codegen_spirv` to be rebuilt.
90- #[ clap( long) ]
94+ #[ cfg_attr ( feature = " clap" , clap ( long) ) ]
9195 pub rebuild_codegen : bool ,
9296
9397 /// Assume "yes" to "Install Rust toolchain: [y/n]" prompt.
9498 ///
9599 /// Defaults to `false` in cli, `true` in [`Default`]
96- #[ clap( long, action) ]
100+ #[ cfg_attr ( feature = " clap" , clap ( long, action) ) ]
97101 pub auto_install_rust_toolchain : bool ,
98102
99103 /// Clear target dir of `rustc_codegen_spirv` build after a successful build, saves about
100104 /// 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 ) ) ]
102106 pub clear_target : bool ,
103107
104108 /// There is a tricky situation where a shader crate that depends on workspace config can have
@@ -122,7 +126,7 @@ pub struct Install {
122126 /// way source URLs are encoded. See these PRs for more details:
123127 /// * <https://github.com/rust-lang/cargo/pull/12280>
124128 /// * <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) ) ]
126130 pub force_overwrite_lockfiles_v4_to_v3 : bool ,
127131}
128132
0 commit comments