]> git.saurik.com Git - wxWidgets.git/blobdiff - utils/projgen/makeproj.cpp
#included log.h
[wxWidgets.git] / utils / projgen / makeproj.cpp
index 39b92e2901d5e849e967aeef4166c1d50d5cfd81..e5380e9cd63949b16746d2f98bc2592a77cf791b 100644 (file)
@@ -54,7 +54,7 @@ public:
     virtual bool OnInit();
 
     bool GenerateSample(const wxString& projectName, const wxString& targetName,
     virtual bool OnInit();
 
     bool GenerateSample(const wxString& projectName, const wxString& targetName,
-        const wxString& path, const wxStringList& sourceFiles);
+        const wxString& path, const wxStringList& sourceFiles, const wxString& relativeRootPath = "../..");
     void GenerateSamples(const wxString& dir); // Takes wxWindows directory path
 };
 
     void GenerateSamples(const wxString& dir); // Takes wxWindows directory path
 };
 
@@ -71,7 +71,7 @@ public:
     void OnGenerate(wxCommandEvent& event);
 
     bool GenerateSample(const wxString& projectName, const wxString& targetName,
     void OnGenerate(wxCommandEvent& event);
 
     bool GenerateSample(const wxString& projectName, const wxString& targetName,
-        const wxString& path, const wxStringList& sourceFiles);
+        const wxString& path, const wxStringList& sourceFiles, const wxString& relativeRootPath = "../..");
 
 private:
     // any class wishing to process wxWindows events must use this macro
 
 private:
     // any class wishing to process wxWindows events must use this macro
