From 74e11db8b646fb4c02d94f35ff118ce3dfe4d961 Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Mallo Date: Mon, 28 Oct 2024 12:40:13 +0100 Subject: [PATCH] Only enable MPI in ovni on native builds MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Tested with: hut% nix build .#bsc-ci.all hut% nix build .#pkgsCross.riscv64.ovni Tested-by: Rodrigo Arias Mallo Reviewed-by: Aleix Boné --- pkgs/ovni/default.nix | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pkgs/ovni/default.nix b/pkgs/ovni/default.nix index 92e4e6b..90ae324 100644 --- a/pkgs/ovni/default.nix +++ b/pkgs/ovni/default.nix @@ -9,6 +9,8 @@ , gitUrl ? "ssh://git@bscpm03.bsc.es/rarias/ovni.git" , gitCommit ? "7a33deffb7aaae70527125d48428f22169c9d39e" , enableDebug ? false +# Only enable MPI if the build is native (fails on cross-compilation) +, useMpi ? (stdenv.buildPlatform.canExecute stdenv.hostPlatform) }: with lib; @@ -43,9 +45,12 @@ in postPatch = '' patchShebangs --build test/ ''; - nativeBuildInputs = [ cmake mpi ]; + nativeBuildInputs = [ cmake ]; + buildInputs = lib.optionals (useMpi) [ mpi ]; cmakeBuildType = if (enableDebug) then "Debug" else "Release"; - cmakeFlags = [ "-DOVNI_GIT_COMMIT=${src.shortRev}" ]; + cmakeFlags = [ + "-DOVNI_GIT_COMMIT=${src.shortRev}" + ] ++ lib.optionals (!useMpi) [ "-DUSE_MPI=OFF" ]; preCheck = '' export CTEST_OUTPUT_ON_FAILURE=1 '';