From 3bddc99ce355b336f699d637e45157e799935896 Mon Sep 17 00:00:00 2001 From: Wanja Zaeske Date: Mon, 18 Sep 2023 15:17:50 +0200 Subject: [PATCH] fix #1: allow injection of CMake flags --- flake.nix | 5 +++++ sel4-sys/build.rs | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/flake.nix b/flake.nix index d3744d7..92a7ca3 100644 --- a/flake.nix +++ b/flake.nix @@ -69,6 +69,9 @@ cargo = rust-toolchains.stable; rustc = rust-toolchains.stable; }); + + SEL4_RS_CMAKE_FLAGS = "-DCROSS_COMPILER_PREFIX=arm-none-eabihf-"; + in rec { @@ -186,6 +189,8 @@ pkgs.nixpkgs-fmt # formatting nix files pkgs.nodePackages.prettier # prettifier for MarkDown and YAML ]; + + inherit SEL4_RS_CMAKE_FLAGS; }; }; diff --git a/sel4-sys/build.rs b/sel4-sys/build.rs index 49e7bf1..d69edc7 100644 --- a/sel4-sys/build.rs +++ b/sel4-sys/build.rs @@ -147,6 +147,11 @@ fn cmake_config(config: SeL4Config, build_dir: impl AsRef) -> Result<()> { args.append(&mut config.get_cmake_args()); + // allows user overrides to the build script + if let Ok(flags) = std::env::var("SEL4_RS_CMAKE_FLAGS") { + args.push(flags); + } + let output = cmd("cmake", args).read()?; for line in output.lines() {