@@ -162,16 +162,23 @@ bool MyApp::OnInit()
 }
 
 bool MyApp::GenerateSample(const wxString& projectName, const wxString& targetName,
 }
 
 bool MyApp::GenerateSample(const wxString& projectName, const wxString& targetName,
-    const wxString& path, const wxStringList& sourceFiles)
+    const wxString& path, const wxStringList& sourceFiles, const wxString& relativeRootPath)
 {
 {
+    wxString relativeIncludePath(relativeRootPath + wxString("/include"));
+    wxString relativeLibPath(relativeRootPath + wxString("/lib"));
+    wxString relativeDebugPath(relativeRootPath + wxString("/src/Debug"));
+    wxString relativeReleasePath(relativeRootPath + wxString("/src/Release"));
+    wxString relativeDebugPathJPEG(relativeRootPath + wxString("/src/jpeg/Debug"));
+    wxString relativeReleasePathJPEG(relativeRootPath + wxString("/src/jpeg/Release"));
+
     wxProject project;
 
     // For all samples
     wxProject project;
 
     // For all samples
-    project.SetIncludeDirs(wxStringList("../../include", 0));
-    project.SetResourceIncludeDirs(wxStringList("../../include", 0));
-    project.SetLibDirs(wxStringList("../../lib", 0));
-    project.SetDebugLibDirs(wxStringList("../../src/Debug", 0));
-    project.SetReleaseLibDirs(wxStringList("../../src/Release", 0));
+    project.SetIncludeDirs(wxStringList((const char*) relativeIncludePath, 0));
+    project.SetResourceIncludeDirs(wxStringList((const char*) relativeIncludePath, 0));
+    project.SetLibDirs(wxStringList((const char*) relativeLibPath, 0));
+    project.SetDebugLibDirs(wxStringList((const char*) relativeDebugPath, (const char*) relativeDebugPathJPEG, 0));
+    project.SetReleaseLibDirs(wxStringList((const char*) relativeReleasePath, (const char*) relativeReleasePathJPEG, 0));
 
     project.SetProjectName(projectName);
     project.SetTargetName(targetName);
 
     project.SetProjectName(projectName);
     project.SetTargetName(targetName);
@@ -210,22 +217,33 @@ void MyApp::GenerateSamples(const wxString& dir)
     GenerateSample("DocVwMDIVC", "docview", dir + wxString("/samples/docvwmdi"),
         wxStringList("docview.cpp", "doc.cpp", "view.cpp", "docview.h", "doc.h", "view.h", 0));
     GenerateSample("DynamicVC", "dynamic", dir + wxString("/samples/dynamic"), wxStringList("dynamic.cpp", 0));
     GenerateSample("DocVwMDIVC", "docview", dir + wxString("/samples/docvwmdi"),
         wxStringList("docview.cpp", "doc.cpp", "view.cpp", "docview.h", "doc.h", "view.h", 0));
     GenerateSample("DynamicVC", "dynamic", dir + wxString("/samples/dynamic"), wxStringList("dynamic.cpp", 0));
+    GenerateSample("DrawingVC", "drawing", dir + wxString("/samples/drawing"), wxStringList("drawing.cpp", 0));
     GenerateSample("FortyVC", "forty", dir + wxString("/samples/forty"),
        wxStringList("forty.cpp", "canvas.cpp", "card.cpp", "game.cpp", "pile.cpp", "playerdg.cpp", "scoredg.cpp", "scorefil.cpp",
        "canvas.h", "forty.h", "card.h", "game.h", "pile.h", "playerdg.h", "scoredg.h", "scorefil.h",
        0));
     GenerateSample("FractalVC", "fractal", dir + wxString("/samples/fractal"), wxStringList("fractal.cpp", 0));
     GenerateSample("GridVC", "test", dir + wxString("/samples/grid"), wxStringList("test.cpp", 0));
     GenerateSample("FortyVC", "forty", dir + wxString("/samples/forty"),
        wxStringList("forty.cpp", "canvas.cpp", "card.cpp", "game.cpp", "pile.cpp", "playerdg.cpp", "scoredg.cpp", "scorefil.cpp",
        "canvas.h", "forty.h", "card.h", "game.h", "pile.h", "playerdg.h", "scoredg.h", "scorefil.h",
        0));
     GenerateSample("FractalVC", "fractal", dir + wxString("/samples/fractal"), wxStringList("fractal.cpp", 0));
     GenerateSample("GridVC", "test", dir + wxString("/samples/grid"), wxStringList("test.cpp", 0));
+    GenerateSample("NewGridVC", "griddemo", dir + wxString("/samples/newgrid"), wxStringList("griddemo.cpp", 0));
     GenerateSample("HelpVC", "demo", dir + wxString("/samples/help"), wxStringList("demo.cpp", 0));
 
     // wxHTML samples
     GenerateSample("HelpVC", "demo", dir + wxString("/samples/help"), wxStringList("demo.cpp", 0));
 
     // wxHTML samples
-    GenerateSample("AboutVC", "about", dir + wxString("/samples/html/about"), wxStringList("about.cpp", 0));
-    GenerateSample("HelpVC", "help", dir + wxString("/samples/html/help"), wxStringList("help.cpp", 0));
-    GenerateSample("PrintingVC", "printing", dir + wxString("/samples/html/printing"), wxStringList("printing.cpp", 0));
-    GenerateSample("TestVC", "test", dir + wxString("/samples/html/test"), wxStringList("test.cpp", 0));
-    GenerateSample("VirtualVC", "virtual", dir + wxString("/samples/html/virtual"), wxStringList("virtual.cpp", 0));
-    GenerateSample("WidgetVC", "widget", dir + wxString("/samples/html/widget"), wxStringList("widget.cpp", 0));
-    GenerateSample("ZipVC", "zip", dir + wxString("/samples/html/zip"), wxStringList("zip.cpp", 0));
+    GenerateSample("AboutVC", "about", dir + wxString("/samples/html/about"), wxStringList("about.cpp", 0),
+        "../../..");
+    GenerateSample("HelpVC", "help", dir + wxString("/samples/html/help"), wxStringList("help.cpp", 0),
+        "../../..");
+    GenerateSample("PrintingVC", "printing", dir + wxString("/samples/html/printing"), wxStringList("printing.cpp", 0),
+        "../../..");
+    GenerateSample("TestVC", "test", dir + wxString("/samples/html/test"), wxStringList("test.cpp", 0),
+        "../../..");
+    GenerateSample("VirtualVC", "virtual", dir + wxString("/samples/html/virtual"), wxStringList("virtual.cpp", 0),
+        "../../..");
+    GenerateSample("WidgetVC", "widget", dir + wxString("/samples/html/widget"), wxStringList("widget.cpp", 0),
+        "../../..");
+    GenerateSample("ZipVC", "zip", dir + wxString("/samples/html/zip"), wxStringList("zip.cpp", 0),
+        "../../..");
+    GenerateSample("HelpViewVC", "helpview", dir + wxString("/samples/html/helpview"), wxStringList("helpview.cpp", 0),
+        "../../..");
 
     GenerateSample("ImageVC", "image", dir + wxString("/samples/image"), wxStringList("image.cpp", 0));
     GenerateSample("InternatVC", "internat", dir + wxString("/samples/internat"), wxStringList("internat.cpp", 0));
 
     GenerateSample("ImageVC", "image", dir + wxString("/samples/image"), wxStringList("image.cpp", 0));
     GenerateSample("InternatVC", "internat", dir + wxString("/samples/internat"), wxStringList("internat.cpp", 0));
@@ -269,6 +287,7 @@ void MyApp::GenerateSamples(const wxString& dir)
     GenerateSample("CaretVC", "caret", dir + wxString("/samples/caret"), wxStringList("caret.cpp", 0));
     GenerateSample("DrawingVC", "drawing", dir + wxString("/samples/drawing"), wxStringList("drawing.cpp", 0));
     GenerateSample("ScrollVC", "scroll", dir + wxString("/samples/scroll"), wxStringList("scroll.cpp", 0));
     GenerateSample("CaretVC", "caret", dir + wxString("/samples/caret"), wxStringList("caret.cpp", 0));
     GenerateSample("DrawingVC", "drawing", dir + wxString("/samples/drawing"), wxStringList("drawing.cpp", 0));
     GenerateSample("ScrollVC", "scroll", dir + wxString("/samples/scroll"), wxStringList("scroll.cpp", 0));
+    GenerateSample("WizardVC", "wizard", dir + wxString("/samples/wizard"), wxStringList("wiztest.cpp", 0));
 
     //// Utilities
 
 
     //// Utilities
 
@@ -317,7 +336,7 @@ void MyApp::GenerateSamples(const wxString& dir)
         wxMessageBox(msg);
     }
 
         wxMessageBox(msg);
     }
 
