2023-12-01 15:11:10 +01:00
|
|
|
{ lib
|
|
|
|
, llvmPackages_latest
|
|
|
|
, monorepoSrc
|
|
|
|
, runCommand
|
|
|
|
, cmake
|
|
|
|
, ninja
|
|
|
|
, llvm
|
|
|
|
, perl
|
|
|
|
, pkg-config
|
|
|
|
, version
|
|
|
|
, nosv
|
2024-01-12 17:28:22 +01:00
|
|
|
, ovni
|
2023-12-05 11:58:04 +01:00
|
|
|
, enableNosv ? false
|
2023-12-01 15:11:10 +01:00
|
|
|
, enableDebug ? false
|
2024-01-12 17:28:22 +01:00
|
|
|
, enableOvni ? false
|
2023-12-01 15:11:10 +01:00
|
|
|
}:
|
|
|
|
|
2024-01-12 17:28:22 +01:00
|
|
|
assert enableOvni -> enableNosv;
|
|
|
|
|
2023-12-01 15:11:10 +01:00
|
|
|
let
|
|
|
|
stdenv = llvmPackages_latest.stdenv;
|
|
|
|
in
|
|
|
|
stdenv.mkDerivation rec {
|
2023-12-05 11:58:04 +01:00
|
|
|
pname = "openmp" + (lib.optionalString enableNosv "-v");
|
2023-12-01 15:11:10 +01:00
|
|
|
inherit version;
|
|
|
|
|
|
|
|
src = runCommand "${pname}-src" {} ''
|
|
|
|
mkdir -p "$out"
|
|
|
|
cp -r ${monorepoSrc}/cmake "$out"
|
2023-12-05 11:58:04 +01:00
|
|
|
cp -r ${monorepoSrc}/openmp "$out"
|
2023-12-01 15:11:10 +01:00
|
|
|
'';
|
|
|
|
|
2023-12-05 11:58:04 +01:00
|
|
|
sourceRoot = "${src.name}/openmp";
|
2023-12-01 15:11:10 +01:00
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
cmake
|
|
|
|
ninja
|
|
|
|
perl
|
|
|
|
pkg-config
|
2023-12-05 11:58:04 +01:00
|
|
|
] ++ lib.optionals enableNosv [
|
2023-12-01 15:11:10 +01:00
|
|
|
nosv
|
2024-01-12 17:28:22 +01:00
|
|
|
] ++ lib.optionals enableOvni [
|
|
|
|
ovni
|
2023-12-01 15:11:10 +01:00
|
|
|
];
|
|
|
|
|
|
|
|
doCheck = false;
|
|
|
|
|
|
|
|
hardeningDisable = [ "all" ];
|
|
|
|
|
|
|
|
cmakeBuildType = if enableDebug then "Debug" else "Release";
|
|
|
|
|
|
|
|
dontStrip = enableDebug;
|
|
|
|
|
|
|
|
cmakeFlags = [
|
|
|
|
"-DLIBOMP_OMPD_SUPPORT=OFF"
|
|
|
|
"-DOPENMP_ENABLE_LIBOMPTARGET=OFF"
|
|
|
|
];
|
|
|
|
|
2023-12-05 11:58:04 +01:00
|
|
|
# Remove support for GNU and Intel Openmp.
|
|
|
|
# Also, remove libomp if building with nosv, as there is no support to build
|
|
|
|
# only one runtime at a time.
|
2023-12-01 15:11:10 +01:00
|
|
|
postInstall = ''
|
|
|
|
rm -f $out/lib/libgomp*
|
|
|
|
rm -f $out/lib/libiomp*
|
2023-12-05 11:58:04 +01:00
|
|
|
'' + lib.optionalString enableNosv ''
|
|
|
|
rm -f $out/lib/libomp.*
|
2023-12-01 15:11:10 +01:00
|
|
|
'';
|
2023-12-05 11:58:04 +01:00
|
|
|
|
|
|
|
passthru = {
|
|
|
|
inherit nosv;
|
|
|
|
};
|
2023-12-01 15:11:10 +01:00
|
|
|
}
|
|
|
|
|