feat: support desktop
This commit is contained in:
1 parent
bb69a04045
commit
d695777402
4 files changed
+110
-80
No files matched your search
+24
-1
@@ -1,5 +1,5 @@
|
||||
use crate::{cfg::ConfigOptsServe, gen_page, server, CrateConfig};
|
||||
use std::{io::Write, path::PathBuf};
|
||||
use std::{io::Write, path::PathBuf, process::Command};
|
||||
use structopt::StructOpt;
|
||||
|
||||
/// Run the WASM project on dev-server
|
||||
@@ -21,6 +21,29 @@ impl Serve {
|
||||
crate_config.as_example(self.serve.example.unwrap());
|
||||
}
|
||||
|
||||
if self.serve.platform.is_some() {
|
||||
if self.serve.platform.unwrap().to_uppercase() == "DESKTOP" {
|
||||
crate::builder::build_desktop(&crate_config)?;
|
||||
|
||||
match &crate_config.executable {
|
||||
crate::ExecutableType::Binary(name)
|
||||
| crate::ExecutableType::Lib(name)
|
||||
| crate::ExecutableType::Example(name) => {
|
||||
let mut file = crate_config.out_dir.join(name);
|
||||
if cfg!(windows) {
|
||||
file.set_extension("exe");
|
||||
}
|
||||
Command::new(format!(
|
||||
"{}",
|
||||
crate_config.out_dir.join(file).to_str().unwrap()
|
||||
))
|
||||
.output()?;
|
||||
}
|
||||
}
|
||||
return Ok(());
|
||||
}
|
||||
}
|
||||
|
||||
crate::builder::build(&crate_config).expect("build failed");
|
||||
|
||||
// generate dev-index page
|
||||
|
||||
Reference in new issue
Block a user