Allow builds without MPI with -DUSE_MPI=OFF

This commit is contained in:
Rodrigo Arias 2023-04-14 13:14:52 +02:00 committed by Rodrigo Arias Mallo
parent 6eead7e28e
commit 171e439bd4
3 changed files with 27 additions and 9 deletions

View File

@ -21,6 +21,13 @@ build:rt-tests:
script:
- nix build -L --tarball-ttl 0 --file nix/rt.nix bsc.ovni-rt
build:no-mpi:
stage: build
tags:
- nix
script:
- nix build -L --tarball-ttl 0 --file nix/rt.nix bsc.ovni-nompi
build:old-gcc:
stage: build
tags:

View File

@ -155,6 +155,12 @@ let
export NODES_HOME="${last.nodes}"
'';
});
ovni-nompi = last.ovni.overrideAttrs (old: {
buildInputs = pkgs.lib.filter (x: x != last.mpi ) old.buildInputs;
cmakeFlags = old.cmakeFlags ++ [ "-DUSE_MPI=OFF" ];
});
});
in

View File

@ -66,14 +66,19 @@ target_link_libraries(ovnidump emu parson-static ovni-static)
add_executable(ovnisort ovnisort.c)
target_link_libraries(ovnisort emu parson-static ovni-static)
# Use <PackageName>_ROOT variables if available, commonly used by MPI
# installations
if(POLICY CMP0074)
cmake_policy(SET CMP0074 NEW)
set(USE_MPI ON CACHE BOOL "Use MPI (required by ovnisync)")
if(USE_MPI)
# Use <PackageName>_ROOT variables if available, commonly used by MPI
# installations
if(POLICY CMP0074)
cmake_policy(SET CMP0074 NEW)
endif()
find_package(MPI REQUIRED)
add_executable(ovnisync ovnisync.c)
target_link_libraries(ovnisync m MPI::MPI_C)
install(TARGETS ovnisync RUNTIME DESTINATION bin)
else()
message(STATUS "Disabling ovnisync as MPI is disabled")
endif()
find_package(MPI REQUIRED)
add_executable(ovnisync ovnisync.c)
target_link_libraries(ovnisync m MPI::MPI_C)
install(TARGETS ovniemu ovnidump ovnisync ovnisort RUNTIME DESTINATION bin)
install(TARGETS ovniemu ovnidump ovnisort RUNTIME DESTINATION bin)