mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-15 14:16:07 -06:00
ide: Instant setup
git-svn-id: svn://ultimatepp.org/upp/trunk@9042 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
db0c0f3456
commit
dbc1905e4b
6 changed files with 104 additions and 20 deletions
|
|
@ -3,6 +3,8 @@
|
|||
|
||||
#ifdef PLATFORM_WIN32
|
||||
|
||||
#if 0
|
||||
|
||||
String GetShellFolder(const char *name, HKEY type)
|
||||
{
|
||||
return GetWinRegString(name, "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders", type);
|
||||
|
|
@ -243,6 +245,8 @@ bool Install()
|
|||
return true;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
bool CopyFolder(const char *dst, const char *src, Progress *pi)
|
||||
|
|
|
|||
|
|
@ -148,6 +148,8 @@ void InstantSetup()
|
|||
df.Dir(pf + "/microsoft visual studio 14.0");
|
||||
df.Dir(pf);
|
||||
df.Dir(GetProgramsFolder());
|
||||
|
||||
String default_method;
|
||||
|
||||
for(int x64 = 0; x64 < 2; x64++) {
|
||||
String method = x64 ? "MSC15x64" : "MSC15";
|
||||
|
|
@ -162,8 +164,11 @@ void InstantSetup()
|
|||
Vector<String> bins = Split(bm.Get("PATH", ""), ';');
|
||||
Vector<String> incs = Split(bm.Get("INCLUDE", ""), ';');
|
||||
Vector<String> libs = Split(bm.Get("LIB", ""), ';');
|
||||
if(CheckDirs(bins, 2) && CheckDirs(incs, 4) && CheckDirs(libs, 3))
|
||||
if(CheckDirs(bins, 2) && CheckDirs(incs, 4) && CheckDirs(libs, 3)) {
|
||||
if(!x64)
|
||||
default_method = "MSC15";
|
||||
continue;
|
||||
}
|
||||
|
||||
vc = df.ScanForDir("/vc", "", "bin/link.exe;bin/cl.exe;bin/mspdb140.dll", "bin/1033");
|
||||
bin = df.ScanForDir(x64 ? "bin/x64" : "bin/x86", "/windows kits/", "makecat.exe;accevent.exe", "");
|
||||
|
|
@ -217,10 +222,13 @@ void InstantSetup()
|
|||
bm.GetAdd("LIB") = Join(libs, ";");
|
||||
|
||||
SaveVarFile(ConfigFile(method + ".bm"), bm);
|
||||
|
||||
if(!x64)
|
||||
default_method = "MSC15";
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
do {
|
||||
String method = "MINGW32";
|
||||
#ifdef _DEBUG
|
||||
method << "Test";
|
||||
|
|
@ -230,8 +238,10 @@ void InstantSetup()
|
|||
Vector<String> bins = Split(bm.Get("PATH", ""), ';');
|
||||
Vector<String> incs = Split(bm.Get("INCLUDE", ""), ';');
|
||||
Vector<String> libs = Split(bm.Get("LIB", ""), ';');
|
||||
if(CheckDirs(bins, 1) && CheckDirs(incs, 1) && CheckDirs(libs, 1))
|
||||
return;
|
||||
if(CheckDirs(bins, 1) && CheckDirs(incs, 1) && CheckDirs(libs, 1)) {
|
||||
default_method = Nvl(default_method, method);
|
||||
break;
|
||||
}
|
||||
|
||||
String bin = GetExeDirFile("bin");
|
||||
|
||||
|
|
@ -267,6 +277,73 @@ void InstantSetup()
|
|||
|
||||
SaveVarFile(ConfigFile(method + ".bm"), bm);
|
||||
}
|
||||
while(0);
|
||||
|
||||
if(default_method.GetCount())
|
||||
SaveFile(GetExeDirFile("default_method"), default_method);
|
||||
|
||||
static Tuple2<const char *, const char *> ass[] = {
|
||||
{ "uppsrc", "#/uppsrc" },
|
||||
{ "reference", "#/reference;#/uppsrc" },
|
||||
{ "examples", "#/examples;#/uppsrc" },
|
||||
{ "tutorial", "#/tutorial;#/uppsrc" },
|
||||
{ "examples-bazaar", "#/bazaar;#/uppsrc" },
|
||||
{ "MyApps", "#/MyApps;#/uppsrc" },
|
||||
{ "MyApps-bazaar", "#/MyApps;#/bazaar;#/uppsrc" },
|
||||
};
|
||||
|
||||
String exe = GetExeFilePath();
|
||||
String dir = GetFileFolder(exe);
|
||||
String out = GetExeDirFile("out");
|
||||
RealizeDirectory(out);
|
||||
|
||||
for(int i = 0; i < __countof(ass); i++) {
|
||||
String vf = GetExeDirFile(String(ass[i].a) + ".var");
|
||||
VectorMap<String, String> map;
|
||||
bool ok = true;
|
||||
if(LoadVarFile(vf, map)) {
|
||||
Vector<String> dir = Split(map.Get("UPP", String()), ';');
|
||||
if(dir.GetCount() == 0) {
|
||||
ok = false;
|
||||
break;
|
||||
}
|
||||
for(int j = 0; j < dir.GetCount(); j++) {
|
||||
if(!DirectoryExists(dir[j])) {
|
||||
ok = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!ok) {
|
||||
String b = ass[i].b;
|
||||
b.Replace("#", dir);
|
||||
SaveFile(vf,
|
||||
"UPP = " + b + ";\r\n"
|
||||
"OUTPUT = " + AsCString(out) + ";\r\n"
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool CheckLicense()
|
||||
{
|
||||
if(!FileExists((GetExeDirFile("license.chk"))))
|
||||
return true;
|
||||
ShowSplash();
|
||||
Ctrl::ProcessEvents();
|
||||
Sleep(2000);
|
||||
HideSplash();
|
||||
Ctrl::ProcessEvents();
|
||||
WithLicenseLayout<TopWindow> d;
|
||||
CtrlLayoutOKCancel(d, "License agreement");
|
||||
d.license = GetTopic("ide/app/BSD$en-us").text;
|
||||
d.license.Margins(4);
|
||||
d.license.SetZoom(Zoom(Zy(18), 100));
|
||||
d.ActiveFocus(d.license);
|
||||
if(d.Run() != IDOK)
|
||||
return false;
|
||||
DeleteFile(GetExeDirFile("license.chk"));
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -61,7 +61,6 @@ file
|
|||
Print.cpp,
|
||||
Insert.cpp,
|
||||
idetool.cpp,
|
||||
Install.cpp,
|
||||
idebar.cpp,
|
||||
idewin.cpp,
|
||||
About.cpp,
|
||||
|
|
@ -75,13 +74,14 @@ file
|
|||
Xml.cpp,
|
||||
Json.cpp,
|
||||
Update.cpp,
|
||||
AutoSetup.cpp,
|
||||
InstantSetup.cpp,
|
||||
Install.cpp,
|
||||
Compile readonly separator,
|
||||
MethodsCtrls.h,
|
||||
MethodsCtrls.cpp,
|
||||
Methods.h,
|
||||
Methods.cpp,
|
||||
AutoSetup.cpp,
|
||||
InstantSetup.cpp,
|
||||
OutputMode.cpp,
|
||||
Build.cpp,
|
||||
Debug.cpp,
|
||||
|
|
|
|||
|
|
@ -341,8 +341,11 @@ void Ide::Setup(Bar& menu)
|
|||
menu.Add("Build methods..", THISBACK(SetupBuildMethods))
|
||||
.Help("Setup build methods");
|
||||
#ifdef PLATFORM_WIN32
|
||||
menu.Add("Automatic setup..", THISBACK(AutoSetup))
|
||||
.Help("Automatic setup of build methods..");
|
||||
if(console.verbosebuild)
|
||||
menu.Add("Automatic setup..", THISBACK(AutoSetup))
|
||||
.Help("Automatic setup of build methods..");
|
||||
menu.Add("Instant setup..", callback(InstantSetup))
|
||||
.Help("Setups/fixes build methods and basic assemblies..");
|
||||
#endif
|
||||
#ifdef PLATFORM_POSIX
|
||||
menu.Add("Source managment..", THISBACK(AutoSetup))
|
||||
|
|
|
|||
|
|
@ -769,14 +769,14 @@ void AppMain___()
|
|||
#ifdef PLATFORM_WIN32
|
||||
if(!CheckLicense())
|
||||
return;
|
||||
firstinstall = !IsNull(LoadFile(GetExeDirFile("install.upp")));
|
||||
#ifdef flagTESTINSTALL
|
||||
firstinstall = true;
|
||||
String upp_dir = GetFileFolder(GetExeFilePath());
|
||||
String cf = GetExeDirFile("setup-path");
|
||||
#ifndef _DEBUG
|
||||
if(upp_dir != LoadFile(cf))
|
||||
#endif
|
||||
if(firstinstall) {
|
||||
if(!Install())
|
||||
return;
|
||||
SaveFile(ConfigFile("version"), IDE_VERSION);
|
||||
{
|
||||
InstantSetup();
|
||||
SaveFile(upp_dir, cf);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
@ -784,12 +784,12 @@ void AppMain___()
|
|||
ResetBlitz();
|
||||
|
||||
for(int i = 0; i < arg.GetCount(); i++) {
|
||||
if(arg[i] == "-uninstall") {
|
||||
/* if(arg[i] == "-uninstall") {
|
||||
Uninstall();
|
||||
return;
|
||||
}
|
||||
if(!firstinstall && arg[i] == "-install" && !Install()) return;
|
||||
|
||||
*/
|
||||
#ifdef PLATFORM_WIN32
|
||||
if(arg[i] == "!") {
|
||||
String cmdline;
|
||||
|
|
@ -832,7 +832,7 @@ void AppMain___()
|
|||
#endif
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
#ifdef _DEBUG0
|
||||
#ifdef PLATFORM_WIN32
|
||||
InstantSetup();
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -2,6 +2,6 @@ uppsrc.var|#\uppsrc|#\common|#\out
|
|||
reference.var|#\reference;#\uppsrc|#\common|#\out
|
||||
examples.var|#\examples;#\uppsrc|#\common|#\out
|
||||
tutorial.var|#\tutorial;#\uppsrc|#\common|#\out
|
||||
bazaar.var|#\bazaar;#\uppsrc|#\common|#\out
|
||||
examples-bazaar.var|#\bazaar;#\uppsrc|#\common|#\out
|
||||
MyApps.var|@;#\uppsrc|#\common|#\out
|
||||
MyAppsWBazaar.var|@;#\uppsrc|#\common|#\out
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue