Skip to content

Commit

Permalink
Merge ykjit#678
Browse files Browse the repository at this point in the history
678: Add the ability to pass arbitrary arguments to ykllvm build. r=ltratt a=vext01



Co-authored-by: Edd Barrett <vext01@gmail.com>
  • Loading branch information
bors[bot] and vext01 authored May 11, 2023
2 parents 241348d + cd34d62 commit 6cd2dfe
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions ykbuild/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,22 @@ fn main() {
.build_arg(nprocs);

if let Ok(args) = env::var("YKB_YKLLVM_BUILD_ARGS") {
// Caveat: this assumes no cmake argument contains a ',' or a ':'.
for arg in args.split(",") {
if !arg.starts_with("-D") {
panic!("YKB_YKLLVM_BUILD_ARGS must only contain -D arguments");
match arg.split(":").collect::<Vec<_>>()[..] {
["define", kv] => {
let (k, v) = kv.split_once("=").unwrap();
ykllvm.define(k, v);
}
["build_arg", ba] => {
ykllvm.build_arg(ba);
}
["generator", g] => {
ykllvm.generator(g);
}
[k, _] => panic!("Unknown kind {k}"),
_ => panic!("Incorrectly formatted option {arg}"),
}
let (k, v) = arg.strip_prefix("-D").unwrap().split_once("=").unwrap();
ykllvm.define(k, v);
}
}

Expand Down

0 comments on commit 6cd2dfe

Please sign in to comment.