From ff0368d3a01c8b6aecc03503e202a7c12e7bd08b Mon Sep 17 00:00:00 2001 From: cxl Date: Tue, 28 May 2013 06:28:11 +0000 Subject: [PATCH] ide: Autosetup improved, supports VC2012 (thanks Ghost!) git-svn-id: svn://ultimatepp.org/upp/trunk@6123 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- uppsrc/ide/AutoSetup.cpp | 337 ++++++++++++++++++++-------- uppsrc/ide/Builders/MscBuilder.icpp | 12 +- uppsrc/ide/ide.lay | 129 ++++++----- 3 files changed, 332 insertions(+), 146 deletions(-) diff --git a/uppsrc/ide/AutoSetup.cpp b/uppsrc/ide/AutoSetup.cpp index 8b31e08cf..c4888cc9a 100644 --- a/uppsrc/ide/AutoSetup.cpp +++ b/uppsrc/ide/AutoSetup.cpp @@ -32,38 +32,81 @@ bool ExistProgram(String& bin, const char *dir, const char *file) return false; } +class CtrlList : public ArrayCtrl { +public: + typedef CtrlList CLASSNAME; + CtrlList() { AutoHideSb().NoGrid().NoHeader(); AddColumn(String()); } + + template + CtrlList& AddLayout(T& ctrl) { + Add(); + int index = GetCount() - 1; + DisableLine(index); + SetCtrl(index, 0, ctrl.SizePos()); + SetLineCy(index, ctrl.GetLayoutSize().cy); + return *this; + } +}; + void AutoSetup() { WithAutoSetupLayout dlg; CtrlLayoutOKCancel(dlg, "Ultimate++ methods auto-setup"); + dlg.Sizeable().Zoomable().SetRect(Size(640, 480)); + + WithAutoSetupMSC11 msc11; CtrlLayout(msc11); + WithAutoSetupMSC10 msc10; CtrlLayout(msc10); + WithAutoSetupMSC9 msc9; CtrlLayout(msc9); + WithAutoSetupMSC8 msc8; CtrlLayout(msc8); + WithAutoSetupMSC7_1 msc7_1; CtrlLayout(msc7_1); + WithAutoSetupMinGW mingw; CtrlLayout(mingw); + WithAutoSetupOWC owc; CtrlLayout(owc); + WithAutoSetupOther other; CtrlLayout(other); + + CtrlList msclist, mingwlist, owclist, otherlist; + + msclist.AddLayout(msc11) + .AddLayout(msc10) + .AddLayout(msc9) + .AddLayout(msc8) + .AddLayout(msc7_1); + + mingwlist.AddLayout(mingw); + owclist.AddLayout(owc); + otherlist.AddLayout(other); + + dlg.tab.Add(msclist.SizePos(), "Visual C++"); + dlg.tab.Add(mingwlist.SizePos(), "MinGW GCC"); + dlg.tab.Add(owclist.SizePos(), "Open Watcom"); + dlg.tab.Add(otherlist.SizePos(), "Other"); + String mw = GetExeDirFile("mingw"); FindFile ff(mw); if(ff && ff.IsDirectory()) - dlg.mingw <<= mw; + mingw.dir <<= mw; else - dlg.mingw <<= + mingw.dir <<= NormalizePathNN(GetWinRegString("Inno Setup: App Path", "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\MinGW_is1")); - if (IsNull(dlg.mingw)) - dlg.mingw <<= NormalizePathNN(GetWinRegString("InstallLocation", + if (IsNull(mingw.dir)) + mingw.dir <<= NormalizePathNN(GetWinRegString("InstallLocation", "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\TDM-GCC" )); - dlg.mingwmethod <<= "MINGW"; - dlg.domingw <<= !IsNull(dlg.mingw); - + mingw.method <<= "MINGW"; + mingw.create <<= !IsNull(mingw.dir); String owcdir = GetEnv("WATCOM"); if(owcdir.IsEmpty()) owcdir = "C:\\WATCOM"; if(DirectoryExists(owcdir)) - dlg.owc <<= owcdir; + owc.dir <<= owcdir; - dlg.owcmethod <<= "OWC"; - dlg.doowc <<= !IsNull(dlg.owc); + owc.method <<= "OWC"; + owc.create <<= !IsNull(owc.dir); String vs = GetWinRegString("ProductDir", "SOFTWARE\\Microsoft\\VisualStudio\\7.1\\Setup\\VC"); - dlg.visualcpp71 <<= + msc7_1.dir <<= NormalizePathNN( Nvl( GetWinRegString("InstallLocation", @@ -71,8 +114,8 @@ void AutoSetup() "{362882AE-E40A-4435-B214-6420634C401F}"), vs) ); - dlg.visualcppmethod71 <<= "MSC71"; - dlg.dovisualcpp71 <<= !IsNull(dlg.visualcpp71); + msc7_1.method <<= "MSC71"; + msc7_1.create <<= !IsNull(msc7_1.dir); String sdk8 = GetWinRegString("InstallationFolder", "Software\\Microsoft\\Microsoft SDKs\\Windows\\v6.0", @@ -80,22 +123,22 @@ void AutoSetup() String bin8; if(!IsNull(sdk8)) { sdk8 = NormalizePath(sdk8); - dlg.sdk8 <<= sdk8; - dlg.sdk71 <<= sdk8; - dlg.visualcpp8 <<= bin8 = sdk8; + msc8.sdk <<= sdk8; + msc7_1.sdk <<= sdk8; + msc8.dir <<= bin8 = sdk8; } else { - dlg.visualcpp8 <<= bin8 = NormalizePathNN( + msc8.dir <<= bin8 = NormalizePathNN( GetWinRegString("8.0", "SOFTWARE\\Microsoft\\VisualStudio\\SxS\\VS7") ); - dlg.sdk8 <<= NormalizePathNN(GetWinRegString("Install Dir", "SOFTWARE\\Microsoft\\MicrosoftSDK\\InstalledSDKs\\8F9E5EF3-A9A5-491B-A889-C58EFFECE8B3")); + msc8.sdk <<= NormalizePathNN(GetWinRegString("Install Dir", "SOFTWARE\\Microsoft\\MicrosoftSDK\\InstalledSDKs\\8F9E5EF3-A9A5-491B-A889-C58EFFECE8B3")); } - dlg.visualcppmethod8 <<= "MSC8"; - dlg.dovisualcpp8 <<= !IsNull(dlg.visualcpp8); + msc8.method <<= "MSC8"; + msc8.create <<= !IsNull(msc8.dir); if(bin8.GetLength() && FileExists(AppendFileName(bin8, "VC\\Bin\\x64\\cl.exe"))) { - dlg.dovisualcpp8x64 = true; + msc8.create64 = true; } - dlg.visualcppmethod8x64 <<= "MSC8x64"; + msc8.method64 <<= "MSC8x64"; String sdk9 = NormalizePathNN(GetWinRegString("InstallationFolder", "SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v7.0", HKEY_LOCAL_MACHINE)); @@ -113,22 +156,22 @@ void AutoSetup() else ExistProgram(bin9, "Program Files (x86)\\Microsoft Visual Studio 9.0", "VC\\Bin\\cl.exe") || ExistProgram(bin9, "Program Files\\Microsoft Visual Studio 9.0", "VC\\Bin\\cl.exe"); - dlg.sdk9 <<= sdk9; - dlg.visualcpp9 <<= bin9; - dlg.visualcppmethod9 <<= "MSC9"; - dlg.dovisualcpp9 <<= !IsNull(dlg.visualcpp9); + msc9.sdk <<= sdk9; + msc9.dir <<= bin9; + msc9.method <<= "MSC9"; + msc9.create <<= !IsNull(msc9.dir); String vc9_64 = AppendFileName(bin9, "VC\\Bin\\x64"); if(!FileExists(AppendFileName(vc9_64, "cl.exe"))) vc9_64 = AppendFileName(bin9, "VC\\Bin\\amd64"); if(bin9.GetLength() && FileExists(AppendFileName(vc9_64, "cl.exe"))) - dlg.dovisualcpp9x64 = true; - dlg.visualcppmethod9x64 <<= "MSC9x64"; + msc8.create64 = true; + msc9.method64 <<= "MSC9x64"; String sdk10 = NormalizePathNN(GetWinRegString("InstallationFolder", "SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v7.1", HKEY_LOCAL_MACHINE)); - if (IsNull (sdk10)) + if (IsNull(sdk10)) sdk10 = NormalizePathNN(GetWinRegString("InstallationFolder", "SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v7.0A", HKEY_LOCAL_MACHINE)); @@ -138,36 +181,60 @@ void AutoSetup() else ExistProgram(bin10, "Program Files (x86)\\Microsoft Visual Studio 10.0", "VC\\Bin\\cl.exe") || ExistProgram(bin10, "Program Files\\Microsoft Visual Studio 10.0", "VC\\Bin\\cl.exe"); - dlg.sdk10 <<= sdk10; - dlg.visualcpp10 <<= bin10; - dlg.visualcppmethod10 <<= "MSC10"; - dlg.dovisualcpp10 <<= !IsNull(dlg.visualcpp10); + msc10.sdk <<= sdk10; + msc10.dir <<= bin10; + msc10.method <<= "MSC10"; + msc10.create <<= !IsNull(msc10.dir); String vc10_64 = AppendFileName(bin10, "VC\\Bin\\x64"); if(!FileExists(AppendFileName(vc10_64, "cl.exe"))) vc10_64 = AppendFileName(bin10, "VC\\Bin\\amd64"); if(bin10.GetLength() && FileExists(AppendFileName(vc10_64, "cl.exe"))) - dlg.dovisualcpp10x64 = true; - dlg.visualcppmethod10x64 <<= "MSC10x64"; + msc10.create64 = true; + msc10.method64 <<= "MSC10x64"; - dlg.mysql <<= NormalizePathNN(GetWinRegString("Location", "SOFTWARE\\MySQL AB\\MySQL Server 4.1")); + + String sdk11 = NormalizePathNN(GetWinRegString("InstallationFolder", + "SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v8.0", + HKEY_LOCAL_MACHINE)); + String bin11; + if(!IsNull(sdk11) && FileExists(AppendFileName(sdk11, "VC\\Bin\\cl.exe"))) + bin11 = sdk11; + else + ExistProgram(bin11, "Program Files (x86)\\Microsoft Visual Studio 11.0", "VC\\Bin\\cl.exe") + || ExistProgram(bin11, "Program Files\\Microsoft Visual Studio 11.0", "VC\\Bin\\cl.exe"); + msc11.sdk <<= sdk11; + msc11.dir <<= bin11; + msc11.method <<= "MSC11"; + msc11.create <<= !IsNull(msc11.dir); + String vc11_64 = AppendFileName(bin11, "VC\\Bin\\x64"); + if(!FileExists(AppendFileName(vc11_64, "cl.exe"))) + vc11_64 = AppendFileName(bin11, "VC\\Bin\\x86_amd64"); + if(bin11.GetLength() && FileExists(AppendFileName(vc11_64, "cl.exe"))) + msc11.create64 = true; + msc11.method64 <<= "MSC11x64"; + + + other.mysql <<= NormalizePathNN(GetWinRegString("Location", "SOFTWARE\\MySQL AB\\MySQL Server 4.1")); String sdl = NormalizePathNN(ConfigFile("sdl")); if(DirectoryExists(sdl)) - dlg.sdl <<= sdl; + other.sdl <<= sdl; Array< FrameRight