Merge pull request #147935 from risicle/ris-cppe-clang

cppe, python3Packages.cppe: fix build with clang
This commit is contained in:
Domen Kožar 2021-11-30 14:59:52 +01:00 committed by GitHub
commit 7f8ebc6d42
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 3 deletions

View File

@ -1,4 +1,4 @@
{ stdenv, lib, fetchFromGitHub, cmake }:
{ stdenv, lib, fetchFromGitHub, cmake, llvmPackages }:
stdenv.mkDerivation rec {
pname = "cppe";
@ -11,7 +11,8 @@ stdenv.mkDerivation rec {
sha256 = "sha256-guM7+ZWDJLcAUJtPkKLvC4LYSA2eBvER7cgwPZ7FxHw=";
};
nativeBuildInputs = [ cmake ];
nativeBuildInputs = [ cmake ]
++ lib.optionals stdenv.cc.isClang [ llvmPackages.openmp ];
cmakeFlags = [ "-DCMAKE_INSTALL_LIBDIR=lib" ];

View File

@ -1,5 +1,6 @@
{ buildPythonPackage
, lib
, stdenv
, cmake
, cppe
, eigen
@ -12,6 +13,7 @@
, pandas
, polarizationsolver
, pytest
, llvmPackages
}:
buildPythonPackage rec {
@ -31,7 +33,12 @@ buildPythonPackage rec {
dontUseCmakeConfigure = true;
buildInputs = [ pybind11 ];
buildInputs = [ pybind11 ]
++ lib.optional stdenv.cc.isClang llvmPackages.openmp;
NIX_CFLAGS_LINK = lib.optional stdenv.cc.isClang "-lomp";
hardeningDisable = lib.optional stdenv.cc.isClang "strictoverflow";
checkInputs = [
pytest