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: script:
- nix build -L --tarball-ttl 0 --file nix/rt.nix bsc.ovni-rt - 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: build:old-gcc:
stage: build stage: build
tags: tags:

View File

@ -155,6 +155,12 @@ let
export NODES_HOME="${last.nodes}" 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 in

View File

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