-    // Tex2RTF
+    // HelpGen
     project.SetIncludeDirs(wxStringList("../../../include", 0));
     project.SetResourceIncludeDirs(wxStringList("../../../include", 0));
     project.SetLibDirs(wxStringList("../../../lib", 0));
     project.SetIncludeDirs(wxStringList("../../../include", 0));
     project.SetResourceIncludeDirs(wxStringList("../../../include", 0));
     project.SetLibDirs(wxStringList("../../../lib", 0));
@@ -339,6 +358,24 @@ void MyApp::GenerateSamples(const wxString& dir)
         wxMessageBox(msg);
     }
 
         wxMessageBox(msg);
     }
 
+    // ProjGen
+    project.SetIncludeDirs(wxStringList("../../include", 0));
+    project.SetResourceIncludeDirs(wxStringList("../../include", 0));
+    project.SetLibDirs(wxStringList("../../lib", 0));
+    project.SetDebugLibDirs(wxStringList("../../src/Debug", 0));
+    project.SetReleaseLibDirs(wxStringList("../../src/Release", 0));
+
+    project.SetProjectName("ProjGenVC");
+    project.SetTargetName("makeproj");
+    project.SetProjectPath(dir + wxString("/utils/projgen"));
+    project.SetSourceFiles(wxStringList("makeproj.cpp", "makeproj.h", 0));
+
+    if (!project.GenerateVCProject())
+    {
+        wxString msg("Could not generate ProjGen project");
+        wxMessageBox(msg);
+    }
+
     // wxTreeLayout sample
 
     project.SetIncludeDirs(wxStringList("../../../include", 0));
     // wxTreeLayout sample
 
     project.SetIncludeDirs(wxStringList("../../../include", 0));
