0
0
Fork 0
mirror of https://github.com/NixOS/nixpkgs.git synced 2025-07-21 01:20:34 +03:00
nixpkgs/pkgs/development/compilers/llvm/common/openmp/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

87 lines
2.3 KiB
Nix
Raw Normal View History

2023-03-26 19:29:57 +02:00
{ lib
, stdenv
, llvm_meta
, release_version
, patches ? []
, monorepoSrc ? null
, src ? null
2023-03-26 19:29:57 +02:00
, runCommand
, cmake
, ninja
, llvm
, targetLlvm
, lit
, clang-unwrapped
, perl
, pkg-config
, version
, devExtraCmakeFlags ? []
2023-03-26 19:29:57 +02:00
}:
let
2023-03-26 19:29:57 +02:00
pname = "openmp";
src' =
if monorepoSrc != null then
runCommand "${pname}-src-${version}" {} ''
mkdir -p "$out"
cp -r ${monorepoSrc}/cmake "$out"
cp -r ${monorepoSrc}/${pname} "$out"
'' else src;
in
stdenv.mkDerivation (rec {
inherit pname version patches;
2023-03-26 19:29:57 +02:00
src = src';
2023-03-26 19:29:57 +02:00
sourceRoot =
if lib.versionOlder release_version "13" then null
else "${src.name}/${pname}";
2023-03-26 19:29:57 +02:00
outputs = [ "out" ]
++ lib.optionals (lib.versionAtLeast release_version "14") [ "dev" ];
2023-03-26 19:29:57 +02:00
patchFlags =
if lib.versionOlder release_version "14" then [ "-p2" ]
else null;
nativeBuildInputs = [
cmake
] ++ lib.optionals (lib.versionAtLeast release_version "15") [
ninja
] ++ [ perl ] ++ lib.optionals (lib.versionAtLeast release_version "14") [
pkg-config lit
];
2023-03-26 19:29:57 +02:00
buildInputs = [
(if stdenv.buildPlatform == stdenv.hostPlatform then llvm else targetLlvm)
];
cmakeFlags = lib.optionals (lib.versions.major release_version == "13") [
"-DLIBOMPTARGET_BUILD_AMDGCN_BCLIB=OFF" # Building the AMDGCN device RTL fails
] ++ lib.optionals (lib.versionAtLeast release_version "14") [
2023-03-26 19:29:57 +02:00
"-DCLANG_TOOL=${clang-unwrapped}/bin/clang"
"-DOPT_TOOL=${llvm}/bin/opt"
"-DLINK_TOOL=${llvm}/bin/llvm-link"
] ++ devExtraCmakeFlags;
2023-03-26 19:29:57 +02:00
meta = llvm_meta // {
homepage = "https://openmp.llvm.org/";
description = "Support for the OpenMP language";
longDescription = ''
The OpenMP subproject of LLVM contains the components required to build an
executable OpenMP program that are outside the compiler itself.
Contains the code for the runtime library against which code compiled by
"clang -fopenmp" must be linked before it can run and the library that
supports offload to target devices.
'';
# "All of the code is dual licensed under the MIT license and the UIUC
# License (a BSD-like license)":
license = with lib.licenses; [ mit ncsa ];
};
} // (lib.optionalAttrs (lib.versionAtLeast release_version "14") {
doCheck = false;
checkTarget = "check-openmp";
preCheck = ''
patchShebangs ../tools/archer/tests/deflake.bash
'';
}))