Merge pull request #3310 from robinsonb5-PRs/master
[yosys.git] / guidelines / Windows
1 Creating the Visual Studio Template Project
2 ===========================================
3
4 1. Create an empty Visual C++ Win32 Console App project
5
6 Microsoft Visual Studio Express 2013 for Windows Desktop
7 Open New Project Wizard (File -> New Project..)
8
9 Project Name: YosysVS
10 Solution Name: YosysVS
11 [X] Create directory for solution
12 [ ] Add to source control
13
14 [X] Console applications
15 [X] Empty Project
16 [ ] SDL checks
17
18 2. Open YosysVS Project Properties
19
20 Select Configuration: All Configurations
21
22 C/C++ -> General -> Additional Include Directories
23 Add: ..\yosys
24
25 C/C++ -> Preprocessor -> Preprocessor Definitions
26 Add: _YOSYS_;_CRT_SECURE_NO_WARNINGS
27
28 3. Resulting file system tree:
29
30 YosysVS/
31 YosysVS/YosysVS
32 YosysVS/YosysVS/YosysVS.vcxproj
33 YosysVS/YosysVS/YosysVS.vcxproj.filters
34 YosysVS/YosysVS.sdf
35 YosysVS/YosysVS.sln
36 YosysVS/YosysVS.v12.suo
37
38 4. Zip YosysVS as YosysVS-Tpl-v1.zip
39
40 Compiling with Visual Studio
41 ============================
42
43 Visual Studio builds are not directly supported by build scripts, but they are still possible.
44
45 1. Easy way
46
47 - Go to https://github.com/YosysHQ/yosys/actions/workflows/vs.yml?query=branch%3Amaster
48 - Click on the most recent completed run
49 - In Artifacts region find vcxsrc and click on it to download
50 - Unpack downloaded ZIP file
51 - Open YosysVS.sln with Visual Studio
52
53 2. Using WSL or MSYS2
54
55 - Make sure to have make, python3 and git available
56 - Git clone yosys repository
57 - Execute ```make vcxsrc YOSYS_VER=latest```
58 - File yosys-win32-vcxsrc-latest.zip will be created
59 - Transfer that file to location visible by Windows application
60 - Unpack ZIP
61 - Open YosysVS.sln with Visual Studio
62
63 Cross-Building for Windows with MXE
64 ===================================
65
66 Check http://mxe.cc/#requirements and install all missing requirements.
67
68 As root (or other user with write access to /usr/local/src):
69
70 cd /usr/local/src
71 git clone https://github.com/mxe/mxe.git
72 cd mxe
73
74 make -j$(nproc) MXE_PLUGIN_DIRS="plugins/tcl.tk" \
75 MXE_TARGETS="i686-w64-mingw32.static" \
76 gcc tcl readline
77
78 Then as regular user in some directory where you build stuff:
79
80 git clone https://github.com/YosysHQ/yosys.git yosys-win32
81 cd yosys-win32
82 make config-mxe
83 make -j$(nproc) mxebin