@@ -522,9 +559,9 @@ void MyFrame::OnGenerate(wxCommandEvent& WXUNUSED(event))
 }
 
 bool MyFrame::GenerateSample(const wxString& projectName, const wxString& targetName,
 }
 
 bool MyFrame::GenerateSample(const wxString& projectName, const wxString& targetName,
-    const wxString& path, const wxStringList& sourceFiles)
+    const wxString& path, const wxStringList& sourceFiles, const wxString& relativeRootPath)
 {
 {
-    return wxGetApp().GenerateSample(projectName, targetName, path, sourceFiles);
+    return wxGetApp().GenerateSample(projectName, targetName, path, sourceFiles, relativeRootPath);
 }
 
 /*
 }
 
 /*
@@ -619,7 +656,7 @@ bool wxProject::GenerateVCProject()
     stream << "# ADD BSC32 /nologo\n";
     stream << "LINK32=link.exe\n";
     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";
     stream << "# ADD BSC32 /nologo\n";
     stream << "LINK32=link.exe\n";
     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";
-    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 ";
+    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 ";
     n = m_extraLibs.Number();
     for (i = 0; i < n; i++)
     {
     n = m_extraLibs.Number();
     for (i = 0; i < n; i++)
     {
@@ -627,7 +664,7 @@ bool wxProject::GenerateVCProject()
         stream << lib << " ";
     }
 
         stream << lib << " ";
     }
 
-    stream << "/nologo /subsystem:windows /machine:I386 /nodefaultlib:\"libc.lib\" /nodefaultlib:\"libci.lib\" /out:\"Release/" << m_targetName << ".exe\"";
+    stream << "/nologo /subsystem:windows /machine:I386 /nodefaultlib:\"libc.lib,libci.lib,msvcrtd.lib\" /out:\"Release/" << m_targetName << ".exe\"";
 
     n = m_releaseLibDirs.Number();
     for (i = 0; i < n; i++)
 
     n = m_releaseLibDirs.Number();
     for (i = 0; i < n; i++)
@@ -660,7 +697,7 @@ bool wxProject::GenerateVCProject()
     stream << "# PROP Ignore_Export_Lib 0\n";
     stream << "# PROP Target_Dir \"\"\n";
     stream << "# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D \"WIN32\" /D \"_DEBUG\" /D \"_WINDOWS\" /YX /FD /c\n";
     stream << "# PROP Ignore_Export_Lib 0\n";
     stream << "# PROP Target_Dir \"\"\n";
     stream << "# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D \"WIN32\" /D \"_DEBUG\" /D \"_WINDOWS\" /YX /FD /c\n";
-    stream << "# ADD CPP /nologo /MD /W3 /Gm /GX /Zi /Od";
+    stream << "# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od";
 
     n = m_includeDirs.Number();
     for (i = 0; i < n; i++)
 
     n = m_includeDirs.Number();
     for (i = 0; i < n; i++)
@@ -679,14 +716,14 @@ bool wxProject::GenerateVCProject()
     stream << "# ADD BSC32 /nologo\n";
     stream << "LINK32=link.exe\n";
     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";
     stream << "# ADD BSC32 /nologo\n";
     stream << "LINK32=link.exe\n";
     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";
-    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 ";
+    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 ";
     n = m_extraLibs.Number();
     for (i = 0; i < n; i++)
     {
         wxString lib = m_extraLibs[i];
         stream << lib << " ";
     }
     n = m_extraLibs.Number();
     for (i = 0; i < n; i++)
     {
         wxString lib = m_extraLibs[i];
         stream << lib << " ";
     }
-    stream << "/nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:\"libcd.lib\" /nodefaultlib:\"libcid.lib\" /out:\"Debug/" << m_targetName << ".exe\" /pdbtype:sept";
+    stream << "/nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:\"libcd.lib,libcid.lib,msvcrt.lib\" /out:\"Debug/" << m_targetName << ".exe\" /pdbtype:sept";
 
     n = m_debugLibDirs.Number();
     for (i = 0; i < n; i++)
 
     n = m_debugLibDirs.Number();
     for (i = 0; i < n; i++)
@@ -721,7 +758,7 @@ bool wxProject::GenerateVCProject()
     stream << "# PROP Ignore_Export_Lib 0\n";
     stream << "# PROP Target_Dir \"\"\n";
     stream << "# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D \"WIN32\" /D \"_DEBUG\" /D \"_WINDOWS\" /YX /FD /c\n";
     stream << "# PROP Ignore_Export_Lib 0\n";
     stream << "# PROP Target_Dir \"\"\n";
     stream << "# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D \"WIN32\" /D \"_DEBUG\" /D \"_WINDOWS\" /YX /FD /c\n";
-    stream << "# ADD CPP /nologo /MD /W3 /Gm /GX /Zi /Od";
+    stream << "# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od";
 
     n = m_includeDirs.Number();
     for (i = 0; i < n; i++)
 
     n = m_includeDirs.Number();
     for (i = 0; i < n; i++)