]>
Commit | Line | Data |
---|---|---|
302aa842 JS |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: makeproj.cpp | |
3 | // Purpose: Generate sample VC++ project files | |
4 | // Author: Julian Smart | |
5 | // Modified by: | |
6 | // Created: 10/12/98 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) Julian Smart | |
9 | // Licence: wxWindows licence | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #ifdef __GNUG__ | |
13 | #pragma implementation "makeproj.h" | |
14 | #endif | |
15 | ||
16 | // For compilers that support precompilation, includes "wx.h". | |
17 | #include "wx/wxprec.h" | |
18 | ||
19 | #if defined(__BORLANDC__) | |
20 | #pragma hdrstop | |
21 | #endif | |
22 | ||
23 | #include "wx/wx.h" | |
24 | #include "wx/resource.h" | |
25 | ||
26 | #include "iostream.h" | |
27 | #include "fstream.h" | |
28 | ||
29 | #include "makeproj.h" | |
30 | #include "projgenrc.h" | |
31 | ||
32 | // ---------------------------------------------------------------------------- | |
33 | // ressources | |
34 | // ---------------------------------------------------------------------------- | |
35 | // the application icon | |
36 | #if defined(__WXGTK__) || defined(__WXMOTIF__) | |
37 | #include "mondrian.xpm" | |
38 | #endif | |
39 | ||
40 | // ---------------------------------------------------------------------------- | |
41 | // private classes | |
42 | // ---------------------------------------------------------------------------- | |
43 | ||
44 | // Define a new application type, each program should derive a class from wxApp | |
45 | class MyApp : public wxApp | |
46 | { | |
47 | public: | |
48 | // override base class virtuals | |
49 | // ---------------------------- | |
50 | ||
51 | // this one is called on application startup and is a good place for the app | |
52 | // initialization (doing it here and not in the ctor allows to have an error | |
53 | // return: if OnInit() returns false, the application terminates) | |
54 | virtual bool OnInit(); | |
55 | ||
56 | bool GenerateSample(const wxString& projectName, const wxString& targetName, | |
57 | const wxString& path, const wxStringList& sourceFiles); | |
58 | void GenerateSamples(const wxString& dir); // Takes wxWindows directory path | |
59 | }; | |
60 | ||
61 | // Define a new frame type: this is going to be our main frame | |
62 | class MyFrame : public wxFrame | |
63 | { | |
64 | public: | |
65 | // ctor(s) | |
66 | MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size); | |
67 | ||
68 | // event handlers (these functions should _not_ be virtual) | |
69 | void OnQuit(wxCommandEvent& event); | |
70 | void OnAbout(wxCommandEvent& event); | |
71 | void OnGenerate(wxCommandEvent& event); | |
72 | ||
73 | bool GenerateSample(const wxString& projectName, const wxString& targetName, | |
74 | const wxString& path, const wxStringList& sourceFiles); | |
75 | ||
76 | private: | |
77 | // any class wishing to process wxWindows events must use this macro | |
78 | DECLARE_EVENT_TABLE() | |
79 | }; | |
80 | ||
81 | // Define a dialog: this will be our main dialog | |
82 | class MyDialog : public wxDialog | |
83 | { | |
84 | public: | |
85 | // ctor(s) | |
86 | MyDialog(const wxString& title, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize); | |
87 | ||
88 | // event handlers (these functions should _not_ be virtual) | |
89 | void OnQuit(wxCommandEvent& event); | |
90 | void OnAbout(wxCommandEvent& event); | |
91 | void OnGenerate(wxCommandEvent& event); | |
92 | void OnGenerateSamples(wxCommandEvent& event); | |
93 | ||
94 | private: | |
95 | // any class wishing to process wxWindows events must use this macro | |
96 | DECLARE_EVENT_TABLE() | |
97 | }; | |
98 | ||
99 | ||
100 | // ---------------------------------------------------------------------------- | |
101 | // constants | |
102 | // ---------------------------------------------------------------------------- | |
103 | ||
104 | // IDs for the controls and the menu commands | |
105 | enum | |
106 | { | |
107 | // menu items | |
108 | MakeProject_Quit = 1, | |
109 | MakeProject_About, | |
110 | MakeProject_Generate, | |
111 | MakeProject_GenerateSamples, | |
112 | ||
113 | // controls start here (the numbers are, of course, arbitrary) | |
114 | MakeProject_Text = 1000, | |
115 | }; | |
116 | ||
117 | // ---------------------------------------------------------------------------- | |
118 | // event tables and other macros for wxWindows | |
119 | // ---------------------------------------------------------------------------- | |
120 | ||
121 | // the event tables connect the wxWindows events with the functions (event | |
122 | // handlers) which process them. It can be also done at run-time, but for the | |
123 | // simple menu events like this the static method is much simpler. | |
124 | BEGIN_EVENT_TABLE(MyFrame, wxFrame) | |
125 | EVT_MENU(MakeProject_Quit, MyFrame::OnQuit) | |
126 | EVT_MENU(MakeProject_About, MyFrame::OnAbout) | |
127 | EVT_MENU(MakeProject_Generate, MyFrame::OnGenerate) | |
128 | END_EVENT_TABLE() | |
129 | ||
130 | // Create a new application object: this macro will allow wxWindows to create | |
131 | // the application object during program execution (it's better than using a | |
132 | // static object for many reasons) and also declares the accessor function | |
133 | // wxGetApp() which will return the reference of the right type (i.e. MyApp and | |
134 | // not wxApp) | |
135 | IMPLEMENT_APP(MyApp) | |
136 | ||
137 | // ============================================================================ | |
138 | // implementation | |
139 | // ============================================================================ | |
140 | ||
141 | // ---------------------------------------------------------------------------- | |
142 | // the application class | |
143 | // ---------------------------------------------------------------------------- | |
144 | ||
145 | // 'Main program' equivalent: the program execution "starts" here | |
146 | bool MyApp::OnInit() | |
147 | { | |
148 | #if 0 | |
149 | // Create the main application window | |
150 | MyFrame *frame = new MyFrame("MakeProject wxWindows App", | |
151 | wxPoint(50, 50), wxSize(450, 340)); | |
152 | ||
153 | frame->Show(TRUE); | |
154 | SetTopWindow(frame); | |
155 | #endif | |
156 | wxResourceParseFile("projgenrc.wxr"); | |
157 | ||
158 | MyDialog* dialog = new MyDialog("VC++ MakeProject"); | |
159 | dialog->ShowModal(); | |
160 | ||
161 | return FALSE; | |
162 | } | |
163 | ||
164 | bool MyApp::GenerateSample(const wxString& projectName, const wxString& targetName, | |
165 | const wxString& path, const wxStringList& sourceFiles) | |
166 | { | |
167 | wxProject project; | |
168 | ||
169 | // For all samples | |
170 | project.SetIncludeDirs(wxStringList("../../include", 0)); | |
171 | project.SetResourceIncludeDirs(wxStringList("../../include", 0)); | |
172 | project.SetLibDirs(wxStringList("../../lib", 0)); | |
173 | project.SetDebugLibDirs(wxStringList("../../src/Debug", 0)); | |
174 | project.SetReleaseLibDirs(wxStringList("../../src/Release", 0)); | |
175 | ||
176 | project.SetProjectName(projectName); | |
177 | project.SetTargetName(targetName); | |
178 | project.SetProjectPath(path); | |
179 | project.SetSourceFiles(sourceFiles); | |
180 | ||
181 | if (!project.GenerateVCProject()) | |
182 | { | |
183 | wxString msg("Could not generate "); | |
184 | msg += projectName; | |
185 | wxMessageBox(msg); | |
186 | return FALSE; | |
187 | } | |
188 | return TRUE; | |
189 | } | |
190 | ||
191 | ||
192 | void MyApp::GenerateSamples(const wxString& dir) | |
193 | { | |
194 | // Small bug. Because we don't distinguish between Debug/DebugDLL, Release/ReleaseDLL, | |
195 | // we can't yet make a sample that uses other wxWindows static libraries + the wxWindows DLL library. | |
196 | ||
197 | GenerateSample("BombsVC", "bombs", dir + wxString("/samples/bombs"), | |
198 | wxStringList("bombs.cpp", "bombs1.cpp", "game.cpp", "bombs.h", "game.h", 0)); | |
199 | GenerateSample("CaretVC", "caret", dir + wxString("/samples/caret"), wxStringList("caret.cpp", 0)); | |
200 | GenerateSample("CheckLstVC", "checklst", dir + wxString("/samples/checklst"), wxStringList("checklst.cpp", 0)); | |
201 | GenerateSample("ConfigVC", "conftest", dir + wxString("/samples/config"), wxStringList("conftest.cpp", 0)); | |
202 | GenerateSample("ControlsVC", "controls", dir + wxString("/samples/controls"), wxStringList("controls.cpp", 0)); | |
203 | GenerateSample("DbVC", "dbtest", dir + wxString("/samples/db"), | |
204 | wxStringList("dbtest.cpp", "listdb.cpp", "dbtest.h", "listdb.h", 0)); | |
205 | GenerateSample("DialogsVC", "dialogs", dir + wxString("/samples/dialogs"), | |
206 | wxStringList("dialogs.cpp", "dialogs.h", 0)); | |
207 | GenerateSample("DndVC", "dnd", dir + wxString("/samples/dnd"), wxStringList("dnd.cpp", 0)); | |
208 | GenerateSample("DocViewVC", "docview", dir + wxString("/samples/docview"), | |
209 | wxStringList("docview.cpp", "doc.cpp", "view.cpp", "docview.h", "doc.h", "view.h", 0)); | |
210 | GenerateSample("DocVwMDIVC", "docview", dir + wxString("/samples/docvwmdi"), | |
211 | wxStringList("docview.cpp", "doc.cpp", "view.cpp", "docview.h", "doc.h", "view.h", 0)); | |
212 | GenerateSample("DynamicVC", "dynamic", dir + wxString("/samples/dynamic"), wxStringList("dynamic.cpp", 0)); | |
213 | GenerateSample("FortyVC", "forty", dir + wxString("/samples/forty"), | |
214 | wxStringList("forty.cpp", "canvas.cpp", "card.cpp", "game.cpp", "pile.cpp", "playerdg.cpp", "scoredg.cpp", "scorefil.cpp", | |
215 | "canvas.h", "forty.h", "card.h", "game.h", "pile.h", "playerdg.h", "scoredg.h", "scorefil.h", | |
216 | 0)); | |
217 | GenerateSample("FractalVC", "fractal", dir + wxString("/samples/fractal"), wxStringList("fractal.cpp", 0)); | |
218 | GenerateSample("GridVC", "test", dir + wxString("/samples/grid"), wxStringList("test.cpp", 0)); | |
219 | GenerateSample("HelpVC", "demo", dir + wxString("/samples/help"), wxStringList("demo.cpp", 0)); | |
220 | ||
221 | // wxHTML samples | |
222 | GenerateSample("AboutVC", "about", dir + wxString("/samples/html/about"), wxStringList("about.cpp", 0)); | |
223 | GenerateSample("HelpVC", "help", dir + wxString("/samples/html/help"), wxStringList("help.cpp", 0)); | |
224 | GenerateSample("PrintingVC", "printing", dir + wxString("/samples/html/printing"), wxStringList("printing.cpp", 0)); | |
225 | GenerateSample("TestVC", "test", dir + wxString("/samples/html/test"), wxStringList("test.cpp", 0)); | |
226 | GenerateSample("VirtualVC", "virtual", dir + wxString("/samples/html/virtual"), wxStringList("virtual.cpp", 0)); | |
227 | GenerateSample("WidgetVC", "widget", dir + wxString("/samples/html/widget"), wxStringList("widget.cpp", 0)); | |
228 | GenerateSample("ZipVC", "zip", dir + wxString("/samples/html/zip"), wxStringList("zip.cpp", 0)); | |
229 | ||
230 | GenerateSample("ImageVC", "image", dir + wxString("/samples/image"), wxStringList("image.cpp", 0)); | |
231 | GenerateSample("InternatVC", "internat", dir + wxString("/samples/internat"), wxStringList("internat.cpp", 0)); | |
232 | GenerateSample("JoytestVC", "joytest", dir + wxString("/samples/joytest"), wxStringList("joytest.cpp", "joytest.h", 0)); | |
233 | GenerateSample("LayoutVC", "layout", dir + wxString("/samples/layout"), wxStringList("layout.cpp", "layout.h", 0)); | |
234 | GenerateSample("ListctrlVC", "listtest", dir + wxString("/samples/listctrl"), wxStringList("listtest.cpp", "listtest.h", 0)); | |
235 | GenerateSample("MdiVC", "mdi", dir + wxString("/samples/mdi"), wxStringList("mdi.cpp", "mdi.h", 0)); | |
236 | GenerateSample("MemcheckVC", "memcheck", dir + wxString("/samples/memcheck"), wxStringList("memcheck.cpp", 0)); | |
237 | // Note: MFC sample will be different. | |
238 | GenerateSample("MfcVC", "mfc", dir + wxString("/samples/mfc"), wxStringList("mfctest.cpp", "mfctest.h", 0)); | |
239 | GenerateSample("MiniframVC", "test", dir + wxString("/samples/minifram"), wxStringList("test.cpp", "test.h", 0)); | |
240 | GenerateSample("MinimalVC", "minimal", dir + wxString("/samples/minimal"), wxStringList("minimal.cpp", 0)); | |
241 | GenerateSample("NativdlgVC", "nativdlg", dir + wxString("/samples/nativdlg"), wxStringList("nativdlg.cpp", "nativdlg.h", "resource.h", 0)); | |
242 | GenerateSample("NettestVC", "nettest", dir + wxString("/samples/nettest"), wxStringList("nettest.cpp", 0)); | |
243 | GenerateSample("NotebookVC", "test", dir + wxString("/samples/notebook"), wxStringList("test.cpp", "test.h", 0)); | |
244 | GenerateSample("OleautoVC", "oleauto", dir + wxString("/samples/oleauto"), wxStringList("oleauto.cpp", 0)); | |
245 | GenerateSample("OwnerdrwVC", "ownerdrw", dir + wxString("/samples/ownerdrw"), wxStringList("ownerdrw.cpp", 0)); | |
246 | GenerateSample("PngVC", "pngdemo", dir + wxString("/samples/png"), wxStringList("pngdemo.cpp", "pngdemo.h", 0)); | |
247 | GenerateSample("PrintingVC", "printing", dir + wxString("/samples/printing"), wxStringList("printing.cpp", "printing.h", 0)); | |
248 | GenerateSample("ProplistVC", "test", dir + wxString("/samples/proplist"), wxStringList("test.cpp", "test.h", 0)); | |
249 | GenerateSample("RegtestVC", "regtest", dir + wxString("/samples/regtest"), wxStringList("regtest.cpp", 0)); | |
250 | GenerateSample("ResourceVC", "resource", dir + wxString("/samples/resource"), wxStringList("resource.cpp", "resource.h", 0)); | |
251 | GenerateSample("RichEditVC", "wxLayout", dir + wxString("/samples/richedit"), wxStringList("wxLayout.cpp", | |
252 | "kbList.cpp", "wxllist.cpp", "wxlparser.cpp", "wxlwindow.cpp", 0)); | |
253 | GenerateSample("SashtestVC", "sashtest", dir + wxString("/samples/sashtest"), wxStringList("sashtest.cpp", "sashtest.h", 0)); | |
254 | GenerateSample("ScrollVC", "scroll", dir + wxString("/samples/scroll"), wxStringList("scroll.cpp", 0)); | |
255 | GenerateSample("SplitterVC", "test", dir + wxString("/samples/splitter"), wxStringList("test.cpp", 0)); | |
256 | GenerateSample("TabVC", "test", dir + wxString("/samples/tab"), wxStringList("test.cpp", "test.h", 0)); | |
257 | GenerateSample("TaskbarVC", "tbtest", dir + wxString("/samples/taskbar"), wxStringList("tbtest.cpp", "tbtest.h", 0)); | |
258 | GenerateSample("TextVC", "text", dir + wxString("/samples/text"), wxStringList("text.cpp", 0)); | |
259 | GenerateSample("ThreadVC", "test", dir + wxString("/samples/thread"), wxStringList("test.cpp", 0)); | |
260 | GenerateSample("ToolbarVC", "test", dir + wxString("/samples/toolbar"), wxStringList("test.cpp", "test.h", 0)); | |
261 | GenerateSample("TreectrlVC", "treetest", dir + wxString("/samples/treectrl"), wxStringList("treetest.cpp", "treetest.h", 0)); | |
262 | GenerateSample("TypetestVC", "typetest", dir + wxString("/samples/typetest"), wxStringList("typetest.cpp", "typetest.h", 0)); | |
263 | GenerateSample("ValidateVC", "validate", dir + wxString("/samples/validate"), wxStringList("validate.cpp", "validate.h", 0)); | |
264 | GenerateSample("ClientVC", "client", dir + wxString("/samples/wxsocket"), wxStringList("client.cpp", 0)); | |
265 | GenerateSample("ServerVC", "server", dir + wxString("/samples/wxsocket"), wxStringList("server.cpp", 0)); | |
266 | GenerateSample("PoemVC", "wxpoem", dir + wxString("/samples/wxpoem"), wxStringList("wxpoem.cpp", "wxpoem.h", 0)); | |
267 | GenerateSample("ClientVC", "client", dir + wxString("/samples/dde"), wxStringList("client.cpp", "client.h", "ddesetup.h", 0)); | |
268 | GenerateSample("ServerVC", "server", dir + wxString("/samples/dde"), wxStringList("server.cpp", "server.h", "ddesetup.h", 0)); | |
269 | GenerateSample("CaretVC", "caret", dir + wxString("/samples/caret"), wxStringList("caret.cpp", 0)); | |
270 | GenerateSample("DrawingVC", "drawing", dir + wxString("/samples/drawing"), wxStringList("drawing.cpp", 0)); | |
271 | GenerateSample("ScrollVC", "scroll", dir + wxString("/samples/scroll"), wxStringList("scroll.cpp", 0)); | |
272 | ||
273 | //// Utilities | |
274 | ||
275 | // Dialog Editor | |
276 | wxProject project; | |
277 | ||
278 | project.SetIncludeDirs(wxStringList("../../../include", 0)); | |
279 | project.SetResourceIncludeDirs(wxStringList("../../../include", 0)); | |
280 | project.SetLibDirs(wxStringList("../../../lib", 0)); | |
281 | project.SetDebugLibDirs(wxStringList("../../../src/Debug", 0)); | |
282 | project.SetReleaseLibDirs(wxStringList("../../../src/Release", 0)); | |
283 | ||
284 | project.SetProjectName("DialogEdVC"); | |
285 | project.SetTargetName("dialoged"); | |
286 | project.SetProjectPath(dir + wxString("/utils/dialoged/src")); | |
287 | project.SetSourceFiles(wxStringList("dialoged.cpp", "dlghndlr.cpp", "edlist.cpp", "edtree.cpp", | |
288 | "reseditr.cpp", "reswrite.cpp", "symbtabl.cpp", "winstyle.cpp", "winprop.cpp", | |
289 | "dialoged.h", "dlghndlr.h", "edlist.h", "edtree.h", "reseditr.h", "symbtabl.h", "winprop.h", | |
290 | "winstyle.h", | |
291 | 0)); | |
292 | ||
293 | if (!project.GenerateVCProject()) | |
294 | { | |
295 | wxString msg("Could not generate Dialog Editor project"); | |
296 | wxMessageBox(msg); | |
297 | } | |
298 | ||
299 | // Tex2RTF | |
300 | project.SetIncludeDirs(wxStringList("../../../include", 0)); | |
301 | project.SetResourceIncludeDirs(wxStringList("../../../include", 0)); | |
302 | project.SetLibDirs(wxStringList("../../../lib", 0)); | |
303 | project.SetDebugLibDirs(wxStringList("../../../src/Debug", 0)); | |
304 | project.SetReleaseLibDirs(wxStringList("../../../src/Release", 0)); | |
305 | ||
306 | project.SetProjectName("Tex2RTFVC"); | |
307 | project.SetTargetName("tex2rtf"); | |
308 | project.SetProjectPath(dir + wxString("/utils/tex2rtf/src")); | |
309 | project.SetSourceFiles(wxStringList("tex2rtf.cpp", "htmlutil.cpp", "readshg.cpp", "rtfutils.cpp", | |
310 | "table.cpp", "tex2any.cpp", "texutils.cpp", "xlputils.cpp", | |
311 | "bmputils.h", "readshg.h", "rtfutils.h", "table.h", "tex2any.h", "tex2rtf.h", "wxhlpblk.h", | |
312 | 0)); | |
313 | ||
314 | if (!project.GenerateVCProject()) | |
315 | { | |
316 | wxString msg("Could not generate Tex2RTF project"); | |
317 | wxMessageBox(msg); | |
318 | } | |
319 | ||
320 | // Tex2RTF | |
321 | project.SetIncludeDirs(wxStringList("../../../include", 0)); | |
322 | project.SetResourceIncludeDirs(wxStringList("../../../include", 0)); | |
323 | project.SetLibDirs(wxStringList("../../../lib", 0)); | |
324 | project.SetDebugLibDirs(wxStringList("../../../src/Debug", 0)); | |
325 | project.SetReleaseLibDirs(wxStringList("../../../src/Release", 0)); | |
326 | ||
327 | project.SetProjectName("HelpGenVC"); | |
328 | project.SetTargetName("helpgen"); | |
329 | project.SetProjectPath(dir + wxString("/utils/helpgen/src")); | |
330 | project.SetSourceFiles(wxStringList("helpgen.cpp", "cjparser.cpp", "docripper.cpp", "ifcontext.cpp", | |
331 | "markup.cpp", "ripper_main.cpp", "scriptbinder.cpp", "sourcepainter.cpp", | |
332 | "srcparser.cpp", | |
333 | "cjparser.h", "docripper.h", "ifcontext.h", "markup.h", "scriptbinder.h", "sourcepainter.h", | |
334 | "srcparser.h", "wxstlac.h", "wxstllst.h", "wxstlvec.h", 0)); | |
335 | ||
336 | if (!project.GenerateVCProject()) | |
337 | { | |
338 | wxString msg("Could not generate HelpGen project"); | |
339 | wxMessageBox(msg); | |
340 | } | |
341 | ||
342 | // wxTreeLayout sample | |
343 | ||
344 | project.SetIncludeDirs(wxStringList("../../../include", 0)); | |
345 | project.SetResourceIncludeDirs(wxStringList("../../../include", 0)); | |
346 | project.SetLibDirs(wxStringList("../../../lib", 0)); | |
347 | project.SetDebugLibDirs(wxStringList("../../../src/Debug", 0)); | |
348 | project.SetReleaseLibDirs(wxStringList("../../../src/Release", 0)); | |
349 | ||
350 | project.SetProjectName("TreeSampleVC"); | |
351 | project.SetTargetName("test"); | |
352 | project.SetProjectPath(dir + wxString("/utils/wxtree/src")); | |
353 | project.SetSourceFiles(wxStringList("test.cpp", "wxtree.cpp", "test.h", "wxtree.h", 0)); | |
354 | ||
355 | if (!project.GenerateVCProject()) | |
356 | { | |
357 | wxString msg("Could not generate wxTreeLayout project"); | |
358 | wxMessageBox(msg); | |
359 | } | |
360 | ||
361 | // OGLEdit | |
362 | ||
363 | project.SetIncludeDirs(wxStringList("../../../../include", "../../src", 0)); | |
364 | project.SetResourceIncludeDirs(wxStringList("../../../../include", 0)); | |
365 | project.SetLibDirs(wxStringList("../../../../lib", 0)); | |
366 | project.SetDebugLibDirs(wxStringList("../../../../src/Debug", "../../src/Debug", 0)); | |
367 | project.SetReleaseLibDirs(wxStringList("../../../../src/Release", "../../src/Release", 0)); | |
368 | project.SetExtraLibs(wxStringList("ogl.lib", 0)); | |
369 | ||
370 | project.SetProjectName("OGLEditVC"); | |
371 | project.SetTargetName("ogledit"); | |
372 | project.SetProjectPath(dir + wxString("/utils/ogl/samples/ogledit")); | |
373 | project.SetSourceFiles(wxStringList("ogledit.cpp", "doc.cpp", "palette.cpp", "view.cpp", | |
374 | "doc.h", "ogledit.h", "palette.h", "view.h", | |
375 | 0)); | |
376 | ||
377 | if (!project.GenerateVCProject()) | |
378 | { | |
379 | wxString msg("Could not generate OGLEdit project"); | |
380 | wxMessageBox(msg); | |
381 | } | |
382 | ||
383 | // OGL Studio | |
384 | ||
385 | project.SetIncludeDirs(wxStringList("../../../../include", "../../src", 0)); | |
386 | project.SetResourceIncludeDirs(wxStringList("../../../../include", 0)); | |
387 | project.SetLibDirs(wxStringList("../../../../lib", 0)); | |
388 | project.SetDebugLibDirs(wxStringList("../../../../src/Debug", "../../src/Debug", 0)); | |
389 | project.SetReleaseLibDirs(wxStringList("../../../../src/Release", "../../src/Release", 0)); | |
390 | project.SetExtraLibs(wxStringList("ogl.lib", 0)); | |
391 | ||
392 | project.SetProjectName("StudioVC"); | |
393 | project.SetTargetName("studio"); | |
394 | project.SetProjectPath(dir + wxString("/utils/ogl/samples/studio")); | |
395 | project.SetSourceFiles(wxStringList("studio.cpp", "cspalette.cpp", "dialogs.cpp", "view.cpp", | |
396 | "doc.cpp", "mainfrm.cpp", "project.cpp", "shapes.cpp", "symbols.cpp", "csprint.cpp", | |
397 | "studio.h", "cspalette.h", "dialogs.h", "view.h", | |
398 | "doc.h", "mainfrm.h", "project.h", "shapes.h", "symbols.h", | |
399 | 0)); | |
400 | ||
401 | if (!project.GenerateVCProject()) | |
402 | { | |
403 | wxString msg("Could not generate OGL Studio project"); | |
404 | wxMessageBox(msg); | |
405 | } | |
406 | ||
407 | // GLCanvas cube sample | |
408 | ||
409 | project.SetIncludeDirs(wxStringList("../../../../include", "../../win", 0)); | |
410 | project.SetResourceIncludeDirs(wxStringList("../../../../include", 0)); | |
411 | project.SetLibDirs(wxStringList("../../../../lib", 0)); | |
412 | project.SetDebugLibDirs(wxStringList("../../../../src/Debug", "../../win/Debug", 0)); | |
413 | project.SetReleaseLibDirs(wxStringList("../../../../src/Release", "../../win/Release", 0)); | |
414 | project.SetExtraLibs(wxStringList("glcanvas.lib", "opengl32.lib", "glu32.lib", 0)); | |
415 | ||
416 | project.SetProjectName("CubeVC"); | |
417 | project.SetTargetName("cube"); | |
418 | project.SetProjectPath(dir + wxString("/utils/glcanvas/samples/cube")); | |
419 | project.SetSourceFiles(wxStringList("cube.cpp", "cube.h", | |
420 | 0)); | |
421 | ||
422 | if (!project.GenerateVCProject()) | |
423 | { | |
424 | wxString msg("Could not generate GLCanvas Cube project"); | |
425 | wxMessageBox(msg); | |
426 | } | |
427 | ||
428 | // GLCanvas isosurf sample | |
429 | ||
430 | project.SetIncludeDirs(wxStringList("../../../../include", "../../win", 0)); | |
431 | project.SetResourceIncludeDirs(wxStringList("../../../../include", 0)); | |
432 | project.SetLibDirs(wxStringList("../../../../lib", 0)); | |
433 | project.SetDebugLibDirs(wxStringList("../../../../src/Debug", "../../win/Debug", 0)); | |
434 | project.SetReleaseLibDirs(wxStringList("../../../../src/Release", "../../win/Release", 0)); | |
435 | project.SetExtraLibs(wxStringList("glcanvas.lib", "opengl32.lib", "glu32.lib", 0)); | |
436 | ||
437 | project.SetProjectName("IsoSurfVC"); | |
438 | project.SetTargetName("isosurf"); | |
439 | project.SetProjectPath(dir + wxString("/utils/glcanvas/samples/isosurf")); | |
440 | project.SetSourceFiles(wxStringList("isosurf.cpp", "isosurf.h", | |
441 | 0)); | |
442 | ||
443 | if (!project.GenerateVCProject()) | |
444 | { | |
445 | wxString msg("Could not generate GLCanvas IsoSurf project"); | |
446 | wxMessageBox(msg); | |
447 | } | |
448 | ||
449 | // GLCanvas penguin sample | |
450 | ||
451 | project.SetIncludeDirs(wxStringList("../../../../include", "../../win", 0)); | |
452 | project.SetResourceIncludeDirs(wxStringList("../../../../include", 0)); | |
453 | project.SetLibDirs(wxStringList("../../../../lib", 0)); | |
454 | project.SetDebugLibDirs(wxStringList("../../../../src/Debug", "../../win/Debug", 0)); | |
455 | project.SetReleaseLibDirs(wxStringList("../../../../src/Release", "../../win/Release", 0)); | |
456 | project.SetExtraLibs(wxStringList("glcanvas.lib", "opengl32.lib", "glu32.lib", 0)); | |
457 | ||
458 | project.SetProjectName("PenguinVC"); | |
459 | project.SetTargetName("penguin"); | |
460 | project.SetProjectPath(dir + wxString("/utils/glcanvas/samples/penguin")); | |
461 | project.SetSourceFiles(wxStringList("penguin.cpp", "penguin.h", | |
462 | "lw.cpp", "lw.h", | |
463 | "trackball.c", "trackball.h", | |
464 | 0)); | |
465 | ||
466 | if (!project.GenerateVCProject()) | |
467 | { | |
468 | wxString msg("Could not generate GLCanvas Penguin project"); | |
469 | wxMessageBox(msg); | |
470 | } | |
471 | } | |
472 | ||
473 | // ---------------------------------------------------------------------------- | |
474 | // main frame | |
475 | // ---------------------------------------------------------------------------- | |
476 | ||
477 | // frame constructor | |
478 | MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size) | |
479 | : wxFrame((wxFrame *)NULL, -1, title, pos, size) | |
480 | { | |
481 | // set the frame icon | |
482 | SetIcon(wxICON(mondrian)); | |
483 | ||
484 | // create a menu bar | |
485 | wxMenu *menuFile = new wxMenu; | |
486 | ||
487 | menuFile->Append(MakeProject_Generate, "&Generate"); | |
488 | menuFile->Append(MakeProject_About, "&About..."); | |
489 | menuFile->AppendSeparator(); | |
490 | menuFile->Append(MakeProject_Quit, "E&xit"); | |
491 | ||
492 | // now append the freshly created menu to the menu bar... | |
493 | wxMenuBar *menuBar = new wxMenuBar; | |
494 | menuBar->Append(menuFile, "&File"); | |
495 | ||
496 | // ... and attach this menu bar to the frame | |
497 | SetMenuBar(menuBar); | |
498 | ||
499 | // create a status bar just for fun (by default with 1 pane only) | |
500 | CreateStatusBar(2); | |
501 | SetStatusText("Welcome to wxWindows!"); | |
502 | } | |
503 | ||
504 | ||
505 | // event handlers | |
506 | ||
507 | void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event)) | |
508 | { | |
509 | // TRUE is to force the frame to close | |
510 | Close(TRUE); | |
511 | } | |
512 | ||
513 | void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event)) | |
514 | { | |
515 | wxMessageBox("MakeProject: generates VC++ project files", | |
516 | "About MakeProject", wxOK | wxICON_INFORMATION, this); | |
517 | } | |
518 | ||
519 | void MyFrame::OnGenerate(wxCommandEvent& WXUNUSED(event)) | |
520 | { | |
521 | wxGetApp().GenerateSamples("d:/wx2/wxWindows"); | |
522 | } | |
523 | ||
524 | bool MyFrame::GenerateSample(const wxString& projectName, const wxString& targetName, | |
525 | const wxString& path, const wxStringList& sourceFiles) | |
526 | { | |
527 | return wxGetApp().GenerateSample(projectName, targetName, path, sourceFiles); | |
528 | } | |
529 | ||
530 | /* | |
531 | * wxProject | |
532 | */ | |
533 | ||
534 | wxProject::wxProject() | |
535 | { | |
536 | } | |
537 | ||
538 | wxProject::~wxProject() | |
539 | { | |
540 | } | |
541 | ||
542 | ||
543 | bool wxProject::GenerateVCProject() | |
544 | { | |
545 | wxString fullProjectName = m_path + wxString("/") + m_projectName + ".dsp"; | |
546 | ||
547 | ofstream stream(fullProjectName); | |
548 | if (stream.bad()) | |
549 | return FALSE; | |
550 | ||
551 | /////////////////////// General stuff | |
552 | ||
553 | stream << "# Microsoft Developer Studio Project File - Name=\"" << m_projectName << "\" - Package Owner=<4>\n"; | |
554 | stream << "# Microsoft Developer Studio Generated Build File, Format Version 5.00\n"; | |
555 | stream << "# (Actually, generated by MakeProject, (c) Julian Smart, 1998)\n"; | |
556 | stream << "# ** DO NOT EDIT **\n\n"; | |
557 | stream << "# TARGTYPE \"Win32 (x86) Application\" 0x0101\n\n"; | |
558 | stream << "CFG=" << m_projectName << " - Win32 Debug\n"; | |
559 | stream << "!MESSAGE This is not a valid makefile. To build this project using NMAKE,\n"; | |
560 | stream << "!MESSAGE use the Export Makefile command and run\n"; | |
561 | stream << "!MESSAGE\n"; | |
562 | stream << "!MESSAGE NMAKE /f \"" << m_projectName << ".mak\".\n"; | |
563 | stream << "!MESSAGE\n"; | |
564 | stream << "!MESSAGE You can specify a configuration when running NMAKE\n"; | |
565 | stream << "!MESSAGE by defining the macro CFG on the command line. For example:\n"; | |
566 | stream << "!MESSAGE\n"; | |
567 | stream << "!MESSAGE NMAKE /f \"" << m_projectName << ".mak\" CFG=\"" << m_projectName << " - Win32 Debug\"\n"; | |
568 | stream << "!MESSAGE\n"; | |
569 | stream << "!MESSAGE Possible choices for configuration are:\n"; | |
570 | stream << "!MESSAGE\n"; | |
571 | stream << "!MESSAGE \"" << m_projectName << " - Win32 Release\" (based on \"Win32 (x86) Application\")\n"; | |
572 | stream << "!MESSAGE \"" << m_projectName << " - Win32 Debug\" (based on \"Win32 (x86) Application\")\n"; | |
573 | stream << "!MESSAGE \"" << m_projectName << " - Win32 Debug DLL\" (based on \"Win32 (x86) Application\")\n"; | |
574 | stream << "!MESSAGE \"" << m_projectName << " - Win32 Release DLL\" (based on \"Win32 (x86) Application\")\n"; | |
575 | stream << "!MESSAGE\n"; | |
576 | stream << "\n"; | |
577 | stream << "# Begin Project\n"; | |
578 | stream << "# PROP Scc_ProjName \"\"\n"; | |
579 | stream << "# PROP Scc_LocalPath \"\"\n"; | |
580 | stream << "CPP=cl.exe\n"; | |
581 | stream << "MTL=midl.exe\n"; | |
582 | stream << "RSC=rc.exe\n"; | |
583 | stream << "\n"; | |
584 | ||
585 | /////////////////////// Win32 Release target | |
586 | ||
587 | stream << "!IF \"$(CFG)\" == \"" << m_projectName << " - Win32 Release\"\n"; | |
588 | stream << "\n"; | |
589 | stream << "# PROP BASE Use_MFC 0\n"; | |
590 | stream << "# PROP BASE Use_Debug_Libraries 0\n"; | |
591 | stream << "# PROP BASE Output_Dir \"Release\"\n"; | |
592 | stream << "# PROP BASE Intermediate_Dir \"Release\"\n"; | |
593 | stream << "# PROP BASE Target_Dir \"\"\n"; | |
594 | stream << "# PROP Use_MFC 0\n"; | |
595 | stream << "# PROP Use_Debug_Libraries 0\n"; | |
596 | stream << "# PROP Output_Dir \"Release\"\n"; | |
597 | stream << "# PROP Intermediate_Dir \"Release\"\n"; | |
598 | stream << "# PROP Ignore_Export_Lib 0\n"; | |
599 | stream << "# PROP Target_Dir \"\"\n"; | |
600 | stream << "# ADD BASE CPP /nologo /W3 /GX /O2 /D \"WIN32\" /D \"NDEBUG\" /D \"_WINDOWS\" /YX /FD /c\n"; | |
601 | stream << "# ADD CPP /nologo /MD /W3 /GX /O1 /Ob2"; | |
602 | ||
603 | int n = m_includeDirs.Number(); | |
604 | int i; | |
605 | for (i = 0; i < n; i++) | |
606 | { | |
607 | wxString includeDir = m_includeDirs[i]; | |
608 | stream << " /I \"" << includeDir << "\""; | |
609 | } | |
610 | ||
611 | stream << " /D \"NDEBUG\" /D \"WIN32\" /D \"_WINDOWS\" /D \"__WINDOWS__\" /D \"__WXMSW__\" /D \"__WIN95__\" /D \"__WIN32__\" /D WINVER=0x0400 /D \"STRICT\" /FD /c\n"; | |
612 | stream << "# SUBTRACT CPP /YX\n"; | |
613 | stream << "# ADD BASE MTL /nologo /D \"NDEBUG\" /mktyplib203 /o NUL /win32\n"; | |
614 | stream << "# ADD MTL /nologo /D \"NDEBUG\" /mktyplib203 /o NUL /win32\n"; | |
615 | stream << "# ADD BASE RSC /l 0x809 /d \"NDEBUG\"\n"; | |
616 | stream << "# ADD RSC /l 0x809 /d \"NDEBUG\"\n"; | |
617 | stream << "BSC32=bscmake.exe\n"; | |
618 | stream << "# ADD BASE BSC32 /nologo\n"; | |
619 | stream << "# ADD BSC32 /nologo\n"; | |
620 | stream << "LINK32=link.exe\n"; | |
621 | stream << "# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386\n"; | |
622 | stream << "# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wxvc.lib "; | |
623 | n = m_extraLibs.Number(); | |
624 | for (i = 0; i < n; i++) | |
625 | { | |
626 | wxString lib = m_extraLibs[i]; | |
627 | stream << lib << " "; | |
628 | } | |
629 | ||
630 | stream << "/nologo /subsystem:windows /machine:I386 /nodefaultlib:\"libc.lib\" /nodefaultlib:\"libci.lib\" /out:\"Release/" << m_targetName << ".exe\""; | |
631 | ||
632 | n = m_releaseLibDirs.Number(); | |
633 | for (i = 0; i < n; i++) | |
634 | { | |
635 | wxString libDir = m_releaseLibDirs[i]; | |
636 | stream << " /libpath:\"" << libDir << "\""; | |
637 | } | |
638 | n = m_libDirs.Number(); | |
639 | for (i = 0; i < n; i++) | |
640 | { | |
641 | wxString libDir = m_libDirs[i]; | |
642 | stream << " /libpath:\"" << libDir << "\""; | |
643 | } | |
644 | stream << "\n"; | |
645 | stream << "\n"; | |
646 | ||
647 | /////////////////////// Win32 Debug target | |
648 | ||
649 | stream << "!ELSEIF \"$(CFG)\" == \"" << m_projectName << " - Win32 Debug\"\n"; | |
650 | stream << "\n"; | |
651 | stream << "# PROP BASE Use_MFC 0\n"; | |
652 | stream << "# PROP BASE Use_Debug_Libraries 1\n"; | |
653 | stream << "# PROP BASE Output_Dir \"Debug\"\n"; | |
654 | stream << "# PROP BASE Intermediate_Dir \"Debug\"\n"; | |
655 | stream << "# PROP BASE Target_Dir \"\"\n"; | |
656 | stream << "# PROP Use_MFC 0\n"; | |
657 | stream << "# PROP Use_Debug_Libraries 1\n"; | |
658 | stream << "# PROP Output_Dir \"Debug\"\n"; | |
659 | stream << "# PROP Intermediate_Dir \"Debug\"\n"; | |
660 | stream << "# PROP Ignore_Export_Lib 0\n"; | |
661 | stream << "# PROP Target_Dir \"\"\n"; | |
662 | stream << "# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D \"WIN32\" /D \"_DEBUG\" /D \"_WINDOWS\" /YX /FD /c\n"; | |
663 | stream << "# ADD CPP /nologo /MD /W3 /Gm /GX /Zi /Od"; | |
664 | ||
665 | n = m_includeDirs.Number(); | |
666 | for (i = 0; i < n; i++) | |
667 | { | |
668 | wxString includeDir = m_includeDirs[i]; | |
669 | stream << " /I \"" << includeDir << "\""; | |
670 | } | |
671 | ||
672 | stream << " /D \"WIN32\" /D \"_DEBUG\" /D \"_WINDOWS\" /D \"__WINDOWS__\" /D \"__WXMSW__\" /D DEBUG=1 /D \"__WXDEBUG__\" /D \"__WIN95__\" /D \"__WIN32__\" /D WINVER=0x0400 /D \"STRICT\" /Yu\"wx/wxprec.h\" /FD /c\n"; | |
673 | stream << "# ADD BASE MTL /nologo /D \"_DEBUG\" /mktyplib203 /o NUL /win32\n"; | |
674 | stream << "# ADD MTL /nologo /D \"_DEBUG\" /mktyplib203 /o NUL /win32\n"; | |
675 | stream << "# ADD BASE RSC /l 0x809 /d \"_DEBUG\"\n"; | |
676 | stream << "# ADD RSC /l 0x809 /d \"_DEBUG\"\n"; | |
677 | stream << "BSC32=bscmake.exe\n"; | |
678 | stream << "# ADD BASE BSC32 /nologo\n"; | |
679 | stream << "# ADD BSC32 /nologo\n"; | |
680 | stream << "LINK32=link.exe\n"; | |
681 | stream << "# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept\n"; | |
682 | stream << "# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wxvc.lib "; | |
683 | n = m_extraLibs.Number(); | |
684 | for (i = 0; i < n; i++) | |
685 | { | |
686 | wxString lib = m_extraLibs[i]; | |
687 | stream << lib << " "; | |
688 | } | |
689 | stream << "/nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:\"libcd.lib\" /nodefaultlib:\"libcid.lib\" /out:\"Debug/" << m_targetName << ".exe\" /pdbtype:sept"; | |
690 | ||
691 | n = m_debugLibDirs.Number(); | |
692 | for (i = 0; i < n; i++) | |
693 | { | |
694 | wxString libDir = m_debugLibDirs[i]; | |
695 | stream << " /libpath:\"" << libDir << "\""; | |
696 | } | |
697 | n = m_libDirs.Number(); | |
698 | for (i = 0; i < n; i++) | |
699 | { | |
700 | wxString libDir = m_libDirs[i]; | |
701 | stream << " /libpath:\"" << libDir << "\""; | |
702 | } | |
703 | stream << "\n"; | |
704 | stream << "\n"; | |
705 | // stream << "!ENDIF\n"; | |
706 | // stream << "\n"; | |
707 | ||
708 | /////////////////////// Win32 Debug DLL target | |
709 | ||
710 | stream << "!ELSEIF \"$(CFG)\" == \"" << m_projectName << " - Win32 Debug DLL\"\n"; | |
711 | stream << "\n"; | |
712 | stream << "# PROP BASE Use_MFC 0\n"; | |
713 | stream << "# PROP BASE Use_Debug_Libraries 1\n"; | |
714 | stream << "# PROP BASE Output_Dir \"DebugDLL\"\n"; | |
715 | stream << "# PROP BASE Intermediate_Dir \"DebugDLL\"\n"; | |
716 | stream << "# PROP BASE Target_Dir \"\"\n"; | |
717 | stream << "# PROP Use_MFC 0\n"; | |
718 | stream << "# PROP Use_Debug_Libraries 1\n"; | |
719 | stream << "# PROP Output_Dir \"DebugDLL\"\n"; | |
720 | stream << "# PROP Intermediate_Dir \"DebugDLL\"\n"; | |
721 | stream << "# PROP Ignore_Export_Lib 0\n"; | |
722 | stream << "# PROP Target_Dir \"\"\n"; | |
723 | stream << "# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D \"WIN32\" /D \"_DEBUG\" /D \"_WINDOWS\" /YX /FD /c\n"; | |
724 | stream << "# ADD CPP /nologo /MD /W3 /Gm /GX /Zi /Od"; | |
725 | ||
726 | n = m_includeDirs.Number(); | |
727 | for (i = 0; i < n; i++) | |
728 | { | |
729 | wxString includeDir = m_includeDirs[i]; | |
730 | stream << " /I \"" << includeDir << "\""; | |
731 | } | |
732 | ||
733 | stream << " /D \"WIN32\" /D \"_DEBUG\" /D \"_WINDOWS\" /D \"__WINDOWS__\" /D \"__WXMSW__\" /D DEBUG=1 /D \"__WXDEBUG__\" /D \"__WIN95__\" /D \"__WIN32__\" /D WINVER=0x0400 /D \"STRICT\" /D WXUSINGDLL=1 /Yu\"wx/wxprec.h\" /FD /c\n"; | |
734 | stream << "# ADD BASE MTL /nologo /D \"_DEBUG\" /mktyplib203 /o NUL /win32\n"; | |
735 | stream << "# ADD MTL /nologo /D \"_DEBUG\" /mktyplib203 /o NUL /win32\n"; | |
736 | stream << "# ADD BASE RSC /l 0x809 /d \"_DEBUG\"\n"; | |
737 | stream << "# ADD RSC /l 0x809 /d \"_DEBUG\"\n"; | |
738 | stream << "BSC32=bscmake.exe\n"; | |
739 | stream << "# ADD BASE BSC32 /nologo\n"; | |
740 | stream << "# ADD BSC32 /nologo\n"; | |
741 | stream << "LINK32=link.exe\n"; | |
742 | stream << "# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept\n"; | |
743 | stream << "# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wxvc.lib "; | |
744 | n = m_extraLibs.Number(); | |
745 | for (i = 0; i < n; i++) | |
746 | { | |
747 | wxString lib = m_extraLibs[i]; | |
748 | stream << lib << " "; | |
749 | } | |
750 | stream << "/nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:\"libcd.lib\" /nodefaultlib:\"libcid.lib\" /out:\"DebugDLL/" << m_targetName << ".exe\" /pdbtype:sept"; | |
751 | ||
752 | n = m_debugLibDirs.Number(); | |
753 | for (i = 0; i < n; i++) | |
754 | { | |
755 | wxString libDir = m_debugLibDirs[i]; | |
756 | libDir += "DLL"; // Assume that we have e.g. Debug so make it DebugDLL | |
757 | stream << " /libpath:\"" << libDir << "\""; | |
758 | } | |
759 | n = m_libDirs.Number(); | |
760 | for (i = 0; i < n; i++) | |
761 | { | |
762 | wxString libDir = m_libDirs[i]; | |
763 | stream << " /libpath:\"" << libDir << "\""; | |
764 | } | |
765 | stream << "\n"; | |
766 | stream << "\n"; | |
767 | // stream << "!ENDIF\n"; | |
768 | // stream << "\n"; | |
769 | ||
770 | /////////////////////// Win32 Release DLL target | |
771 | ||
772 | stream << "!ELSEIF \"$(CFG)\" == \"" << m_projectName << " - Win32 Release DLL\"\n"; | |
773 | stream << "\n"; | |
774 | stream << "# PROP BASE Use_MFC 0\n"; | |
775 | stream << "# PROP BASE Use_Debug_Libraries 0\n"; | |
776 | stream << "# PROP BASE Output_Dir \"ReleaseDLL\"\n"; | |
777 | stream << "# PROP BASE Intermediate_Dir \"ReleaseDLL\"\n"; | |
778 | stream << "# PROP BASE Target_Dir \"\"\n"; | |
779 | stream << "# PROP Use_MFC 0\n"; | |
780 | stream << "# PROP Use_Debug_Libraries 0\n"; | |
781 | stream << "# PROP Output_Dir \"ReleaseDLL\"\n"; | |
782 | stream << "# PROP Intermediate_Dir \"ReleaseDLL\"\n"; | |
783 | stream << "# PROP Ignore_Export_Lib 0\n"; | |
784 | stream << "# PROP Target_Dir \"\"\n"; | |
785 | stream << "# ADD BASE CPP /nologo /W3 /GX /O2 /D \"WIN32\" /D \"NDEBUG\" /D \"_WINDOWS\" /YX /FD /c\n"; | |
786 | stream << "# ADD CPP /nologo /MD /W3 /GX /O1 /Ob2"; | |
787 | ||
788 | n = m_includeDirs.Number(); | |
789 | for (i = 0; i < n; i++) | |
790 | { | |
791 | wxString includeDir = m_includeDirs[i]; | |
792 | stream << " /I \"" << includeDir << "\""; | |
793 | } | |
794 | ||
795 | stream << " /D \"NDEBUG\" /D \"WIN32\" /D \"_WINDOWS\" /D \"__WINDOWS__\" /D \"__WXMSW__\" /D \"__WIN95__\" /D \"__WIN32__\" /D WINVER=0x0400 /D \"STRICT\" /D WXUSINGDLL=1 /FD /c\n"; | |
796 | stream << "# SUBTRACT CPP /YX\n"; | |
797 | stream << "# ADD BASE MTL /nologo /D \"NDEBUG\" /mktyplib203 /o NUL /win32\n"; | |
798 | stream << "# ADD MTL /nologo /D \"NDEBUG\" /mktyplib203 /o NUL /win32\n"; | |
799 | stream << "# ADD BASE RSC /l 0x809 /d \"NDEBUG\"\n"; | |
800 | stream << "# ADD RSC /l 0x809 /d \"NDEBUG\"\n"; | |
801 | stream << "BSC32=bscmake.exe\n"; | |
802 | stream << "# ADD BASE BSC32 /nologo\n"; | |
803 | stream << "# ADD BSC32 /nologo\n"; | |
804 | stream << "LINK32=link.exe\n"; | |
805 | stream << "# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386\n"; | |
806 | stream << "# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wxvc.lib "; | |
807 | n = m_extraLibs.Number(); | |
808 | for (i = 0; i < n; i++) | |
809 | { | |
810 | wxString lib = m_extraLibs[i]; | |
811 | stream << lib << " "; | |
812 | } | |
813 | stream << "/nologo /subsystem:windows /machine:I386 /nodefaultlib:\"libc.lib\" /nodefaultlib:\"libci.lib\" /out:\"ReleaseDLL/" << m_targetName << ".exe\""; | |
814 | ||
815 | n = m_releaseLibDirs.Number(); | |
816 | for (i = 0; i < n; i++) | |
817 | { | |
818 | wxString libDir = m_releaseLibDirs[i]; | |
819 | libDir += "DLL"; // Assume that we have e.g. Release so make it ReleaseDLL | |
820 | stream << " /libpath:\"" << libDir << "\""; | |
821 | } | |
822 | n = m_libDirs.Number(); | |
823 | for (i = 0; i < n; i++) | |
824 | { | |
825 | wxString libDir = m_libDirs[i]; | |
826 | stream << " /libpath:\"" << libDir << "\""; | |
827 | } | |
828 | stream << "\n"; | |
829 | stream << "\n"; | |
830 | stream << "!ENDIF\n"; | |
831 | stream << "\n"; | |
832 | ||
833 | /////////////////////// Source code for targets | |
834 | ||
835 | stream << "# Begin Target\n"; | |
836 | stream << "\n"; | |
837 | stream << "# Name \"" << m_projectName << " - Win32 Release\"\n"; | |
838 | stream << "# Name \"" << m_projectName << " - Win32 Debug\"\n"; | |
839 | stream << "# Name \"" << m_projectName << " - Win32 Debug DLL\"\n"; | |
840 | stream << "# Name \"" << m_projectName << " - Win32 Release DLL\"\n"; | |
841 | ||
842 | // C++ source files | |
843 | n = m_sourceFiles.Number(); | |
844 | for (i = 0; i < n; i++) | |
845 | { | |
846 | wxString sourceFile = m_sourceFiles[i]; | |
847 | ||
848 | stream << "# Begin Source File\n"; | |
849 | stream << "\n"; | |
850 | stream << "SOURCE=.\\" << sourceFile << "\n"; | |
851 | stream << "\n"; | |
852 | stream << "!IF \"$(CFG)\" == \"" << m_projectName << " - Win32 Release\"\n"; | |
853 | stream << "\n"; | |
854 | stream << "!ELSEIF \"$(CFG)\" == \"" << m_projectName << " - Win32 Debug\"\n"; | |
855 | stream << "\n"; | |
856 | stream << "# SUBTRACT CPP /YX /Yc /Yu\n"; | |
857 | stream << "\n"; | |
858 | stream << "!ELSEIF \"$(CFG)\" == \"" << m_projectName << " - Win32 Debug DLL\"\n"; | |
859 | stream << "\n"; | |
860 | stream << "# SUBTRACT BASE CPP /YX /Yc /Yu\n"; | |
861 | stream << "# SUBTRACT CPP /YX /Yc /Yu\n"; | |
862 | stream << "\n"; | |
863 | stream << "!ELSEIF \"$(CFG)\" == \"" << m_projectName << " - Win32 Release DLL\"\n"; | |
864 | stream << "\n"; | |
865 | stream << "!ENDIF\n"; | |
866 | stream << "\n"; | |
867 | stream << "# End Source File\n"; | |
868 | } | |
869 | ||
870 | // The .rc file: assume it has the target name + rc extension. | |
871 | stream << "# Begin Source File\n"; | |
872 | stream << "\n"; | |
873 | stream << "SOURCE=.\\" << m_targetName << ".rc\n"; | |
874 | stream << "# ADD BASE RSC /l 0x809\n"; | |
875 | stream << "# ADD RSC /l 0x809"; | |
876 | ||
877 | n = m_resourceIncludeDirs.Number(); | |
878 | for (i = 0; i < n; i++) | |
879 | { | |
880 | wxString includeDir = m_resourceIncludeDirs[i]; | |
881 | stream << " /i \"" << includeDir << "\""; | |
882 | } | |
883 | ||
884 | stream << "\n"; | |
885 | stream << "# End Source File\n"; | |
886 | stream << "# End Target\n"; | |
887 | stream << "# End Project\n"; | |
888 | ||
889 | // Now generate the .dsw workspace file | |
890 | ||
891 | wxString fullWorkSpaceName = m_path + wxString("/") + m_projectName + ".dsw"; | |
892 | ||
893 | ofstream stream2(fullWorkSpaceName); | |
894 | if (stream2.bad()) | |
895 | return FALSE; | |
896 | ||
897 | stream2 << "Microsoft Developer Studio Workspace File, Format Version 5.00\n"; | |
898 | stream2 << "# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!\n"; | |
899 | stream2 << "\n"; | |
900 | stream2 << "###############################################################################\n"; | |
901 | stream2 << "\n"; | |
902 | stream2 << "Project: \"" << m_projectName << "\"=.\\" << m_projectName << ".dsp - Package Owner=<4>\n"; | |
903 | stream2 << "\n"; | |
904 | stream2 << "Package=<5>\n"; | |
905 | stream2 << "{{{\n"; | |
906 | stream2 << "}}}\n"; | |
907 | stream2 << "\n"; | |
908 | stream2 << "Package=<4>\n"; | |
909 | stream2 << "{{{\n"; | |
910 | stream2 << "}}}\n"; | |
911 | stream2 << "\n"; | |
912 | stream2 << "###############################################################################\n"; | |
913 | stream2 << "\n"; | |
914 | stream2 << "Global:\n"; | |
915 | stream2 << "\n"; | |
916 | stream2 << "Package=<5>\n"; | |
917 | stream2 << "{{{\n"; | |
918 | stream2 << "}}}\n"; | |
919 | stream2 << "\n"; | |
920 | stream2 << "Package=<3>\n"; | |
921 | stream2 << "{{{\n"; | |
922 | stream2 << "}}}\n"; | |
923 | stream2 << "\n"; | |
924 | stream2 << "###############################################################################\n"; | |
925 | stream2 << "\n"; | |
926 | ||
927 | return TRUE; | |
928 | } | |
929 | ||
930 | BEGIN_EVENT_TABLE(MyDialog, wxDialog) | |
931 | EVT_BUTTON(wxID_EXIT, MyDialog::OnQuit) | |
932 | EVT_BUTTON(ID_GENERATE_PROJECT, MyDialog::OnGenerate) | |
933 | EVT_BUTTON(ID_GENERATE_SAMPLES, MyDialog::OnGenerateSamples) | |
934 | END_EVENT_TABLE() | |
935 | ||
936 | // ---------------------------------------------------------------------------- | |
937 | // main frame | |
938 | // ---------------------------------------------------------------------------- | |
939 | ||
940 | // frame constructor | |
941 | MyDialog::MyDialog(const wxString& title, const wxPoint& pos, const wxSize& size): | |
942 | wxDialog() | |
943 | { | |
944 | LoadFromResource((wxWindow*) NULL, "project_dialog"); | |
945 | ||
946 | } | |
947 | ||
948 | void MyDialog::OnQuit(wxCommandEvent& event) | |
949 | { | |
950 | this->Destroy(); | |
951 | } | |
952 | ||
953 | void MyDialog::OnAbout(wxCommandEvent& event) | |
954 | { | |
955 | } | |
956 | ||
957 | void MyDialog::OnGenerate(wxCommandEvent& event) | |
958 | { | |
959 | } | |
960 | ||
961 | void MyDialog::OnGenerateSamples(wxCommandEvent& event) | |
962 | { | |
963 | char* dir = getenv("WXWIN"); | |
964 | wxString dirStr; | |
965 | if (dir) | |
966 | dirStr = dir; | |
967 | wxTextEntryDialog dialog(this, "Please enter the wxWindows directory", "Text entry", dirStr, wxOK|wxCANCEL); | |
968 | if (dialog.ShowModal() == wxID_OK) | |
969 | { | |
970 | if (wxDirExists(dialog.GetValue())) | |
971 | { | |
972 | // wxGetApp().GenerateSample("MinimalVC", "minimal", dir + wxString("/samples/minimal"), | |
973 | // wxStringList("minimal.cpp", 0)); | |
974 | ||
975 | wxGetApp().GenerateSamples(dialog.GetValue()); | |
976 | } | |
977 | else | |
978 | { | |
979 | wxMessageBox("This directory doesn't exist."); | |
980 | } | |
981 | } | |
982 | } | |
983 |