Skip to content

Commit 9bdc1d3

Browse files
authored
tbb_{2021_11,2022_0}: Fix build on Windows (NixOS#396676)
2 parents 110afff + a899044 commit 9bdc1d3

File tree

2 files changed

+30
-2
lines changed

2 files changed

+30
-2
lines changed

pkgs/development/libraries/tbb/2022_0.nix

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
fetchFromGitHub,
55
fetchpatch,
66
cmake,
7+
ninja,
78
}:
89

910
stdenv.mkDerivation rec {
@@ -24,6 +25,7 @@ stdenv.mkDerivation rec {
2425

2526
nativeBuildInputs = [
2627
cmake
28+
ninja
2729
];
2830

2931
patches = [
@@ -34,6 +36,11 @@ stdenv.mkDerivation rec {
3436
})
3537
];
3638

39+
cmakeFlags = [
40+
# Skip tests to work around https://github.com/uxlfoundation/oneTBB/issues/1695
41+
(lib.cmakeBool "TBB_TEST" (!stdenv.hostPlatform.isWindows))
42+
];
43+
3744
# Fix build with modern gcc
3845
# In member function 'void std::__atomic_base<_IntTp>::store(__int_type, std::memory_order) [with _ITp = bool]',
3946
NIX_CFLAGS_COMPILE =
@@ -61,6 +68,8 @@ stdenv.mkDerivation rec {
6168
--replace-fail 'tbb_add_test(SUBDIR conformance NAME conformance_resumable_tasks DEPENDENCIES TBB::tbb)' ""
6269
'';
6370

71+
enableParallelBuilding = true;
72+
6473
meta = with lib; {
6574
description = "Intel Thread Building Blocks C++ Library";
6675
homepage = "http://threadingbuildingblocks.org/";
@@ -73,7 +82,7 @@ stdenv.mkDerivation rec {
7382
represents a higher-level, task-based parallelism that abstracts platform
7483
details and threading mechanisms for scalability and performance.
7584
'';
76-
platforms = platforms.unix;
85+
platforms = platforms.unix ++ platforms.windows;
7786
maintainers = with maintainers; [
7887
thoughtpolice
7988
tmarkus

pkgs/development/libraries/tbb/default.nix

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
fetchFromGitHub,
55
fetchpatch,
66
cmake,
7+
ninja,
78
}:
89

910
stdenv.mkDerivation rec {
@@ -24,6 +25,7 @@ stdenv.mkDerivation rec {
2425

2526
nativeBuildInputs = [
2627
cmake
28+
ninja
2729
];
2830

2931
patches = [
@@ -32,6 +34,21 @@ stdenv.mkDerivation rec {
3234
url = "https://patch-diff.githubusercontent.com/raw/oneapi-src/oneTBB/pull/899.patch";
3335
hash = "sha256-kU6RRX+sde0NrQMKlNtW3jXav6J4QiVIUmD50asmBPU=";
3436
})
37+
(fetchpatch {
38+
name = "fix-tbb-mingw-compile.patch";
39+
url = "https://patch-diff.githubusercontent.com/raw/oneapi-src/oneTBB/pull/1361.patch";
40+
hash = "sha256-jVa4HQetZv0vImdv549MyTy6/8t9dy8m6YAmjPGNQ18=";
41+
})
42+
(fetchpatch {
43+
name = "fix-tbb-mingw-link.patch";
44+
url = "https://patch-diff.githubusercontent.com/raw/oneapi-src/oneTBB/pull/1193.patch";
45+
hash = "sha256-ZQbwUmuIZoGVBof8QNR3V8vU385e2X7EvU3+Fbj4+M8=";
46+
})
47+
];
48+
49+
cmakeFlags = [
50+
# Skip tests to work around https://github.com/uxlfoundation/oneTBB/issues/1695
51+
(lib.cmakeBool "TBB_TEST" (!stdenv.hostPlatform.isWindows))
3552
];
3653

3754
# Fix build with modern gcc
@@ -61,6 +78,8 @@ stdenv.mkDerivation rec {
6178
--replace-fail 'tbb_add_test(SUBDIR conformance NAME conformance_resumable_tasks DEPENDENCIES TBB::tbb)' ""
6279
'';
6380

81+
enableParallelBuilding = true;
82+
6483
meta = with lib; {
6584
description = "Intel Thread Building Blocks C++ Library";
6685
homepage = "http://threadingbuildingblocks.org/";
@@ -73,7 +92,7 @@ stdenv.mkDerivation rec {
7392
represents a higher-level, task-based parallelism that abstracts platform
7493
details and threading mechanisms for scalability and performance.
7594
'';
76-
platforms = platforms.unix;
95+
platforms = platforms.unix ++ platforms.windows;
7796
maintainers = with maintainers; [
7897
thoughtpolice
7998
tmarkus

0 commit comments

Comments
 (0)