]> git.mxchange.org Git - flightgear.git/blob - docs-mini/README.MSVC
Cameron Moore:
[flightgear.git] / docs-mini / README.MSVC
1 HowTo compile FlightGear with Microsoft Visual C++ 6.0
2 ======================================================
3
4 This HowTo is written for FlightGear 0.7.4. You might be able to
5 figure out how to get any other version running by reading it as the
6 steps are quite simmilar.
7
8 First you need FlightGear 0.7.4 or on of the current snapshots from
9
10   ftp://ftp.flightgear.org/pub/fgfs/Source
11
12 or
13
14   ftp://ftp.flightgear.org/pub/fgfs/Source/snapshots
15
16 The you need the libraries that it depends on. This is SimGear 0.0.9
17 and plib 1.1.11. Those libraries can be found at
18
19   ftp://ftp.flightgear.org/pub/fgfs/Source
20
21 and
22
23   http://plib.sourceforge.net/
24
25 Then you've got two posibilities. Either use the MSVC workspace that
26 you can find at
27
28   ftp://ftp.flightgear.org/pub/fgfs/Source
29
30 or create your own workspace.
31
32 The premade workspace will give you a quicker start (it takes some
33 time to create your own), but it will most probably be outdatet so
34 that you'd have to fix it.
35
36 Any wich way you choose you'll have to create the plib library now
37 (i.e. before you touch anything from FGFS). You can either use the
38 workspace that comes with it (most probably outdated) or create your
39 own ones. The way to do that is very similar to those of the creation
40 of the SimGear workspaces which is described below.
41
42 If you use the premade workspace (one for SimGear and one for
43 FlightGear) you'll have to open the SimGear one first and compile it,
44 then the FlightGear one. After that you should be read to run FGFS.
45
46 The universal approach is by creating your own workspace.
47
48 Make sure that you've compiled PLIB sucessfully and that you've got in
49 ...\plib (I'm using ...\ for the directory where all your projects
50 are. The name of the directory doesn't matter as all paths will be
51 relative):
52
53   ...\plib\plib.lib
54   ...\plib\fnt.h
55   ...\plib\plib\js.h
56   ...\plib\pu.h 
57   ...\plib\sg.h
58   ...\plib\sl.h
59   ...\plib\sm.h
60   ...\plib\ssg.h
61   ...\plib\ssgKeyFlier.h
62
63 (This also important when you are using the premade workspaces)
64
65 Now unzip SimGear-0.0.9 into ...\SimGear (NOTE: There's no -0.0.9 at
66 the end of the directory) and run MSVC. Create a new and empty
67 workspace, call it 'SimGear Workspace' and make sure it'S path is
68 '...\SimGear\SimGear Workspace'
69
70 Then you'll have to add lots of new projects. The best way is by right
71 clicking on the workspace and select 'Add new project'. Select
72 Win32-Library (static) in the dialog and set the name to the first
73 subdir in ...\SimGear\simgear. That'll be most probably 'bucket'. The
74 path will automatically be set to ...\SimGear\bucket. Then press OK as
75 often as necessary (we don't need any of the checkboxes that'll
76 apear).
77
78 Repeat that with all subdirectories. (If you'll open both, MSVC and
79 the Explorer it'll be quite fast). With SimGear 0.0.9 you should have
80 11 projects.
81
82 Now do it the last time and create a project with the name 'simgear'
83 and make it dependant on all other projects (through the projects
84 menu).
85
86 Now it's time to fill the projects. Right click on the first one and
87 select the item to add new files. In the file selector select the
88 files of the corresponding directory. That'll be e.g. for the 'bucket'
89 project:
90
91   ...\SimGear\simgear\bucket\newbucket.cxx
92   ...\SimGear\simgear\bucket\newbucket.hxx
93
94 The files for the MetaKit live in
95
96   ...\SimGear\simgear\metakit\src\
97
98 and
99
100   ...\SimGear\simgear\metakit\include\
101
102 NOTE: borc.h, gnuc.h, mk4dll.h and mwcw.h aren't needed and shouldn't
103 be included
104
105 Then add to all projects the additional search path
106 '..\..\,..\..\..\,..\..\simgear\'. Do that by pressing Alt-F7,
107 selecting all projects, selecting 'all configurations', selecting the
108 'C/C++' tab, selecting 'preprocessor' and then add that path to the
109 additional include path.
110
111 The 'metakit' project needs a special addition to its include path:
112 '..\..\\simgear\metakit\win,..\..\simgear\metakit\include'
113
114 All projects need the additon of a few preprocessor defines. You can
115 set those in the Alt-F7 dialog on the same tab where you set the
116 include paths. The necessary defines are:
117
118   HAVE_WINDOWS_H and HAVE_RAND
119
120 Now we are nearly ready for compiling SimGear. The only thing missing
121 is the exclusion of all those test programms. These programms are
122
123   debug:  logtest.cxx
124   magvar: testmagvar.cxx
125   metar:  Drvmetar.c
126   serial: testserial.cxx
127   zlib:   example.c
128   zlib:   maketree.obj
129   zlib:   minigzip.c
130
131 To exclude them, press Alt-F7, select 'all configurations' and then
132 select all those files, and then exlclude those files.
133
134 Last thing to do before you can compile SimGear is to press Alt-F7
135 once again, select simgear and all configurations and the general
136 tab. Add '..\..\' to the directory for the output files.
137
138 Finally you can hit compile.
139
140 When you've done everything correctly you'll have a 'simgear.lib' at
141 ...\SimGear\.
142
143 Congratulations for completing step 1.
144
145 To compile FlightGear you'll have to do quite similar steps.
146
147 Make sure that FlighGear lives in ...\FlightGear, create a new and
148 empty workspace named 'FlightGear Workspace' at
149 '...\FlightGear\FlightGear Workspace'. Now add the projects that are
150 named after the directories in ...\FlightGear\src.
151
152 NOTE: Create a project named 'FDM' as well as projects named
153       'FDM Balloon', 'FDM JSBsim', ...
154 NOTE: There'll even be a project named 'FDM JSBsim Filtersjb'
155 NOTE: The directory 'Include' doesn't get its own project
156 NOTE: The directory 'Main' is special. It's project name is 
157       'FlightGear' and it's not a win32 libraray. It's a 
158       win32-console application.
159
160 Then it's time to add the files in those directories to the
161 projects. (See description of SimGear for the details).
162
163 Next step is to set the dependancies. 'FDM JSBsim' depends on 'FDM
164 JSBsim Filtersjb', 'FDM' depends on the other 'FDM ...' projects and
165 'FlightGear' depends on all other projects (but not 'FDM Ballon'
166 etc. as other projects do already depend on them).
167
168 NOTE: No project is allowed to depend on 'NetworkOLK' as it isn'T
169 compatible with MSVC yet.
170
171 Now make sure that the 'FlightGear' project is the active one (that's
172 the bold one).
173
174 Then add those include paths: ..\..\..\SimGear\,..\..\src,..\..\src\Include,..\..\..\,..\..\..\SimGear\simgear\metakit\include\
175
176 Exclude the following files:
177
178 airports:   buildsimple.cxx
179 Navaids:    testnavs.cxx
180 Joystick:   js_demo.cxx
181 FDM JSBsim: JSBSim.cpp
182
183 Wolfram Kuss (w_kuss@rz-online.de) figured out that the following
184 files also have to be excluded:
185
186 LaRCsim/c172_main.c
187 airports/testair
188 airports/genrunwas
189 airports/gensimple
190 the rest of airports ??
191 scenery/test
192 time/win32test
193 time/test_event
194
195 Add those preprocessor defines
196
197 HAVE_WINDOWS_H, FGFS, ENABLE_PLIB_JOYSTICK
198
199 Add those libraries to the linker
200
201 plib.lib simgear.lib ws2_32.lib
202
203 and those paths to the library paths
204
205 ..\..\..\plib,..\..\..\simgear
206
207 Now press Alt-F7 again, select 'FlightGear' and 'all
208 configurations'. Now specify your FG_ROOT/bin directory as the
209 directory for the output data and FG_ROOT as the working directory.
210
211 Now you are ready to compile FGFS! Have fun.
212
213 NOTE: Wolfram Kuss (w_kuss@rz-online.de) Figured out that a lot of
214 files are useing header files from SimGear. This leads to problems
215 with using precompiled headers as long as you didn't declare all
216 dependencies. He simply turned off precompiled headers.
217
218 NOTE: As most developers aren't using MSVC the source code is probably
219 broken. If that's the case and you know how to fix it it'll be nice if
220 you could mail a bug report with it's fix to the FlightGear
221 development list.