diff --git a/README.md b/README.md index e00f6d0..3d3b1b0 100644 --- a/README.md +++ b/README.md @@ -59,6 +59,10 @@ file as well. You can then add `objdiff.json` to your `.gitignore` to prevent it // objdiff.json { "custom_make": "ninja", + "custom_args": [ + "-C", + "build" + ], // Only required if objects use "path" instead of "target_path" and "base_path". "target_dir": "build/asm", diff --git a/objdiff-core/src/config/mod.rs b/objdiff-core/src/config/mod.rs index 35d90b0..9f0f54b 100644 --- a/objdiff-core/src/config/mod.rs +++ b/objdiff-core/src/config/mod.rs @@ -18,6 +18,8 @@ pub struct ProjectConfig { #[serde(default)] pub custom_make: Option, #[serde(default)] + pub custom_args: Option>, + #[serde(default)] pub target_dir: Option, #[serde(default)] pub base_dir: Option, diff --git a/objdiff-gui/src/app.rs b/objdiff-gui/src/app.rs index ff49dcb..bcd125c 100644 --- a/objdiff-gui/src/app.rs +++ b/objdiff-gui/src/app.rs @@ -84,6 +84,8 @@ pub struct AppConfig { #[serde(default)] pub custom_make: Option, #[serde(default)] + pub custom_args: Option>, + #[serde(default)] pub selected_wsl_distro: Option, #[serde(default)] pub project_dir: Option, @@ -131,6 +133,7 @@ impl Default for AppConfig { Self { version: AppConfigVersion::default().version, custom_make: None, + custom_args: None, selected_wsl_distro: None, project_dir: None, target_obj_dir: None, diff --git a/objdiff-gui/src/config.rs b/objdiff-gui/src/config.rs index d6c3ef4..6f866b3 100644 --- a/objdiff-gui/src/config.rs +++ b/objdiff-gui/src/config.rs @@ -71,6 +71,7 @@ pub fn load_project_config(config: &mut AppConfig) -> Result<()> { if let Some((result, info)) = try_project_config(project_dir) { let project_config = result?; config.custom_make = project_config.custom_make; + config.custom_args = project_config.custom_args; config.target_obj_dir = project_config.target_dir.map(|p| project_dir.join(p)); config.base_obj_dir = project_config.base_dir.map(|p| project_dir.join(p)); config.build_base = project_config.build_base; diff --git a/objdiff-gui/src/jobs/objdiff.rs b/objdiff-gui/src/jobs/objdiff.rs index 84edbac..88f7af1 100644 --- a/objdiff-gui/src/jobs/objdiff.rs +++ b/objdiff-gui/src/jobs/objdiff.rs @@ -39,6 +39,7 @@ impl Default for BuildStatus { pub struct BuildConfig { pub project_dir: Option, pub custom_make: Option, + pub custom_args: Option>, pub selected_wsl_distro: Option, } @@ -47,6 +48,7 @@ impl BuildConfig { Self { project_dir: config.project_dir.clone(), custom_make: config.custom_make.clone(), + custom_args: config.custom_args.clone(), selected_wsl_distro: config.selected_wsl_distro.clone(), } } @@ -96,10 +98,11 @@ pub(crate) fn run_make(config: &BuildConfig, arg: &Path) -> BuildStatus { fn run_make_cmd(config: &BuildConfig, cwd: &Path, arg: &Path) -> Result { let make = config.custom_make.as_deref().unwrap_or("make"); + let make_args = config.custom_args.as_deref().unwrap_or(&[]); #[cfg(not(windows))] let mut command = { let mut command = Command::new(make); - command.current_dir(cwd).arg(arg); + command.current_dir(cwd).args(make_args).arg(arg); command }; #[cfg(windows)] @@ -120,9 +123,10 @@ fn run_make_cmd(config: &BuildConfig, cwd: &Path, arg: &Path) -> Result