Custom output directory via build.target

This commit is contained in:
2026-02-23 13:51:53 +08:00
parent e0fd729635
commit cb8a3b2001
15 changed files with 91 additions and 31 deletions

View File

@@ -37,8 +37,11 @@ pub fn build(ctx: &BuildContext) -> Result<f64, String> {
for flag in ctx.ldflags {
cmd.arg(flag);
}
cmd.arg("-o")
.arg(platform::bin_path(ctx.profile, ctx.project_name));
cmd.arg("-o").arg(platform::bin_path(
ctx.profile,
ctx.project_name,
ctx.target_dir,
));
match cmd.status() {
Ok(status) if status.success() => {

View File

@@ -37,8 +37,11 @@ pub fn build(ctx: &BuildContext) -> Result<f64, String> {
for flag in ctx.ldflags {
cmd.arg(flag);
}
cmd.arg("-o")
.arg(platform::bin_path(ctx.profile, ctx.project_name));
cmd.arg("-o").arg(platform::bin_path(
ctx.profile,
ctx.project_name,
ctx.target_dir,
));
match cmd.status() {
Ok(status) if status.success() => {

View File

@@ -8,6 +8,7 @@ pub struct BuildContext<'a> {
pub compiler: &'a str,
pub language: &'a str,
pub standard: &'a str,
pub target_dir: Option<&'a str>,
pub include_dirs: &'a [String],
pub lib_dirs: &'a [String],
pub libs: &'a [String],

View File

@@ -63,7 +63,7 @@ pub fn build(ctx: &BuildContext) -> Result<f64, String> {
}
cmd.arg(format!(
"/Fe:{}",
platform::bin_path(ctx.profile, ctx.project_name)
platform::bin_path(ctx.profile, ctx.project_name, ctx.target_dir)
));
match cmd.status() {