ispc: fix riscv64-linux build (#562779)

This commit is contained in:
Weijia Wang
2026-10-02 13:08:02 +00:00
committed by GitHub
2 changed files with 22 additions and 2 deletions

View File

@@ -15,6 +15,8 @@
testedTargets ?
if stdenv.hostPlatform.isAarch64 || stdenv.hostPlatform.isAarch32 then
[ "neon-i32x4" ]
else if stdenv.hostPlatform.isRiscV64 then
[ "rvv-x4" ]
else
[ "sse2-i32x4" ],
}:
@@ -58,6 +60,11 @@ stdenv.mkDerivation (finalAttrs: {
inherit testedTargets;
# run_tests.py does not know riscv64 hosts and defaults to x86 targets
patches = lib.optionals stdenv.hostPlatform.isRiscV64 [
./run-tests-riscv64.patch
];
doCheck = true;
# the compiler enforces -Werror, and -fno-strict-overflow makes it mad.
@@ -87,12 +94,13 @@ stdenv.mkDerivation (finalAttrs: {
(lib.cmakeFeature "CLANGPP_EXECUTABLE" "${llvmPackages.clang}/bin/clang++")
(lib.cmakeBool "ISPC_INCLUDE_EXAMPLES" false)
(lib.cmakeBool "ISPC_INCLUDE_UTILS" false)
(lib.cmakeFeature "ARM_ENABLED=" (
(lib.cmakeFeature "ARM_ENABLED" (
if stdenv.hostPlatform.isAarch64 || stdenv.hostPlatform.isAarch32 then "TRUE" else "FALSE"
))
(lib.cmakeFeature "X86_ENABLED=" (
(lib.cmakeFeature "X86_ENABLED" (
if stdenv.hostPlatform.isx86_64 || stdenv.hostPlatform.isx86_32 then "TRUE" else "FALSE"
))
(lib.cmakeFeature "RISCV_ENABLED" (if stdenv.hostPlatform.isRiscV64 then "TRUE" else "FALSE"))
];
meta = {

View File

@@ -0,0 +1,12 @@
--- a/scripts/run_tests.py
+++ b/scripts/run_tests.py
@@ -1368,6 +1368,9 @@
elif platform.machine() == "ppc64le":
default_target = "generic-i32x4"
default_arch = "ppc64le"
+elif platform.machine() == "riscv64":
+ default_target = "rvv-x4"
+ default_arch = "riscv64"
elif "86" in platform.machine() or platform.machine() == "AMD64":
# Some variant of x86: x86_64, i386, i486, i586, i686
# Windows reports platform as AMD64