Commit | Line | Data |
---|---|---|
7eeb782e AT |
1 | Building GNU Go on Windows Platforms |
2 | ||
3 | ========================== | |
4 | ||
5 | ||
6 | BUILDING WITH OLDER VISUAL STUDIO | |
7 | ||
8 | The distribution directories contain some .dsp and .dsw files with | |
9 | GNU Go. These have been brought up to date in the sense that they | |
10 | should work if you have the older VC++ with Visual Studio 6 | |
11 | but the distributed .dsp and .dsw files will only be of use with | |
12 | older version of Visual Studio. | |
13 | ||
14 | In most cases (unless you are building in Cygwin) the preferred way | |
15 | to build GNU Go on Windows platforms is to use CMake. CMake | |
16 | understands about many versions of Visual C/Visual Studio, and will | |
17 | generate project/solution files for the tools installed on your | |
18 | system. So even if you have Visual Studio 6 you may use CMake | |
19 | and dispense with the distributed .dsp and .dsw files. | |
20 | ||
21 | ========================== | |
22 | ||
23 | BUILDING WITH VISUAL STUDIO PROJECT FILES | |
24 | ||
25 | Before you compile the GNU Go source, you need to run CMake first, to | |
26 | generate the build files you'll give to Visual Studio. | |
27 | ||
28 | From the cmd.exe command prompt, CD into the GNU Go source directory. | |
29 | To confirm you're in the right place, you should see the file | |
30 | 'CMakeLists.txt' in the top-level directory of the GNU Go code (as well | |
31 | as others in lower subdirectories). | |
32 | ||
33 | Direct CMake to generate the new Visual Studio build files by typing: | |
34 | ||
35 | cmake CMakeLists.txt | |
36 | ||
37 | Compile the code by invoking the newly-created Solution file: | |
38 | ||
39 | vcbuild GNUGo.sln | |
40 | ||
41 | This will take a few moments, as CMake generates 4 debug/retail targets: | |
42 | ||
43 | debug | |
44 | release | |
45 | minsizerel | |
46 | relwithdebinfo | |
47 | ||
48 | For each of these targets, Visual Studio is generating a version of | |
49 | gnugo.exe: | |
50 | ||
51 | interface\debug\gnugo.exe | |
52 | interface\release\gnugo.exe | |
53 | interface\minsizerel\gnugo.exe | |
54 | interface\relwithdebinfo\gnugo.exe | |
55 | ||
56 | Additionally, there is an 'Install' target available, that will copy the | |
57 | the gnugo.exe into the %ProgramFiles% directory. To do this, type: | |
58 | ||
59 | vcbuild INSTALL.vcproj | |
60 | ||
61 | This should result in copying GNU/Go into: | |
62 | ||
63 | "%ProgramFiles%\GNUGo\bin\gnugo.exe" --options | |
64 | ||
65 | In addition to command line use, CMake also has a GUI version. Users of | |
66 | the Visual Studio GUI might prefer to use that. | |
67 | ||
68 | ========================== | |
69 | ||
70 | BUILDING WITH NMAKE MAKEFILES | |
71 | ||
72 | GNU Go will also build using NMake makefiles. Optionally, instead of | |
73 | Visual Studio project/solution files, you may direct CMake to generate | |
74 | NMake makefiles. To generate the makefiles: | |
75 | ||
76 | cmake -G "NMake Makefiles" CMakeLists.txt | |
77 | ||
78 | The default rule for the makefile is 'all'. Use the 'help' rule to show | |
79 | a list of available targets. | |
80 | ||
81 | nmake -f Makefile help | |
82 | ||
83 | To compile GNU Go: | |
84 | ||
85 | nmake -f Makefile all | |
86 | ||
87 | On some systems, GNU GO may fail to build when using NMake makefiles. It | |
88 | only fails the first time run, run NMake again with the 'clean all' | |
89 | targets, and it will compile the second and subsequent times. | |
90 | ||
91 | nmake -f Makefile clean all | |
92 | ||
93 | Which will successfully generate a gnugo.exe. | |
94 | ||
95 | interface\gnugo.exe --options | |
96 | ||
97 | ========================== | |
98 | ||
99 | BUILDING WITH MINGW MAKEFILES: | |
100 | ||
101 | GNU Go can be built on Windows systems using MinGW. | |
102 | ||
103 | This development environment uses: the GCC compiler (gcc.exe, not | |
104 | cl.exe), the Microsoft C runtime libraries (MSCRT, not GLibC), the GNU | |
105 | Make build tool (mingw32-make.exe, not NMake), all from the Windows | |
106 | shell (cmd.exe, not sh/bash). | |
107 | ||
108 | For CMake to work, in addition to the base MinGW installation, the C++ | |
109 | compiler (g++.exe) and GNU Make (mingw32-make.exe) need to be installed. | |
110 | This was tested using GCC v3, not the experimental v4. To debug, use | |
111 | GDB, as the GCC-generated symbols won't work with NTSD/Windbg/Visual Studio. | |
112 | ||
113 | To create the makfiles, run CMake with the MinGW generator option: | |
114 | ||
115 | cmake -G "MinGW Makefiles" CMakeLists.txt | |
116 | ||
117 | To build GNU Go, from a cmd.exe shell, run GNU Make (against the | |
118 | newly-created 'Makefile' and it's default 'all' target): | |
119 | ||
120 | mingw32-make | |
121 | ..\interface\gnugo.exe --options | |
122 | ||
123 | ========================== | |
124 | ||
125 | BUILDING WITH MSYS MAKEFILES (MinGW) | |
126 | ||
127 | GNU Go can be built on Windows systems using MSYS. | |
128 | ||
129 | This development environment uses: the GCC compiler (gcc.exe, not | |
130 | cl.exe), the Microsoft C runtime libraries (MSCRT, not GLibC), the GNU | |
131 | Make build tool (make, not NMake), all from the GNU Bash (sh.exe, not | |
132 | cmd.exe). | |
133 | ||
134 | To create the makfiles, run CMake with the MSYS generator option: | |
135 | ||
136 | cmake -G "MSYS Makefiles" CMakeLists.txt | |
137 | ||
138 | Start MSYS's Bash shell, either clicking on a shortcut on from the | |
139 | command line: | |
140 | ||
141 | cd /d c:\msys\1.0 | |
142 | msys.bat | |
143 | ||
144 | To build GNU Go, from a Bash shell, run GNU Make (against the | |
145 | newly-created 'Makefile' and it's default 'all' target): | |
146 | ||
147 | make | |
148 | ../interface/gnugo.exe --options | |
149 | ||
150 | To debug, use GDB, as the GCC-generated symbols won't work with | |
151 | NTSD/Windbg/Visual Studio. | |
152 | ||
153 | ========================== | |
154 | ||
155 | BUILDING ON CYGWIN | |
156 | ||
157 | With Cygwin, you should be able to | |
158 | ||
159 | tar zxvf gnugo-3.8.tar.gz | |
160 | cd gnugo-3.8 | |
161 | env CC='gcc -mno-cygwin' ./configure | |
162 | make | |
163 | ||
164 | ========================== | |
165 | ||
166 | Testing on Windows: | |
167 | ||
168 | Regress.cmd is a simplified cmd.exe-centric port of the main gnugo Unix | |
169 | shell script regress.sh. It can be used to help verify that the | |
170 | generated binary might be operational. Read the script's comment header | |
171 | for more information. For access to the full GNU Go tests, use Unix, not | |
172 | Windows. | |
173 | ||
174 | To test: | |
175 | ||
176 | cd regression | |
177 | regress.cmd ..\interface\gnugo.exe | |
178 | ||
179 | ========================== | |
180 | ||
181 | ||
182 | ||
183 |