]> git.saurik.com Git - wxWidgets.git/blob - utils/projgen/makeproj.cpp
Reverted wxString members to const wxChar * for struct BugsGridData
[wxWidgets.git] / utils / projgen / makeproj.cpp
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, const wxString& relativeRootPath = "../..");
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, const wxString& relativeRootPath = "../..");
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 delete dialog;
162
163 return FALSE;
164 }
165
166 bool MyApp::GenerateSample(const wxString& projectName, const wxString& targetName,
167 const wxString& path, const wxStringList& sourceFiles, const wxString& relativeRootPath)
168 {
169 wxString relativeIncludePath(relativeRootPath + wxString("/include"));
170 wxString relativeLibPath(relativeRootPath + wxString("/lib"));
171 wxString relativeDebugPath(relativeRootPath + wxString("/src/Debug"));
172 wxString relativeReleasePath(relativeRootPath + wxString("/src/Release"));
173 wxString relativeDebugPathJPEG(relativeRootPath + wxString("/src/jpeg/Debug"));
174 wxString relativeReleasePathJPEG(relativeRootPath + wxString("/src/jpeg/Release"));
175 wxString relativeDebugPathTIFF(relativeRootPath + wxString("/src/tiff/Debug"));
176 wxString relativeReleasePathTIFF(relativeRootPath + wxString("/src/tiff/Release"));
177
178 wxProject project;
179
180 // For all samples
181 project.SetIncludeDirs(wxStringList((const char*) relativeIncludePath, 0));
182 project.SetResourceIncludeDirs(wxStringList((const char*) relativeIncludePath, 0));
183 project.SetLibDirs(wxStringList((const char*) relativeLibPath, 0));
184 project.SetDebugLibDirs(wxStringList((const char*) relativeDebugPath, (const char*) relativeDebugPathJPEG, (const char*) relativeDebugPathTIFF, 0));
185 project.SetReleaseLibDirs(wxStringList((const char*) relativeReleasePath, (const char*) relativeReleasePathJPEG, (const char*) relativeReleasePathTIFF, 0));
186
187 project.SetProjectName(projectName);
188 project.SetTargetName(targetName);
189 project.SetProjectPath(path);
190 project.SetSourceFiles(sourceFiles);
191
192 if (!project.GenerateVCProject())
193 {
194 wxString msg("Could not generate ");
195 msg += projectName;
196 wxMessageBox(msg);
197 return FALSE;
198 }
199 return TRUE;
200 }
201
202
203 void MyApp::GenerateSamples(const wxString& dir)
204 {
205 // Small bug. Because we don't distinguish between Debug/DebugDLL, Release/ReleaseDLL,
206 // we can't yet make a sample that uses other wxWindows static libraries + the wxWindows DLL library.
207
208 //// Samples
209
210 GenerateSample("CalendarVC", "calendar", dir + wxString("/samples/calendar"), wxStringList("calendar.cpp", 0));
211 GenerateSample("CaretVC", "caret", dir + wxString("/samples/caret"), wxStringList("caret.cpp", 0));
212 GenerateSample("CheckLstVC", "checklst", dir + wxString("/samples/checklst"), wxStringList("checklst.cpp", 0));
213 GenerateSample("ConfigVC", "conftest", dir + wxString("/samples/config"), wxStringList("conftest.cpp", 0));
214 GenerateSample("ControlsVC", "controls", dir + wxString("/samples/controls"), wxStringList("controls.cpp", 0));
215 GenerateSample("DbVC", "dbtest", dir + wxString("/samples/db"),
216 wxStringList("dbtest.cpp", "listdb.cpp", "dbtest.h", "listdb.h", 0));
217 GenerateSample("DialogsVC", "dialogs", dir + wxString("/samples/dialogs"),
218 wxStringList("dialogs.cpp", "dialogs.h", 0));
219 GenerateSample("DndVC", "dnd", dir + wxString("/samples/dnd"), wxStringList("dnd.cpp", 0));
220 GenerateSample("DocViewVC", "docview", dir + wxString("/samples/docview"),
221 wxStringList("docview.cpp", "doc.cpp", "view.cpp", "docview.h", "doc.h", "view.h", 0));
222 GenerateSample("DocVwMDIVC", "docview", dir + wxString("/samples/docvwmdi"),
223 wxStringList("docview.cpp", "doc.cpp", "view.cpp", "docview.h", "doc.h", "view.h", 0));
224 GenerateSample("DynamicVC", "dynamic", dir + wxString("/samples/dynamic"), wxStringList("dynamic.cpp", 0));
225 GenerateSample("DrawingVC", "drawing", dir + wxString("/samples/drawing"), wxStringList("drawing.cpp", 0));
226 GenerateSample("ExecVC", "exec", dir + wxString("/samples/exec"), wxStringList("exec.cpp", 0));
227 GenerateSample("GridVC", "test", dir + wxString("/samples/grid"), wxStringList("test.cpp", 0));
228 GenerateSample("NewGridVC", "griddemo", dir + wxString("/samples/newgrid"), wxStringList("griddemo.cpp", 0));
229 GenerateSample("HelpVC", "demo", dir + wxString("/samples/help"), wxStringList("demo.cpp", 0));
230
231 // wxHTML samples
232 GenerateSample("AboutVC", "about", dir + wxString("/samples/html/about"), wxStringList("about.cpp", 0),
233 "../../..");
234 GenerateSample("HelpVC", "help", dir + wxString("/samples/html/help"), wxStringList("help.cpp", 0),
235 "../../..");
236 GenerateSample("PrintingVC", "printing", dir + wxString("/samples/html/printing"), wxStringList("printing.cpp", 0),
237 "../../..");
238 GenerateSample("TestVC", "test", dir + wxString("/samples/html/test"), wxStringList("test.cpp", 0),
239 "../../..");
240 GenerateSample("VirtualVC", "virtual", dir + wxString("/samples/html/virtual"), wxStringList("virtual.cpp", 0),
241 "../../..");
242 GenerateSample("WidgetVC", "widget", dir + wxString("/samples/html/widget"), wxStringList("widget.cpp", 0),
243 "../../..");
244 GenerateSample("ZipVC", "zip", dir + wxString("/samples/html/zip"), wxStringList("zip.cpp", 0),
245 "../../..");
246 GenerateSample("HelpViewVC", "helpview", dir + wxString("/samples/html/helpview"), wxStringList("helpview.cpp", 0),
247 "../../..");
248
249 GenerateSample("ImageVC", "image", dir + wxString("/samples/image"), wxStringList("image.cpp", 0));
250 GenerateSample("InternatVC", "internat", dir + wxString("/samples/internat"), wxStringList("internat.cpp", 0));
251 GenerateSample("JoytestVC", "joytest", dir + wxString("/samples/joytest"), wxStringList("joytest.cpp", "joytest.h", 0));
252 GenerateSample("LayoutVC", "layout", dir + wxString("/samples/layout"), wxStringList("layout.cpp", "layout.h", 0));
253 GenerateSample("ListctrlVC", "listtest", dir + wxString("/samples/listctrl"), wxStringList("listtest.cpp", "listtest.h", 0));
254 GenerateSample("MdiVC", "mdi", dir + wxString("/samples/mdi"), wxStringList("mdi.cpp", "mdi.h", 0));
255 GenerateSample("MemcheckVC", "memcheck", dir + wxString("/samples/memcheck"), wxStringList("memcheck.cpp", 0));
256 // Note: MFC sample will be different.
257 GenerateSample("MfcVC", "mfc", dir + wxString("/samples/mfc"), wxStringList("mfctest.cpp", "mfctest.h", 0));
258 GenerateSample("MiniframVC", "test", dir + wxString("/samples/minifram"), wxStringList("test.cpp", "test.h", 0));
259 GenerateSample("MinimalVC", "minimal", dir + wxString("/samples/minimal"), wxStringList("minimal.cpp", 0));
260 GenerateSample("NativdlgVC", "nativdlg", dir + wxString("/samples/nativdlg"), wxStringList("nativdlg.cpp", "nativdlg.h", "resource.h", 0));
261 GenerateSample("DialupVC", "nettest", dir + wxString("/samples/dialup"), wxStringList("nettest.cpp", 0));
262 GenerateSample("NotebookVC", "test", dir + wxString("/samples/notebook"), wxStringList("test.cpp", "test.h", 0));
263 GenerateSample("OleautoVC", "oleauto", dir + wxString("/samples/oleauto"), wxStringList("oleauto.cpp", 0));
264 GenerateSample("OwnerdrwVC", "ownerdrw", dir + wxString("/samples/ownerdrw"), wxStringList("ownerdrw.cpp", 0));
265 GenerateSample("PngVC", "pngdemo", dir + wxString("/samples/png"), wxStringList("pngdemo.cpp", "pngdemo.h", 0));
266 GenerateSample("PrintingVC", "printing", dir + wxString("/samples/printing"), wxStringList("printing.cpp", "printing.h", 0));
267 GenerateSample("ProplistVC", "test", dir + wxString("/samples/proplist"), wxStringList("test.cpp", "test.h", 0));
268 GenerateSample("PropsizeVC", "propsize", dir + wxString("/samples/propsize"), wxStringList("propsize.cpp", 0));
269 GenerateSample("RegtestVC", "regtest", dir + wxString("/samples/regtest"), wxStringList("regtest.cpp", 0));
270 GenerateSample("ResourceVC", "resource", dir + wxString("/samples/resource"), wxStringList("resource.cpp", "resource.h", 0));
271 GenerateSample("RichEditVC", "wxLayout", dir + wxString("/samples/richedit"), wxStringList("wxLayout.cpp",
272 "kbList.cpp", "wxllist.cpp", "wxlparser.cpp", "wxlwindow.cpp", 0));
273 GenerateSample("SashtestVC", "sashtest", dir + wxString("/samples/sashtest"), wxStringList("sashtest.cpp", "sashtest.h", 0));
274 GenerateSample("ScrollVC", "scroll", dir + wxString("/samples/scroll"), wxStringList("scroll.cpp", 0));
275 GenerateSample("ScrollsubVC", "scrollsub", dir + wxString("/samples/scrollsub"), wxStringList("scrollsub.cpp", 0));
276 GenerateSample("SplitterVC", "test", dir + wxString("/samples/splitter"), wxStringList("test.cpp", 0));
277 GenerateSample("TabVC", "test", dir + wxString("/samples/tab"), wxStringList("test.cpp", "test.h", 0));
278 GenerateSample("TaskbarVC", "tbtest", dir + wxString("/samples/taskbar"), wxStringList("tbtest.cpp", "tbtest.h", 0));
279 GenerateSample("TextVC", "text", dir + wxString("/samples/text"), wxStringList("text.cpp", 0));
280 GenerateSample("ThreadVC", "test", dir + wxString("/samples/thread"), wxStringList("test.cpp", 0));
281 GenerateSample("ToolbarVC", "toolbar", dir + wxString("/samples/toolbar"), wxStringList("toolbar.cpp", 0));
282 GenerateSample("TreectrlVC", "treetest", dir + wxString("/samples/treectrl"), wxStringList("treetest.cpp", "treetest.h", 0));
283 GenerateSample("TypetestVC", "typetest", dir + wxString("/samples/typetest"), wxStringList("typetest.cpp", "typetest.h", 0));
284 GenerateSample("ValidateVC", "validate", dir + wxString("/samples/validate"), wxStringList("validate.cpp", "validate.h", 0));
285 GenerateSample("ClientVC", "client", dir + wxString("/samples/sockets"), wxStringList("client.cpp", 0));
286 GenerateSample("ServerVC", "server", dir + wxString("/samples/sockets"), wxStringList("server.cpp", 0));
287 GenerateSample("ClientVC", "client", dir + wxString("/samples/ipc"), wxStringList("client.cpp", "client.h", "ddesetup.h", 0));
288 GenerateSample("ServerVC", "server", dir + wxString("/samples/ipc"), wxStringList("server.cpp", "server.h", "ddesetup.h", 0));
289 GenerateSample("CaretVC", "caret", dir + wxString("/samples/caret"), wxStringList("caret.cpp", 0));
290 GenerateSample("DrawingVC", "drawing", dir + wxString("/samples/drawing"), wxStringList("drawing.cpp", 0));
291 GenerateSample("ScrollVC", "scroll", dir + wxString("/samples/scroll"), wxStringList("scroll.cpp", 0));
292 GenerateSample("WizardVC", "wiztest", dir + wxString("/samples/wizard"), wxStringList("wiztest.cpp", 0));
293 GenerateSample("RotateVC", "rotate", dir + wxString("/samples/rotate"), wxStringList("rotate.cpp", 0));
294 GenerateSample("ExecVC", "exec", dir + wxString("/samples/exec"), wxStringList("exec.cpp", 0));
295 GenerateSample("FontVC", "font", dir + wxString("/samples/font"), wxStringList("font.cpp", 0));
296 GenerateSample("MenuVC", "menu", dir + wxString("/samples/menu"), wxStringList("menu.cpp", 0));
297
298 //// Demos
299
300 GenerateSample("BombsVC", "bombs", dir + wxString("/demos/bombs"),
301 wxStringList("bombs.cpp", "bombs1.cpp", "game.cpp", "bombs.h", "game.h", 0));
302
303 GenerateSample("FortyVC", "forty", dir + wxString("/demos/forty"),
304 wxStringList("forty.cpp", "canvas.cpp", "card.cpp", "game.cpp", "pile.cpp", "playerdg.cpp", "scoredg.cpp", "scorefil.cpp",
305 "canvas.h", "forty.h", "card.h", "game.h", "pile.h", "playerdg.h", "scoredg.h", "scorefil.h",
306 0));
307
308 GenerateSample("FractalVC", "fractal", dir + wxString("/demos/fractal"), wxStringList("fractal.cpp", 0));
309
310 GenerateSample("LifeVC", "life", dir + wxString("/demos/life"),
311 wxStringList("life.cpp", "game.cpp", "dialogs.cpp", "life.h", "game.h", "dialogs.h", 0));
312
313 GenerateSample("PoemVC", "wxpoem", dir + wxString("/demos/poem"), wxStringList("wxpoem.cpp", "wxpoem.h", 0));
314
315 GenerateSample("DbbrowseVC", "dbbrowse", dir + wxString("/demos/dbbrowse"),
316 wxStringList("dbbrowse.cpp", "browsedb.cpp", "dbgrid.cpp", "dbtree.cpp", "dlguser.cpp", "doc.cpp",
317 "pgmctrl.cpp", "tabpgwin.cpp",
318 "dbbrowse.h", "browsedb.h", "dbgrid.h", "dbtree.h", "dlguser.h", "doc.h", "pgmctrl.h", "std.h", "tabpgwin.h",
319 0));
320
321 //// Utilities
322
323 // Dialog Editor
324 wxProject project;
325
326 project.SetIncludeDirs(wxStringList("../../../include", 0));
327 project.SetResourceIncludeDirs(wxStringList("../../../include", 0));
328 project.SetLibDirs(wxStringList("../../../lib", 0));
329 project.SetDebugLibDirs(wxStringList("../../../src/Debug", "../../../src/jpeg/Debug", "../../../src/tiff/Debug", 0));
330 project.SetReleaseLibDirs(wxStringList("../../../src/Release", "../../../src/jpeg/Release", "../../../src/tiff/Release", 0));
331
332 project.SetProjectName("DialogEdVC");
333 project.SetTargetName("dialoged");
334 project.SetProjectPath(dir + wxString("/utils/dialoged/src"));
335 project.SetSourceFiles(wxStringList("dialoged.cpp", "dlghndlr.cpp", "edlist.cpp", "edtree.cpp",
336 "reseditr.cpp", "reswrite.cpp", "symbtabl.cpp", "winstyle.cpp", "winprop.cpp",
337 "dialoged.h", "dlghndlr.h", "edlist.h", "edtree.h", "reseditr.h", "symbtabl.h", "winprop.h",
338 "winstyle.h",
339 0));
340
341 if (!project.GenerateVCProject())
342 {
343 wxString msg("Could not generate Dialog Editor project");
344 wxMessageBox(msg);
345 }
346
347 // Tex2RTF
348 project.SetIncludeDirs(wxStringList("../../../include", 0));
349 project.SetResourceIncludeDirs(wxStringList("../../../include", 0));
350 project.SetLibDirs(wxStringList("../../../lib", 0));
351 project.SetDebugLibDirs(wxStringList("../../../src/Debug", "../../../src/jpeg/Debug", "../../../src/tiff/Debug", 0));
352 project.SetReleaseLibDirs(wxStringList("../../../src/Release", "../../../src/jpeg/Release", "../../../src/tiff/Release", 0));
353
354 project.SetProjectName("Tex2RTFVC");
355 project.SetTargetName("tex2rtf");
356 project.SetProjectPath(dir + wxString("/utils/tex2rtf/src"));
357 project.SetSourceFiles(wxStringList("tex2rtf.cpp", "htmlutil.cpp", "readshg.cpp", "rtfutils.cpp",
358 "table.cpp", "tex2any.cpp", "texutils.cpp", "xlputils.cpp",
359 "bmputils.h", "readshg.h", "rtfutils.h", "table.h", "tex2any.h", "tex2rtf.h", "wxhlpblk.h",
360 0));
361
362 if (!project.GenerateVCProject())
363 {
364 wxString msg("Could not generate Tex2RTF project");
365 wxMessageBox(msg);
366 }
367
368 // HelpGen
369 project.SetIncludeDirs(wxStringList("../../../include", 0));
370 project.SetResourceIncludeDirs(wxStringList("../../../include", 0));
371 project.SetLibDirs(wxStringList("../../../lib", 0));
372 project.SetDebugLibDirs(wxStringList("../../../src/Debug", "../../../src/jpeg/Debug", "../../../src/tiff/Debug", 0));
373 project.SetReleaseLibDirs(wxStringList("../../../src/Release", "../../../src/jpeg/Release", "../../../src/tiff/Release", 0));
374
375 project.SetProjectName("HelpGenVC");
376 project.SetTargetName("helpgen");
377 project.SetProjectPath(dir + wxString("/utils/helpgen/src"));
378 project.SetSourceFiles(wxStringList("helpgen.cpp", "cjparser.cpp", "docripper.cpp", "ifcontext.cpp",
379 "markup.cpp", "ripper_main.cpp", "scriptbinder.cpp", "sourcepainter.cpp",
380 "srcparser.cpp",
381 "cjparser.h", "docripper.h", "ifcontext.h", "markup.h", "scriptbinder.h", "sourcepainter.h",
382 "srcparser.h", "wxstlac.h", "wxstllst.h", "wxstlvec.h", 0));
383
384 if (!project.GenerateVCProject())
385 {
386 wxString msg("Could not generate HelpGen project");
387 wxMessageBox(msg);
388 }
389
390 // ProjGen
391 project.SetIncludeDirs(wxStringList("../../include", 0));
392 project.SetResourceIncludeDirs(wxStringList("../../include", 0));
393 project.SetLibDirs(wxStringList("../../lib", 0));
394 project.SetDebugLibDirs(wxStringList("../../src/Debug", "../../src/jpeg/Debug", "../../src/tiff/Debug", 0));
395 project.SetReleaseLibDirs(wxStringList("../../src/Release", "../../src/jpeg/Release", "../../src/tiff/Release", 0));
396
397 project.SetProjectName("ProjGenVC");
398 project.SetTargetName("makeproj");
399 project.SetProjectPath(dir + wxString("/utils/projgen"));
400 project.SetSourceFiles(wxStringList("makeproj.cpp", "makeproj.h", 0));
401
402 if (!project.GenerateVCProject())
403 {
404 wxString msg("Could not generate ProjGen project");
405 wxMessageBox(msg);
406 }
407
408 // hhp2cached
409 project.SetIncludeDirs(wxStringList("../../include", 0));
410 project.SetResourceIncludeDirs(wxStringList("../../include", 0));
411 project.SetLibDirs(wxStringList("../../lib", 0));
412 project.SetDebugLibDirs(wxStringList("../../src/Debug", "../../src/jpeg/Debug", "../../src/tiff/Debug", 0));
413 project.SetReleaseLibDirs(wxStringList("../../src/Release", "../../src/jpeg/Release", "../../src/tiff/Release", 0));
414
415 project.SetProjectName("hhp2cachedVC");
416 project.SetTargetName("hhp2cached");
417 project.SetProjectPath(dir + wxString("/utils/hhp2cached"));
418 project.SetSourceFiles(wxStringList("hhp2cached.cpp", 0));
419
420 if (!project.GenerateVCProject())
421 {
422 wxString msg("Could not generate hhp2cached project");
423 wxMessageBox(msg);
424 }
425
426 // wxTreeLayout sample
427
428 project.SetIncludeDirs(wxStringList("../../../include", 0));
429 project.SetResourceIncludeDirs(wxStringList("../../../include", 0));
430 project.SetLibDirs(wxStringList("../../../lib", 0));
431 project.SetDebugLibDirs(wxStringList("../../../src/Debug", "../../../src/jpeg/Debug", "../../../src/tiff/Debug", 0));
432 project.SetReleaseLibDirs(wxStringList("../../../src/Release", "../../../src/jpeg/Release", "../../../src/tiff/Release", 0));
433
434 project.SetProjectName("TreeSampleVC");
435 project.SetTargetName("test");
436 project.SetProjectPath(dir + wxString("/utils/wxtree/src"));
437 project.SetSourceFiles(wxStringList("test.cpp", "wxtree.cpp", "test.h", "wxtree.h", 0));
438
439 if (!project.GenerateVCProject())
440 {
441 wxString msg("Could not generate wxTreeLayout project");
442 wxMessageBox(msg);
443 }
444
445 // OGLEdit
446
447 project.SetIncludeDirs(wxStringList("../../../../include", "../../src", 0));
448 project.SetResourceIncludeDirs(wxStringList("../../../../include", 0));
449 project.SetLibDirs(wxStringList("../../../../lib", 0));
450 project.SetDebugLibDirs(wxStringList("../../../../src/Debug", "../../src/Debug", "../../../../src/jpeg/Debug", "../../../../src/tiff/Debug", 0));
451 project.SetReleaseLibDirs(wxStringList("../../../../src/Release", "../../src/Release", "../../../../src/jpeg/Release", "../../../../src/tiff/Release", 0));
452
453 project.SetExtraLibs(wxStringList("ogl.lib", 0));
454
455 project.SetProjectName("OGLEditVC");
456 project.SetTargetName("ogledit");
457 project.SetProjectPath(dir + wxString("/utils/ogl/samples/ogledit"));
458 project.SetSourceFiles(wxStringList("ogledit.cpp", "doc.cpp", "palette.cpp", "view.cpp",
459 "doc.h", "ogledit.h", "palette.h", "view.h",
460 0));
461
462 if (!project.GenerateVCProject())
463 {
464 wxString msg("Could not generate OGLEdit project");
465 wxMessageBox(msg);
466 }
467
468 // OGL Studio
469
470 project.SetIncludeDirs(wxStringList("../../../../include", "../../src", 0));
471 project.SetResourceIncludeDirs(wxStringList("../../../../include", 0));
472 project.SetLibDirs(wxStringList("../../../../lib", 0));
473 project.SetDebugLibDirs(wxStringList("../../../../src/Debug", "../../src/Debug", "../../../../src/jpeg/Debug", "../../../../src/tiff/Debug", 0));
474 project.SetReleaseLibDirs(wxStringList("../../../../src/Release", "../../src/Release", "../../../../src/jpeg/Release", "../../../../src/tiff/Release", 0));
475 project.SetExtraLibs(wxStringList("ogl.lib", 0));
476
477 project.SetProjectName("StudioVC");
478 project.SetTargetName("studio");
479 project.SetProjectPath(dir + wxString("/utils/ogl/samples/studio"));
480 project.SetSourceFiles(wxStringList("studio.cpp", "cspalette.cpp", "dialogs.cpp", "view.cpp",
481 "doc.cpp", "mainfrm.cpp", "project.cpp", "shapes.cpp", "symbols.cpp", "csprint.cpp",
482 "studio.h", "cspalette.h", "dialogs.h", "view.h",
483 "doc.h", "mainfrm.h", "project.h", "shapes.h", "symbols.h",
484 0));
485
486 if (!project.GenerateVCProject())
487 {
488 wxString msg("Could not generate OGL Studio project");
489 wxMessageBox(msg);
490 }
491
492 // GLCanvas cube sample
493
494 project.SetIncludeDirs(wxStringList("../../../../include", "../../win", 0));
495 project.SetResourceIncludeDirs(wxStringList("../../../../include", 0));
496 project.SetLibDirs(wxStringList("../../../../lib", 0));
497 project.SetDebugLibDirs(wxStringList("../../../../src/Debug", "../../win/Debug", "../../../../src/jpeg/Debug", "../../../../src/tiff/Debug", 0));
498 project.SetReleaseLibDirs(wxStringList("../../../../src/Release", "../../win/Release", "../../../../src/jpeg/Release", "../../../../src/tiff/Release", 0));
499
500 project.SetExtraLibs(wxStringList("glcanvas.lib", "opengl32.lib", "glu32.lib", 0));
501
502 project.SetProjectName("CubeVC");
503 project.SetTargetName("cube");
504 project.SetProjectPath(dir + wxString("/utils/glcanvas/samples/cube"));
505 project.SetSourceFiles(wxStringList("cube.cpp", "cube.h",
506 0));
507
508 if (!project.GenerateVCProject())
509 {
510 wxString msg("Could not generate GLCanvas Cube project");
511 wxMessageBox(msg);
512 }
513
514 // GLCanvas isosurf sample
515
516 project.SetIncludeDirs(wxStringList("../../../../include", "../../win", 0));
517 project.SetResourceIncludeDirs(wxStringList("../../../../include", 0));
518 project.SetLibDirs(wxStringList("../../../../lib", 0));
519 project.SetDebugLibDirs(wxStringList("../../../../src/Debug", "../../win/Debug", "../../../../src/jpeg/Debug", "../../../../src/tiff/Debug", 0));
520 project.SetReleaseLibDirs(wxStringList("../../../../src/Release", "../../win/Release", "../../../../src/jpeg/Release", "../../../../src/tiff/Release", 0));
521 project.SetExtraLibs(wxStringList("glcanvas.lib", "opengl32.lib", "glu32.lib", 0));
522
523 project.SetProjectName("IsoSurfVC");
524 project.SetTargetName("isosurf");
525 project.SetProjectPath(dir + wxString("/utils/glcanvas/samples/isosurf"));
526 project.SetSourceFiles(wxStringList("isosurf.cpp", "isosurf.h",
527 0));
528
529 if (!project.GenerateVCProject())
530 {
531 wxString msg("Could not generate GLCanvas IsoSurf project");
532 wxMessageBox(msg);
533 }
534
535 // GLCanvas penguin sample
536
537 project.SetIncludeDirs(wxStringList("../../../../include", "../../win", 0));
538 project.SetResourceIncludeDirs(wxStringList("../../../../include", 0));
539 project.SetLibDirs(wxStringList("../../../../lib", 0));
540 project.SetDebugLibDirs(wxStringList("../../../../src/Debug", "../../win/Debug", "../../../../src/jpeg/Debug", "../../../../src/tiff/Debug", 0));
541 project.SetReleaseLibDirs(wxStringList("../../../../src/Release", "../../win/Release", "../../../../src/jpeg/Release", "../../../../src/tiff/Release", 0));
542 project.SetExtraLibs(wxStringList("glcanvas.lib", "opengl32.lib", "glu32.lib", 0));
543
544 project.SetProjectName("PenguinVC");
545 project.SetTargetName("penguin");
546 project.SetProjectPath(dir + wxString("/utils/glcanvas/samples/penguin"));
547 project.SetSourceFiles(wxStringList("penguin.cpp", "penguin.h",
548 "lw.cpp", "lw.h",
549 "trackball.c", "trackball.h",
550 0));
551
552 if (!project.GenerateVCProject())
553 {
554 wxString msg("Could not generate GLCanvas Penguin project");
555 wxMessageBox(msg);
556 }
557 }
558
559 // ----------------------------------------------------------------------------
560 // main frame
561 // ----------------------------------------------------------------------------
562
563 // frame constructor
564 MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
565 : wxFrame((wxFrame *)NULL, -1, title, pos, size)
566 {
567 // set the frame icon
568 SetIcon(wxICON(mondrian));
569
570 // create a menu bar
571 wxMenu *menuFile = new wxMenu;
572
573 menuFile->Append(MakeProject_Generate, "&Generate");
574 menuFile->Append(MakeProject_About, "&About...");
575 menuFile->AppendSeparator();
576 menuFile->Append(MakeProject_Quit, "E&xit");
577
578 // now append the freshly created menu to the menu bar...
579 wxMenuBar *menuBar = new wxMenuBar;
580 menuBar->Append(menuFile, "&File");
581
582 // ... and attach this menu bar to the frame
583 SetMenuBar(menuBar);
584
585 // create a status bar just for fun (by default with 1 pane only)
586 CreateStatusBar(2);
587 SetStatusText("Welcome to wxWindows!");
588 }
589
590
591 // event handlers
592
593 void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
594 {
595 // TRUE is to force the frame to close
596 Close(TRUE);
597 }
598
599 void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
600 {
601 wxMessageBox("MakeProject: generates VC++ project files",
602 "About MakeProject", wxOK | wxICON_INFORMATION, this);
603 }
604
605 void MyFrame::OnGenerate(wxCommandEvent& WXUNUSED(event))
606 {
607 wxGetApp().GenerateSamples("d:/wx2/wxWindows");
608 }
609
610 bool MyFrame::GenerateSample(const wxString& projectName, const wxString& targetName,
611 const wxString& path, const wxStringList& sourceFiles, const wxString& relativeRootPath)
612 {
613 return wxGetApp().GenerateSample(projectName, targetName, path, sourceFiles, relativeRootPath);
614 }
615
616 /*
617 * wxProject
618 */
619
620 wxProject::wxProject()
621 {
622 }
623
624 wxProject::~wxProject()
625 {
626 }
627
628
629 bool wxProject::GenerateVCProject()
630 {
631 wxString fullProjectName = m_path + wxString("/") + m_projectName + ".dsp";
632
633 ofstream stream(fullProjectName);
634 if (stream.bad())
635 return FALSE;
636
637 /////////////////////// General stuff
638
639 stream << "# Microsoft Developer Studio Project File - Name=\"" << m_projectName << "\" - Package Owner=<4>\n";
640 stream << "# Microsoft Developer Studio Generated Build File, Format Version 5.00\n";
641 stream << "# (Actually, generated by MakeProject, (c) Julian Smart, 1998)\n";
642 stream << "# ** DO NOT EDIT **\n\n";
643 stream << "# TARGTYPE \"Win32 (x86) Application\" 0x0101\n\n";
644 stream << "CFG=" << m_projectName << " - Win32 Debug\n";
645 stream << "!MESSAGE This is not a valid makefile. To build this project using NMAKE,\n";
646 stream << "!MESSAGE use the Export Makefile command and run\n";
647 stream << "!MESSAGE\n";
648 stream << "!MESSAGE NMAKE /f \"" << m_projectName << ".mak\".\n";
649 stream << "!MESSAGE\n";
650 stream << "!MESSAGE You can specify a configuration when running NMAKE\n";
651 stream << "!MESSAGE by defining the macro CFG on the command line. For example:\n";
652 stream << "!MESSAGE\n";
653 stream << "!MESSAGE NMAKE /f \"" << m_projectName << ".mak\" CFG=\"" << m_projectName << " - Win32 Debug\"\n";
654 stream << "!MESSAGE\n";
655 stream << "!MESSAGE Possible choices for configuration are:\n";
656 stream << "!MESSAGE\n";
657 stream << "!MESSAGE \"" << m_projectName << " - Win32 Release\" (based on \"Win32 (x86) Application\")\n";
658 stream << "!MESSAGE \"" << m_projectName << " - Win32 Debug\" (based on \"Win32 (x86) Application\")\n";
659 stream << "!MESSAGE \"" << m_projectName << " - Win32 Debug DLL\" (based on \"Win32 (x86) Application\")\n";
660 stream << "!MESSAGE \"" << m_projectName << " - Win32 Release DLL\" (based on \"Win32 (x86) Application\")\n";
661 stream << "!MESSAGE\n";
662 stream << "\n";
663 stream << "# Begin Project\n";
664 stream << "# PROP Scc_ProjName \"\"\n";
665 stream << "# PROP Scc_LocalPath \"\"\n";
666 stream << "CPP=cl.exe\n";
667 stream << "MTL=midl.exe\n";
668 stream << "RSC=rc.exe\n";
669 stream << "\n";
670
671 /////////////////////// Win32 Release target
672
673 stream << "!IF \"$(CFG)\" == \"" << m_projectName << " - Win32 Release\"\n";
674 stream << "\n";
675 stream << "# PROP BASE Use_MFC 0\n";
676 stream << "# PROP BASE Use_Debug_Libraries 0\n";
677 stream << "# PROP BASE Output_Dir \"Release\"\n";
678 stream << "# PROP BASE Intermediate_Dir \"Release\"\n";
679 stream << "# PROP BASE Target_Dir \"\"\n";
680 stream << "# PROP Use_MFC 0\n";
681 stream << "# PROP Use_Debug_Libraries 0\n";
682 stream << "# PROP Output_Dir \"Release\"\n";
683 stream << "# PROP Intermediate_Dir \"Release\"\n";
684 stream << "# PROP Ignore_Export_Lib 0\n";
685 stream << "# PROP Target_Dir \"\"\n";
686 stream << "# ADD BASE CPP /nologo /W3 /GX /O2 /D \"WIN32\" /D \"NDEBUG\" /D \"_WINDOWS\" /YX /FD /c\n";
687 stream << "# ADD CPP /nologo /MD /W3 /GX /O1 /Ob2";
688
689 int n = m_includeDirs.Number();
690 int i;
691 for (i = 0; i < n; i++)
692 {
693 wxString includeDir = m_includeDirs[i];
694 stream << " /I \"" << includeDir << "\"";
695 }
696
697 stream << " /D \"NDEBUG\" /D \"WIN32\" /D \"_WINDOWS\" /D \"__WINDOWS__\" /D \"__WXMSW__\" /D \"__WIN95__\" /D \"__WIN32__\" /D WINVER=0x0400 /D \"STRICT\" /FD /c\n";
698 stream << "# SUBTRACT CPP /YX\n";
699 stream << "# ADD BASE MTL /nologo /D \"NDEBUG\" /mktyplib203 /o NUL /win32\n";
700 stream << "# ADD MTL /nologo /D \"NDEBUG\" /mktyplib203 /o NUL /win32\n";
701 stream << "# ADD BASE RSC /l 0x809 /d \"NDEBUG\"\n";
702 stream << "# ADD RSC /l 0x809 /d \"NDEBUG\"\n";
703 stream << "BSC32=bscmake.exe\n";
704 stream << "# ADD BASE BSC32 /nologo\n";
705 stream << "# ADD BSC32 /nologo\n";
706 stream << "LINK32=link.exe\n";
707 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 wsock32.lib /nologo /subsystem:windows /machine:I386\n";
708 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 wsock32.lib wxvc.lib jpeg.lib tiff.lib ";
709 n = m_extraLibs.Number();
710 for (i = 0; i < n; i++)
711 {
712 wxString lib = m_extraLibs[i];
713 stream << lib << " ";
714 }
715
716 stream << "/nologo /subsystem:windows /machine:I386 /nodefaultlib:\"libc.lib,libci.lib,msvcrtd.lib\" /out:\"Release/" << m_targetName << ".exe\"";
717
718 n = m_releaseLibDirs.Number();
719 for (i = 0; i < n; i++)
720 {
721 wxString libDir = m_releaseLibDirs[i];
722 stream << " /libpath:\"" << libDir << "\"";
723 }
724 n = m_libDirs.Number();
725 for (i = 0; i < n; i++)
726 {
727 wxString libDir = m_libDirs[i];
728 stream << " /libpath:\"" << libDir << "\"";
729 }
730 stream << "\n";
731 stream << "\n";
732
733 /////////////////////// Win32 Debug target
734
735 stream << "!ELSEIF \"$(CFG)\" == \"" << m_projectName << " - Win32 Debug\"\n";
736 stream << "\n";
737 stream << "# PROP BASE Use_MFC 0\n";
738 stream << "# PROP BASE Use_Debug_Libraries 1\n";
739 stream << "# PROP BASE Output_Dir \"Debug\"\n";
740 stream << "# PROP BASE Intermediate_Dir \"Debug\"\n";
741 stream << "# PROP BASE Target_Dir \"\"\n";
742 stream << "# PROP Use_MFC 0\n";
743 stream << "# PROP Use_Debug_Libraries 1\n";
744 stream << "# PROP Output_Dir \"Debug\"\n";
745 stream << "# PROP Intermediate_Dir \"Debug\"\n";
746 stream << "# PROP Ignore_Export_Lib 0\n";
747 stream << "# PROP Target_Dir \"\"\n";
748 stream << "# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D \"WIN32\" /D \"_DEBUG\" /D \"_WINDOWS\" /YX /FD /c\n";
749 stream << "# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od";
750
751 n = m_includeDirs.Number();
752 for (i = 0; i < n; i++)
753 {
754 wxString includeDir = m_includeDirs[i];
755 stream << " /I \"" << includeDir << "\"";
756 }
757
758 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";
759 stream << "# ADD BASE MTL /nologo /D \"_DEBUG\" /mktyplib203 /o NUL /win32\n";
760 stream << "# ADD MTL /nologo /D \"_DEBUG\" /mktyplib203 /o NUL /win32\n";
761 stream << "# ADD BASE RSC /l 0x809 /d \"_DEBUG\"\n";
762 stream << "# ADD RSC /l 0x809 /d \"_DEBUG\"\n";
763 stream << "BSC32=bscmake.exe\n";
764 stream << "# ADD BASE BSC32 /nologo\n";
765 stream << "# ADD BSC32 /nologo\n";
766 stream << "LINK32=link.exe\n";
767 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 wsock32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept\n";
768 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 wsock32.lib wxvc.lib jpeg.lib tiff.lib ";
769 n = m_extraLibs.Number();
770 for (i = 0; i < n; i++)
771 {
772 wxString lib = m_extraLibs[i];
773 stream << lib << " ";
774 }
775 stream << "/nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:\"libcd.lib,libcid.lib,msvcrt.lib\" /out:\"Debug/" << m_targetName << ".exe\" /pdbtype:sept";
776
777 n = m_debugLibDirs.Number();
778 for (i = 0; i < n; i++)
779 {
780 wxString libDir = m_debugLibDirs[i];
781 stream << " /libpath:\"" << libDir << "\"";
782 }
783 n = m_libDirs.Number();
784 for (i = 0; i < n; i++)
785 {
786 wxString libDir = m_libDirs[i];
787 stream << " /libpath:\"" << libDir << "\"";
788 }
789 stream << "\n";
790 stream << "\n";
791 // stream << "!ENDIF\n";
792 // stream << "\n";
793
794 /////////////////////// Win32 Debug DLL target
795
796 stream << "!ELSEIF \"$(CFG)\" == \"" << m_projectName << " - Win32 Debug DLL\"\n";
797 stream << "\n";
798 stream << "# PROP BASE Use_MFC 0\n";
799 stream << "# PROP BASE Use_Debug_Libraries 1\n";
800 stream << "# PROP BASE Output_Dir \"DebugDLL\"\n";
801 stream << "# PROP BASE Intermediate_Dir \"DebugDLL\"\n";
802 stream << "# PROP BASE Target_Dir \"\"\n";
803 stream << "# PROP Use_MFC 0\n";
804 stream << "# PROP Use_Debug_Libraries 1\n";
805 stream << "# PROP Output_Dir \"DebugDLL\"\n";
806 stream << "# PROP Intermediate_Dir \"DebugDLL\"\n";
807 stream << "# PROP Ignore_Export_Lib 0\n";
808 stream << "# PROP Target_Dir \"\"\n";
809 stream << "# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D \"WIN32\" /D \"_DEBUG\" /D \"_WINDOWS\" /YX /FD /c\n";
810 stream << "# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od";
811
812 n = m_includeDirs.Number();
813 for (i = 0; i < n; i++)
814 {
815 wxString includeDir = m_includeDirs[i];
816 stream << " /I \"" << includeDir << "\"";
817 }
818
819 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";
820 stream << "# ADD BASE MTL /nologo /D \"_DEBUG\" /mktyplib203 /o NUL /win32\n";
821 stream << "# ADD MTL /nologo /D \"_DEBUG\" /mktyplib203 /o NUL /win32\n";
822 stream << "# ADD BASE RSC /l 0x809 /d \"_DEBUG\"\n";
823 stream << "# ADD RSC /l 0x809 /d \"_DEBUG\"\n";
824 stream << "BSC32=bscmake.exe\n";
825 stream << "# ADD BASE BSC32 /nologo\n";
826 stream << "# ADD BSC32 /nologo\n";
827 stream << "LINK32=link.exe\n";
828 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 wsock32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept\n";
829 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 wsock32.lib wxvc.lib ";
830 n = m_extraLibs.Number();
831 for (i = 0; i < n; i++)
832 {
833 wxString lib = m_extraLibs[i];
834 stream << lib << " ";
835 }
836 stream << "/nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:\"libcd.lib\" /nodefaultlib:\"libcid.lib\" /out:\"DebugDLL/" << m_targetName << ".exe\" /pdbtype:sept";
837
838 n = m_debugLibDirs.Number();
839 for (i = 0; i < n; i++)
840 {
841 wxString libDir = m_debugLibDirs[i];
842 libDir += "DLL"; // Assume that we have e.g. Debug so make it DebugDLL
843 stream << " /libpath:\"" << libDir << "\"";
844 }
845 n = m_libDirs.Number();
846 for (i = 0; i < n; i++)
847 {
848 wxString libDir = m_libDirs[i];
849 stream << " /libpath:\"" << libDir << "\"";
850 }
851 stream << "\n";
852 stream << "\n";
853 // stream << "!ENDIF\n";
854 // stream << "\n";
855
856 /////////////////////// Win32 Release DLL target
857
858 stream << "!ELSEIF \"$(CFG)\" == \"" << m_projectName << " - Win32 Release DLL\"\n";
859 stream << "\n";
860 stream << "# PROP BASE Use_MFC 0\n";
861 stream << "# PROP BASE Use_Debug_Libraries 0\n";
862 stream << "# PROP BASE Output_Dir \"ReleaseDLL\"\n";
863 stream << "# PROP BASE Intermediate_Dir \"ReleaseDLL\"\n";
864 stream << "# PROP BASE Target_Dir \"\"\n";
865 stream << "# PROP Use_MFC 0\n";
866 stream << "# PROP Use_Debug_Libraries 0\n";
867 stream << "# PROP Output_Dir \"ReleaseDLL\"\n";
868 stream << "# PROP Intermediate_Dir \"ReleaseDLL\"\n";
869 stream << "# PROP Ignore_Export_Lib 0\n";
870 stream << "# PROP Target_Dir \"\"\n";
871 stream << "# ADD BASE CPP /nologo /W3 /GX /O2 /D \"WIN32\" /D \"NDEBUG\" /D \"_WINDOWS\" /YX /FD /c\n";
872 stream << "# ADD CPP /nologo /MD /W3 /GX /O1 /Ob2";
873
874 n = m_includeDirs.Number();
875 for (i = 0; i < n; i++)
876 {
877 wxString includeDir = m_includeDirs[i];
878 stream << " /I \"" << includeDir << "\"";
879 }
880
881 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";
882 stream << "# SUBTRACT CPP /YX\n";
883 stream << "# ADD BASE MTL /nologo /D \"NDEBUG\" /mktyplib203 /o NUL /win32\n";
884 stream << "# ADD MTL /nologo /D \"NDEBUG\" /mktyplib203 /o NUL /win32\n";
885 stream << "# ADD BASE RSC /l 0x809 /d \"NDEBUG\"\n";
886 stream << "# ADD RSC /l 0x809 /d \"NDEBUG\"\n";
887 stream << "BSC32=bscmake.exe\n";
888 stream << "# ADD BASE BSC32 /nologo\n";
889 stream << "# ADD BSC32 /nologo\n";
890 stream << "LINK32=link.exe\n";
891 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 wsock32.lib /nologo /subsystem:windows /machine:I386\n";
892 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 wsock32.lib wxvc.lib ";
893 n = m_extraLibs.Number();
894 for (i = 0; i < n; i++)
895 {
896 wxString lib = m_extraLibs[i];
897 stream << lib << " ";
898 }
899 stream << "/nologo /subsystem:windows /machine:I386 /nodefaultlib:\"libc.lib\" /nodefaultlib:\"libci.lib\" /out:\"ReleaseDLL/" << m_targetName << ".exe\"";
900
901 n = m_releaseLibDirs.Number();
902 for (i = 0; i < n; i++)
903 {
904 wxString libDir = m_releaseLibDirs[i];
905 libDir += "DLL"; // Assume that we have e.g. Release so make it ReleaseDLL
906 stream << " /libpath:\"" << libDir << "\"";
907 }
908 n = m_libDirs.Number();
909 for (i = 0; i < n; i++)
910 {
911 wxString libDir = m_libDirs[i];
912 stream << " /libpath:\"" << libDir << "\"";
913 }
914 stream << "\n";
915 stream << "\n";
916 stream << "!ENDIF\n";
917 stream << "\n";
918
919 /////////////////////// Source code for targets
920
921 stream << "# Begin Target\n";
922 stream << "\n";
923 stream << "# Name \"" << m_projectName << " - Win32 Release\"\n";
924 stream << "# Name \"" << m_projectName << " - Win32 Debug\"\n";
925 stream << "# Name \"" << m_projectName << " - Win32 Debug DLL\"\n";
926 stream << "# Name \"" << m_projectName << " - Win32 Release DLL\"\n";
927
928 // C++ source files
929 n = m_sourceFiles.Number();
930 for (i = 0; i < n; i++)
931 {
932 wxString sourceFile = m_sourceFiles[i];
933
934 stream << "# Begin Source File\n";
935 stream << "\n";
936 stream << "SOURCE=.\\" << sourceFile << "\n";
937 stream << "\n";
938 stream << "!IF \"$(CFG)\" == \"" << m_projectName << " - Win32 Release\"\n";
939 stream << "\n";
940 stream << "!ELSEIF \"$(CFG)\" == \"" << m_projectName << " - Win32 Debug\"\n";
941 stream << "\n";
942 stream << "# SUBTRACT CPP /YX /Yc /Yu\n";
943 stream << "\n";
944 stream << "!ELSEIF \"$(CFG)\" == \"" << m_projectName << " - Win32 Debug DLL\"\n";
945 stream << "\n";
946 stream << "# SUBTRACT BASE CPP /YX /Yc /Yu\n";
947 stream << "# SUBTRACT CPP /YX /Yc /Yu\n";
948 stream << "\n";
949 stream << "!ELSEIF \"$(CFG)\" == \"" << m_projectName << " - Win32 Release DLL\"\n";
950 stream << "\n";
951 stream << "!ENDIF\n";
952 stream << "\n";
953 stream << "# End Source File\n";
954 }
955
956 // The .rc file: assume it has the target name + rc extension.
957 stream << "# Begin Source File\n";
958 stream << "\n";
959 stream << "SOURCE=.\\" << m_targetName << ".rc\n";
960 stream << "# ADD BASE RSC /l 0x809\n";
961 stream << "# ADD RSC /l 0x809";
962
963 n = m_resourceIncludeDirs.Number();
964 for (i = 0; i < n; i++)
965 {
966 wxString includeDir = m_resourceIncludeDirs[i];
967 stream << " /i \"" << includeDir << "\"";
968 }
969
970 stream << "\n";
971 stream << "# End Source File\n";
972 stream << "# End Target\n";
973 stream << "# End Project\n";
974
975 // Now generate the .dsw workspace file
976
977 wxString fullWorkSpaceName = m_path + wxString("/") + m_projectName + ".dsw";
978
979 ofstream stream2(fullWorkSpaceName);
980 if (stream2.bad())
981 return FALSE;
982
983 stream2 << "Microsoft Developer Studio Workspace File, Format Version 5.00\n";
984 stream2 << "# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!\n";
985 stream2 << "\n";
986 stream2 << "###############################################################################\n";
987 stream2 << "\n";
988 stream2 << "Project: \"" << m_projectName << "\"=.\\" << m_projectName << ".dsp - Package Owner=<4>\n";
989 stream2 << "\n";
990 stream2 << "Package=<5>\n";
991 stream2 << "{{{\n";
992 stream2 << "}}}\n";
993 stream2 << "\n";
994 stream2 << "Package=<4>\n";
995 stream2 << "{{{\n";
996 stream2 << "}}}\n";
997 stream2 << "\n";
998 stream2 << "###############################################################################\n";
999 stream2 << "\n";
1000 stream2 << "Global:\n";
1001 stream2 << "\n";
1002 stream2 << "Package=<5>\n";
1003 stream2 << "{{{\n";
1004 stream2 << "}}}\n";
1005 stream2 << "\n";
1006 stream2 << "Package=<3>\n";
1007 stream2 << "{{{\n";
1008 stream2 << "}}}\n";
1009 stream2 << "\n";
1010 stream2 << "###############################################################################\n";
1011 stream2 << "\n";
1012
1013 return TRUE;
1014 }
1015
1016 BEGIN_EVENT_TABLE(MyDialog, wxDialog)
1017 EVT_BUTTON(wxID_EXIT, MyDialog::OnQuit)
1018 EVT_BUTTON(ID_GENERATE_PROJECT, MyDialog::OnGenerate)
1019 EVT_BUTTON(ID_GENERATE_SAMPLES, MyDialog::OnGenerateSamples)
1020 END_EVENT_TABLE()
1021
1022 // ----------------------------------------------------------------------------
1023 // main frame
1024 // ----------------------------------------------------------------------------
1025
1026 // frame constructor
1027 MyDialog::MyDialog(const wxString& title, const wxPoint& pos, const wxSize& size):
1028 wxDialog()
1029 {
1030 LoadFromResource((wxWindow*) NULL, "project_dialog");
1031
1032 }
1033
1034 void MyDialog::OnQuit(wxCommandEvent& event)
1035 {
1036 this->EndModal(wxID_OK);
1037 }
1038
1039 void MyDialog::OnAbout(wxCommandEvent& event)
1040 {
1041 }
1042
1043 void MyDialog::OnGenerate(wxCommandEvent& event)
1044 {
1045 }
1046
1047 void MyDialog::OnGenerateSamples(wxCommandEvent& event)
1048 {
1049 char* dir = getenv("WXWIN");
1050 wxString dirStr;
1051 if (dir)
1052 dirStr = dir;
1053 wxTextEntryDialog dialog(this, "Please enter the wxWindows directory", "Text entry", dirStr, wxOK|wxCANCEL);
1054 if (dialog.ShowModal() == wxID_OK)
1055 {
1056 if (wxDirExists(dialog.GetValue()))
1057 {
1058 // wxGetApp().GenerateSample("MinimalVC", "minimal", dir + wxString("/samples/minimal"),
1059 // wxStringList("minimal.cpp", 0));
1060
1061 wxGetApp().GenerateSamples(dialog.GetValue());
1062 }
1063 else
1064 {
1065 wxMessageBox("This directory doesn't exist.");
1066 }
1067 }
1068 }
1069