-
Notifications
You must be signed in to change notification settings - Fork 634
/
Copy pathdefault.nix
129 lines (119 loc) · 2.65 KB
/
default.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
# SPDX-License-Identifier: BSD-3-Clause
# Copyright (c) 2023-2025, The OpenROAD Authors
{
flake,
lib,
clangStdenv,
fetchFromGitHub,
fetchzip,
libsForQt5,
boost183,
eigen,
cudd,
ninja,
tcl,
python3,
readline,
tclreadline,
spdlog,
libffi,
llvmPackages,
lemon-graph,
or-tools,
glpk,
zlib,
clp,
cbc,
re2,
swig4,
pkg-config,
cmake,
gnumake,
flex,
bison,
clang-tools_14,
gtest,
# or-tools
stdenv,
overrideSDK,
git,
}: let
or-tools' =
(or-tools.override {
## Alligned alloc not available on the default SDK for x86_64-darwin (10.12!!)
stdenv =
if stdenv.isDarwin
then (overrideSDK stdenv "11.0")
else stdenv;
})
.overrideAttrs (finalAttrs: previousAttrs: {
# Based on https://github.com/google/or-tools/commit/af44f98dbeb905656b5a9fc664b5fdcffcbe1f60
# Stops CMake going haywire on reconfigures
postPatch =
previousAttrs.postPatch
+ ''
sed -Ei.bak 's/(NOT\s+\w+_FOUND\s+AND\s+)+//' cmake/ortoolsConfig.cmake.in
sed -Ei.bak 's/NOT absl_FOUND/NOT TARGET absl::base/' cmake/ortoolsConfig.cmake.in
'';
});
fetchedGtest = fetchzip {
url = "https://github.com/google/googletest/archive/refs/tags/v1.14.0.zip";
sha256 = "sha256-t0RchAHTJbuI5YW4uyBPykTvcjy90JW9AOPNjIhwh6U=";
};
self = clangStdenv.mkDerivation (finalAttrs: {
name = "openroad";
src = flake;
cmakeFlags = [
"-DTCL_LIBRARY=${tcl}/lib/libtcl${clangStdenv.hostPlatform.extensions.sharedLibrary}"
"-DTCL_HEADER=${tcl}/include/tcl.h"
"-DUSE_SYSTEM_BOOST:BOOL=ON"
"-DVERBOSE=1"
"-DFETCHCONTENT_SOURCE_DIR_GOOGLETEST=${fetchedGtest}"
];
postPatch = ''
patchShebangs .
'';
shellHook = ''
alias ord-format-changed="${git}/bin/git diff --name-only | grep -E '\.(cpp|cc|c|h|hh)$' | xargs clang-format -i -style=file:.clang-format";
'';
qt5Libs = [
libsForQt5.qt5.qtbase
libsForQt5.qt5.qtcharts
libsForQt5.qt5.qtsvg
libsForQt5.qt5.qtdeclarative
];
QT_PLUGIN_PATH = lib.makeSearchPathOutput "bin" "lib/qt-${libsForQt5.qt5.qtbase.version}/plugins" self.qt5Libs;
buildInputs = self.qt5Libs ++ [
boost183
eigen
cudd
tcl
python3
readline
tclreadline
spdlog
libffi
llvmPackages.openmp
lemon-graph
or-tools'
glpk
zlib
clp
cbc
re2
gtest
];
nativeBuildInputs = [
swig4
pkg-config
cmake
ninja
gnumake
flex
bison
libsForQt5.wrapQtAppsHook
clang-tools_14
];
});
in
self