-
Notifications
You must be signed in to change notification settings - Fork 0
/
nextpnr-nexus.rb
71 lines (61 loc) · 2.81 KB
/
nextpnr-nexus.rb
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
class NextpnrNexus < Formula
desc 'Portable FPGA place and route toolkit for Lattice Nexus FPGA family'
homepage 'https://github.com/YosysHQ/nextpnr'
version '0.7'
license 'ISC Licence'
url 'https://github.com/YosysHQ/nextpnr/archive/4d1de4532acf35bf4fdeea8bfcfb0e8b9ad3578c.tar.gz'
sha256 'edee6e3358245da8eac2a368dd3eceee69f147a9122df901cd39459eaac2010c'
head 'https://github.com/YosysHQ/nextpnr.git'
option 'without-python', 'Without python integration'
option 'without-heap', 'Without HeAP analytic placer'
option 'with-openmp', 'Use OpenMP to accelerate analytic placer'
option 'with-static', 'Create a static build'
option 'with-chipdb', 'Create build with pre-built chipdb binaries'
option 'with-profiler', 'Link against libprofiler'
option 'without-ipo', 'Compile nextpnr without IPO'
depends_on 'cmake' => :build
depends_on 'ninja' => :build
depends_on 'prjoxide' if build.without? 'static'
depends_on 'prjoxide' => :build if build.with? 'static'
depends_on 'boost' if build.without? 'static'
depends_on 'boost' => :build if build.with? 'static'
depends_on 'eigen' if build.without? 'static'
depends_on 'eigen' => :build if build.with? 'static'
depends_on '[email protected]' unless build.without? 'python'
resource 'fpga-interchange-schema' do
url 'https://github.com/chipsalliance/fpga-interchange-schema/archive/c985b4648e66414b250261c1ba4cbe45a2971b1c.tar.gz'
sha256 'c1c7ef5a5d38d740b97971d91a25d1099c58cef007e654b4fbceaa1538f757bf'
end unless build.head?
resource 'fpga-interchange-schema' do
url 'https://github.com/chipsalliance/fpga-interchange-schema/archive/refs/heads/main.tar.gz'
end if build.head?
def install
(buildpath/'3rdparty/fpga-interchange-schema')
.install(resource('fpga-interchange-schema'))
args = [
"-DOXIDE_INSTALL_PREFIX=#{Formula["prjoxide"].opt_prefix}",
'-DARCH=nexus'
]
if build.with? 'python'
`python3.12-config --includes`.chomp.split.each do |entry|
include_path = entry[2..]
args << "-DPYTHON3_INCLUDE_DIR=#{include_path}" if File.directory? include_path
end
end
args << '-DBUILD_PYTHON=OFF' if build.without? 'python'
args << '-DBUILD_HEAP=OFF' if build.without? 'heap'
args << '-DUSE_OPENMP=ON' if build.with? 'openmp'
args << '-DSTATIC_BUILD=ON' if build.with? 'static'
args << '-DEXTERNAL_CHIPDB=ON' if build.with? 'chipdb'
args << '-DPROFILER=ON' if build.with? 'profiler'
args << '-DUSE_IPO=ON' if build.with? 'ipo'
args << "-DCURRENT_GIT_VERSION=#{version}" unless build.head?
args << "-DCURRENT_GIT_VERSION=#{head.version.commit}" if build.head?
system 'cmake', '-GNinja', *std_cmake_args, *args, '.'
system 'ninja', "-j#{Hardware::CPU.cores}"
system 'ninja', 'install'
end
test do
system "#{bin}/nextpnr-nexus", '-h'
end
end