pocl: use lib.mapAttrsToList in cmakeFlags

This commit is contained in:
John Titor 2025-10-11 16:09:32 +05:30
parent a9c1178014
commit f9f12c53c4
No known key found for this signature in database
GPG key ID: 29B0514F4E3C1CC0

View file

@ -56,24 +56,27 @@ stdenv.mkDerivation (finalAttrs: {
"static_cast<size_t>(Dev.getInfo<CL_DEVICE_GLOBAL_MEM_SIZE>())" "static_cast<size_t>(Dev.getInfo<CL_DEVICE_GLOBAL_MEM_SIZE>())"
''; '';
cmakeFlags = [ cmakeFlags =
# avoid the runtime linker pulling in a different llvm e.g. from graphics drivers (lib.mapAttrsToList lib.cmakeBool {
(lib.cmakeBool "STATIC_LLVM" true) # avoid the runtime linker pulling in a different llvm e.g. from graphics drivers
(lib.cmakeBool "ENABLE_POCL_BUILDING" false) "STATIC_LLVM" = true;
(lib.cmakeBool "POCL_ICD_ABSOLUTE_PATH" true) "ENABLE_POCL_BUILDING" = false;
(lib.cmakeBool "ENABLE_ICD" true) "POCL_ICD_ABSOLUTE_PATH" = true;
(lib.cmakeBool "ENABLE_REMOTE_CLIENT" true) "ENABLE_ICD" = true;
(lib.cmakeBool "ENABLE_REMOTE_SERVER" true) "ENABLE_REMOTE_CLIENT" = true;
(lib.cmakeFeature "CLANG" "${clangWrapped}/bin/clang") "ENABLE_REMOTE_SERVER" = true;
(lib.cmakeFeature "CLANGXX" "${clangWrapped}/bin/clang++") })
] ++ (lib.mapAttrsToList lib.cmakeFeature {
# Only x86_64 supports "distro" which allows runtime detection of SSE/AVX "CLANG" = "${clangWrapped}/bin/clang";
++ lib.optionals stdenv.hostPlatform.isx86_64 [ "CLANGXX" = "${clangWrapped}/bin/clang++";
(lib.cmakeFeature "KERNELLIB_HOST_CPU_VARIANTS" "distro") })
] # Only x86_64 supports "distro" which allows runtime detection of SSE/AVX
++ lib.optionals (!stdenv.hostPlatform.isx86_64) [ ++ lib.optionals stdenv.hostPlatform.isx86_64 [
(lib.cmakeFeature "LLC_HOST_CPU" "generic") (lib.cmakeFeature "KERNELLIB_HOST_CPU_VARIANTS" "distro")
]; ]
++ lib.optionals (!stdenv.hostPlatform.isx86_64) [
(lib.cmakeFeature "LLC_HOST_CPU" "generic")
];
nativeBuildInputs = [ nativeBuildInputs = [
cmake cmake