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