Add fstdata helper class
[yosys.git] / misc / create_vcxsrc.sh
1 #!/bin/bash
2
3 set -ex
4 vcxsrc="$1-$2"
5 yosysver="$2"
6 gitsha="$3"
7
8 rm -rf YosysVS-Tpl-v2.zip YosysVS
9 wget https://yosyshq.net/yosys/nogit/YosysVS-Tpl-v2.zip
10
11 unzip YosysVS-Tpl-v2.zip
12 rm -f YosysVS-Tpl-v2.zip
13 mv YosysVS "$vcxsrc"
14
15 {
16 n=$(grep -B999 '<ItemGroup>' "$vcxsrc"/YosysVS/YosysVS.vcxproj | wc -l)
17 head -n$n "$vcxsrc"/YosysVS/YosysVS.vcxproj
18 egrep '\.(h|hh|hpp|inc)$' srcfiles.txt | sed 's,.*,<ClInclude Include="../yosys/&" />,'
19 egrep -v '\.(h|hh|hpp|inc)$' srcfiles.txt | sed 's,.*,<ClCompile Include="../yosys/&" />,'
20 echo '<ClCompile Include="../yosys/kernel/version.cc" />'
21 tail -n +$((n+1)) "$vcxsrc"/YosysVS/YosysVS.vcxproj
22 } > "$vcxsrc"/YosysVS/YosysVS.vcxproj.new
23
24 mv "$vcxsrc"/YosysVS/YosysVS.vcxproj.new "$vcxsrc"/YosysVS/YosysVS.vcxproj
25
26 mkdir -p "$vcxsrc"/yosys
27 tar -cf - -T srcfiles.txt | tar -xf - -C "$vcxsrc"/yosys
28 cp -r share "$vcxsrc"/
29
30 echo "namespace Yosys { extern const char *yosys_version_str; const char *yosys_version_str=\"Yosys" \
31 "$yosysver (git sha1 $gitsha, Visual Studio)\"; }" > "$vcxsrc"/yosys/kernel/version.cc
32
33 cat > "$vcxsrc"/readme-git.txt << EOT
34 Want to use a git working copy for the yosys source code?
35 Open "Git Bash" in this directory and run:
36
37 mv yosys yosys.bak
38 git clone https://github.com/YosysHQ/yosys.git yosys
39 cd yosys
40 git checkout -B master $(git rev-parse HEAD | cut -c1-10)
41 unzip ../genfiles.zip
42 EOT
43
44 cat > "$vcxsrc"/readme-abc.txt << EOT
45 Yosys is using "ABC" for gate-level optimizations and technology
46 mapping. Download yosys-win32-mxebin-$yosysver.zip and copy the
47 following files from it into this directory:
48
49 pthreadVC2.dll
50 yosys-abc.exe
51 EOT
52
53 sed -i 's/$/\r/; s/\r\r*/\r/g;' "$vcxsrc"/YosysVS/YosysVS.vcxproj "$vcxsrc"/readme-git.txt "$vcxsrc"/readme-abc.txt
54