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