targetTarget might be missing when native build

This commit is contained in:
Aleix Roca Nonell 2025-09-10 08:30:08 +02:00
parent 439242f669
commit 6e5e572ddb

View File

@ -20,13 +20,19 @@
with lib;
let
getSplice = target: pkg: if pkg ? "__spliced" && pkg.__spliced ? target then pkg.__spliced."${target}" else pkg;
#getSpliceTargetTarget = pkg: if pkg ? "__spliced" && pkg.__spliced ? "targetTarget" then pkg.__spliced.targetTarget else pkg;
getSpliceTargetTarget = getSplice "targetTarget";
omp = if useOpenmp then openmp else if useOpenmpV then openmpv else null;
ompss2rt = if useNanos6 then nanos6 else if useNodes then nodes else null;
ompss2rtUnspliced = if useNanos6 then nanos6 else if useNodes then nodes else null;
ompss2rt = getSpliceTargetTarget ompss2rtUnspliced;
usingNodesAndOmpv = (omp.pname == "openmp-v" && ompss2rt.pname == "nodes");
sameNosv = omp.nosv == ompss2rt.nosv;
sameNosvUnspliced = omp.nosv == ompss2rtUnspliced.nosv;
sameNosvSpliced = (getSpliceTargetTarget omp.nosv) == ompss2rt.nosv;
in
assert assertMsg (usingNodesAndOmpv -> sameNosv) "OpenMP-V and NODES must share the same nOS-V";
assert assertMsg (usingNodesAndOmpv -> sameNosvUnspliced) "OpenMP-V and NODES must share the same nOS-V before splice";
assert assertMsg (usingNodesAndOmpv -> sameNosvSpliced) "OpenMP-V and NODES must share the same nOS-V after splice";
assert assertMsg (useOpenmp -> !useOpenmpV) "Either OpenMP or OpenMP-V may be enabled, but not both";
assert assertMsg (useNanos6 -> !useNodes) "Either Nanos6 or NODES may be enabled, but not both";
@ -76,9 +82,9 @@ in (wrapCCWith {
echo "export OPENMP_RUNTIME=${ompname}" >> $out/nix-support/cc-wrapper-hook
'' + optionalString (ompss2rt != null) ''
echo "export OMPSS2_RUNTIME=${rtname}" >> $out/nix-support/cc-wrapper-hook
echo "export ${homevar}=${ompss2rt.__spliced.targetTarget}" >> $out/nix-support/cc-wrapper-hook
echo "export ${homevar}=${ompss2rt}" >> $out/nix-support/cc-wrapper-hook
'' + optionalString (ompss2rt != null && ompss2rt.pname == "nodes") ''
echo "export NOSV_HOME=${ompss2rt.nosv.__spliced.targetTarget}" >> $out/nix-support/cc-wrapper-hook
echo "export NOSV_HOME=${ompss2rt}" >> $out/nix-support/cc-wrapper-hook
'';
}) // { inherit ompss2rt; }