Only enable MPI in ovni on native builds

Tested with:

hut% nix build .#bsc-ci.all
hut% nix build .#pkgsCross.riscv64.ovni

Tested-by: Rodrigo Arias Mallo <rodrigo.arias@bsc.es>
Reviewed-by: Aleix Boné <aleix.boneribo@bsc.es>
This commit is contained in:
Rodrigo Arias 2024-10-28 12:40:13 +01:00
parent e046363e52
commit 74e11db8b6

View File

@ -9,6 +9,8 @@
, gitUrl ? "ssh://git@bscpm03.bsc.es/rarias/ovni.git" , gitUrl ? "ssh://git@bscpm03.bsc.es/rarias/ovni.git"
, gitCommit ? "7a33deffb7aaae70527125d48428f22169c9d39e" , gitCommit ? "7a33deffb7aaae70527125d48428f22169c9d39e"
, enableDebug ? false , enableDebug ? false
# Only enable MPI if the build is native (fails on cross-compilation)
, useMpi ? (stdenv.buildPlatform.canExecute stdenv.hostPlatform)
}: }:
with lib; with lib;
@ -43,9 +45,12 @@ in
postPatch = '' postPatch = ''
patchShebangs --build test/ patchShebangs --build test/
''; '';
nativeBuildInputs = [ cmake mpi ]; nativeBuildInputs = [ cmake ];
buildInputs = lib.optionals (useMpi) [ mpi ];
cmakeBuildType = if (enableDebug) then "Debug" else "Release"; 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 = '' preCheck = ''
export CTEST_OUTPUT_ON_FAILURE=1 export CTEST_OUTPUT_ON_FAILURE=1
''; '';