mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-09-02 16:22:40 -06:00
ide: PCH experiments
git-svn-id: svn://ultimatepp.org/upp/trunk@7795 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
561bdbf591
commit
15ea7a877f
15 changed files with 104 additions and 39 deletions
|
|
@ -54,7 +54,7 @@ void LogSyntax::Highlight(const wchar *s, const wchar *end, HighlightOutput& hls
|
|||
}
|
||||
else {
|
||||
bool hl = findarg(c, '[', ']', '(', ')', ':', '-', '=', '{', '}', '/', '<', '>', '*',
|
||||
'#', '@', '\\', '.') >= 0
|
||||
'#', '@', '\\', '.') >= 0;
|
||||
hls.Put(1, hl ? hl_style[INK_OPERATOR] : ink);
|
||||
s++;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -737,9 +737,6 @@ Stream& Stream::operator%(String& s) {
|
|||
Get(); // reserved for future use... or removal
|
||||
}
|
||||
}
|
||||
DDUMP(len);
|
||||
DDUMP(GetPos());
|
||||
DDUMP(GetSize());
|
||||
if(IsError() || len + GetPos() > GetSize())
|
||||
LoadError();
|
||||
else {
|
||||
|
|
|
|||
|
|
@ -155,6 +155,7 @@ One<Builder> MakeBuild::CreateBuilder(Host *host)
|
|||
b->release_link = bm.Get("RELEASE_LINK", "");
|
||||
b->script = bm.Get("SCRIPT", "");
|
||||
b->main_conf = !!main_conf.GetCount();
|
||||
b->allow_pch = bm.Get("ALLOW_PRECOMPILED_HEADERS", "") == "1";
|
||||
return b;
|
||||
}
|
||||
|
||||
|
|
@ -221,6 +222,7 @@ struct OneFileHost : Host {
|
|||
virtual bool Run(const char *cmdline, int slot, String key, int blitz_count) { return host->Run(cmdline, slot, key, blitz_count); }
|
||||
virtual bool Run(const char *cmdline, Stream& out, int slot, String key, int blitz_count) { return host->Run(cmdline, out, slot, key, blitz_count); }
|
||||
virtual bool Wait() { return host->Wait(); }
|
||||
virtual bool Wait(int slot) { return host->Wait(slot); }
|
||||
virtual One<AProcess> StartProcess(const char *c) { return host->StartProcess(c); }
|
||||
virtual void Launch(const char *cmdline, bool) { host->Launch(cmdline); }
|
||||
virtual void AddFlags(Index<String>& cfg) { host->AddFlags(cfg); }
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@ struct CppBuilder : Builder {
|
|||
bool Run(const char *cmdline, int slot, String key, int blitz_count);
|
||||
bool Run(const char *cmdline, Stream& out, int slot, String key, int blitz_count);
|
||||
bool Wait();
|
||||
bool Wait(int slot);
|
||||
bool HasFlag(const char *f) const { return config.Find(f) >= 0; }
|
||||
bool Cp(const String& cmd, const String& package, bool& error);
|
||||
bool Cd(const String& cmd);
|
||||
|
|
|
|||
|
|
@ -183,6 +183,11 @@ bool CppBuilder::Wait()
|
|||
return host->Wait();
|
||||
}
|
||||
|
||||
bool CppBuilder::Wait(int slot)
|
||||
{
|
||||
return host->Wait(slot);
|
||||
}
|
||||
|
||||
void CppBuilder::ChDir(const String& path)
|
||||
{
|
||||
host->ChDir(path);
|
||||
|
|
|
|||
|
|
@ -237,6 +237,38 @@ bool MscBuilder::BuildPackage(const String& package, Vector<String>& linkfile, S
|
|||
Vector<String> sobjfile;
|
||||
bool error = false;
|
||||
|
||||
String pch;
|
||||
|
||||
if(allow_pch && pkg.GetCount() && IsMsc86()) {
|
||||
String hdr_path = SourcePath(package, pkg[0]);
|
||||
if(IsCHeaderFile(hdr_path) && HdependBlitzApproved(hdr_path)) {
|
||||
// add check: .c in package should prohibit precompiled header
|
||||
// add check: Only simple file name
|
||||
// add check: Some file in package #includes it
|
||||
int time = GetTickCount();
|
||||
int slot = AllocSlot();
|
||||
String pchfile = CatAnyPath(outdir, GetFileTitle(hdr_path) + ".pch");
|
||||
String cppfile = ForceExt(hdr_path, ".$pch$.cpp");
|
||||
SaveFile(cppfile, "#include \"" + pkg[0] + "\"\r\n");
|
||||
if(slot < 0 ||
|
||||
!Run(Join(cc, cpp_options) + PdbPch(package, slot, false)
|
||||
+ " -Tp " + GetHostPathQ(hdr_path) + " -Fp" + GetHostPathQ(cppfile)
|
||||
+ " -Yc" + pkg[0],
|
||||
slot, GetHostPath(pchfile), 1))
|
||||
error = true;
|
||||
if(!Wait(slot))
|
||||
error = true;
|
||||
PutVerbose("precompiled header " + pchfile + " compiled in " + GetPrintTime(time));
|
||||
if(error) {
|
||||
IdeConsoleEndGroup();
|
||||
return false;
|
||||
}
|
||||
DeleteFile(pchfile);
|
||||
pch << " -Yu" << GetHostPathQ(GetFileTitle(hdr_path))
|
||||
<< " -Fp" << GetHostPathQ(pchfile);
|
||||
}
|
||||
}
|
||||
|
||||
for(i = 0; i < pkg.GetCount(); i++) {
|
||||
if(!IdeIsBuilding())
|
||||
return false;
|
||||
|
|
@ -274,8 +306,10 @@ bool MscBuilder::BuildPackage(const String& package, Vector<String>& linkfile, S
|
|||
if(b.build) {
|
||||
PutConsole("BLITZ:" + b.info);
|
||||
int slot = AllocSlot();
|
||||
if(slot < 0 || ! Run(Join(cc, cpp_options) + PdbPch(package, slot, false)
|
||||
+ " -Tp " + GetHostPathQ(b.path) + " -Fo" + GetHostPathQ(b.object), slot, GetHostPath(b.object), b.count))
|
||||
if(slot < 0 ||
|
||||
!Run(Join(cc, cpp_options) + PdbPch(package, slot, false)
|
||||
+ " -Tp " + GetHostPathQ(b.path) + " -Fo" + GetHostPathQ(b.object),
|
||||
slot, GetHostPath(b.object), b.count))
|
||||
error = true;
|
||||
}
|
||||
}
|
||||
|
|
@ -340,7 +374,7 @@ bool MscBuilder::BuildPackage(const String& package, Vector<String>& linkfile, S
|
|||
int slot = AllocSlot();
|
||||
if(slot < 0 || !Run(c + PdbPch(package, slot, !sContainsPchOptions(cc) && !sContainsPchOptions(soptions[i]))
|
||||
+ " " + soptions[i] + (ext == ".c" ? Join(" -Tc", c_options) : Join(" -Tp", cpp_options)) + ' '
|
||||
+ GetHostPathQ(fn) + " -Fo" + GetHostPathQ(objfile), slot, GetHostPath(objfile), 1))
|
||||
+ GetHostPathQ(fn) + " -Fo" + GetHostPathQ(objfile) + pch, slot, GetHostPath(objfile), 1))
|
||||
execerr = true;
|
||||
}
|
||||
if(execerr)
|
||||
|
|
|
|||
|
|
@ -188,6 +188,11 @@ bool IdeConsoleWait()
|
|||
return the_ide && the_ide->IdeConsoleWait();
|
||||
}
|
||||
|
||||
bool IdeConsoleWait(int slot)
|
||||
{
|
||||
return the_ide && the_ide->IdeConsoleWait(slot);
|
||||
}
|
||||
|
||||
void IdeGotoCodeRef(String s)
|
||||
{
|
||||
if(the_ide) the_ide->IdeGotoCodeRef(s);
|
||||
|
|
|
|||
|
|
@ -55,6 +55,7 @@ public:
|
|||
virtual void IdeConsoleBeginGroup(String group) = 0;
|
||||
virtual void IdeConsoleEndGroup() = 0;
|
||||
virtual bool IdeConsoleWait() = 0;
|
||||
virtual bool IdeConsoleWait(int slot) = 0;
|
||||
|
||||
virtual bool IdeIsDebug() const = 0;
|
||||
virtual void IdeEndDebug() = 0;
|
||||
|
|
@ -109,6 +110,7 @@ void IdeConsoleFlush();
|
|||
void IdeConsoleBeginGroup(String group);
|
||||
void IdeConsoleEndGroup();
|
||||
bool IdeConsoleWait();
|
||||
bool IdeConsoleWait(int slot);
|
||||
void IdeGotoCodeRef(String s);
|
||||
|
||||
String GetDefaultMethod();
|
||||
|
|
@ -391,6 +393,7 @@ struct Builder {
|
|||
String mainpackage;
|
||||
bool doall;
|
||||
bool main_conf;
|
||||
bool allow_pch;
|
||||
|
||||
virtual bool BuildPackage(const String& package, Vector<String>& linkfile, String& linkoptions,
|
||||
const Vector<String>& all_uses, const Vector<String>& all_libraries, int optimize)
|
||||
|
|
|
|||
|
|
@ -415,8 +415,6 @@ bool Hdepend::BlitzApproved(const String& path)
|
|||
return false;
|
||||
if(info.guarded)
|
||||
return true;
|
||||
if(info.guarded)
|
||||
return true;
|
||||
for(int i = 0; i < info.depend.GetCount(); i++)
|
||||
if(!info.bydefine[i] && !map[info.depend[i]].CanBlitz()) {
|
||||
PutVerbose(String().Cat() << map.GetKey(info.depend[i])
|
||||
|
|
|
|||
|
|
@ -141,6 +141,11 @@ bool LocalHost::Wait()
|
|||
return IdeConsoleWait();
|
||||
}
|
||||
|
||||
bool LocalHost::Wait(int slot)
|
||||
{
|
||||
return IdeConsoleWait(slot);
|
||||
}
|
||||
|
||||
One<AProcess> LocalHost::StartProcess(const char *cmdline)
|
||||
{
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ struct Host {
|
|||
virtual bool Run(const char *cmdline, int slot, String key, int blitz_count) = 0;
|
||||
virtual bool Run(const char *cmdline, Stream& out, int slot, String key, int blitz_count) = 0;
|
||||
virtual bool Wait() = 0;
|
||||
virtual bool Wait(int slot) = 0;
|
||||
virtual One<AProcess> StartProcess(const char *cmdline) = 0;
|
||||
virtual void Launch(const char *cmdline, bool console = false) = 0;
|
||||
virtual void AddFlags(Index<String>& cfg) = 0;
|
||||
|
|
@ -56,6 +57,7 @@ struct LocalHost : Host {
|
|||
virtual bool Run(const char *cmdline, int slot, String key, int blitz_count);
|
||||
virtual bool Run(const char *cmdline, Stream& out, int slot, String key, int blitz_count);
|
||||
virtual bool Wait();
|
||||
virtual bool Wait(int slot);
|
||||
virtual One<AProcess> StartProcess(const char *cmdline);
|
||||
virtual void Launch(const char *cmdline, bool console);
|
||||
virtual void AddFlags(Index<String>& cfg);
|
||||
|
|
|
|||
|
|
@ -145,6 +145,7 @@ struct BuildMethods : public WithBuildMethodsLayout<TopWindow>
|
|||
TextOption release_blitz;
|
||||
TextSwitch release_linkmode;
|
||||
TextOption linkmode_lock;
|
||||
TextOption allow_pch;
|
||||
DirTable path;
|
||||
DirTable include;
|
||||
DirTable lib;
|
||||
|
|
@ -219,6 +220,10 @@ BuildMethods::BuildMethods()
|
|||
#endif
|
||||
method.AddCtrl("SCRIPT", scriptfile);
|
||||
method.AddCtrl("LINKMODE_LOCK", linkmode_lock);
|
||||
|
||||
allow_pch.SetLabel("Allow precompiled headers");
|
||||
method.AddCtrl("ALLOW_PRECOMPILED_HEADERS", allow_pch);
|
||||
|
||||
open_script.Attach(scriptfile);
|
||||
open_script.Type("Build scripts (*.bsc)", "*.bsc")
|
||||
.AllFilesType();
|
||||
|
|
|
|||
|
|
@ -572,6 +572,7 @@ public:
|
|||
virtual void IdeConsoleBeginGroup(String group);
|
||||
virtual void IdeConsoleEndGroup();
|
||||
virtual bool IdeConsoleWait();
|
||||
virtual bool IdeConsoleWait(int slot);
|
||||
|
||||
virtual bool IdeIsDebug() const;
|
||||
virtual void IdeEndDebug();
|
||||
|
|
|
|||
|
|
@ -181,36 +181,36 @@ LAYOUT(BuildMethodsLayout, 788, 560)
|
|||
ITEM(EditString, compiler, RightPosZ(264, 116).TopPosZ(4, 19))
|
||||
ITEM(Label, dv___5, SetLabel(t_("&External debugger:")).RightPosZ(152, 100).TopPosZ(4, 19))
|
||||
ITEM(EditString, debugger, RightPosZ(8, 140).TopPosZ(4, 20))
|
||||
ITEM(Label, dv___7, SetLabel(t_("Common options")).LeftPosZ(160, 108).TopPosZ(36, 19))
|
||||
ITEM(EditString, common_options, HSizePosZ(276, 8).TopPosZ(36, 19))
|
||||
ITEM(Label, dv___9, SetLabel(t_("Common C++ options")).LeftPosZ(160, 116).TopPosZ(56, 19))
|
||||
ITEM(EditString, common_cpp_options, HSizePosZ(276, 8).TopPosZ(56, 19))
|
||||
ITEM(Label, dv___11, SetLabel(t_("Common C options")).LeftPosZ(160, 108).TopPosZ(76, 19))
|
||||
ITEM(EditString, common_c_options, HSizePosZ(276, 8).TopPosZ(76, 19))
|
||||
ITEM(Label, dv___13, SetLabel(t_("Common fixed flags")).LeftPosZ(160, 108).TopPosZ(96, 19))
|
||||
ITEM(EditString, common_flags, HSizePosZ(276, 8).TopPosZ(96, 19))
|
||||
ITEM(LabelBox, dv___15, SetLabel(t_("Debug mode defaults")).HSizePosZ(160, 8).TopPosZ(124, 44))
|
||||
ITEM(Label, dv___16, SetLabel(t_("Default debug info level:")).LeftPosZ(168, 132).TopPosZ(140, 19))
|
||||
ITEM(DropList, debug_info, HSizePosZ(304, 368).TopPosZ(140, 19))
|
||||
UNTYPED(debug_blitz, SwitchImage(false).SetLabel(t_("Use BLIT&Z")).HSizePosZ(428, 272).TopPosZ(140, 15))
|
||||
UNTYPED(debug_linkmode, SetLabel(t_("All static\nShared libs\nAll shared")).HSizePosZ(540, -4).TopPosZ(140, 15))
|
||||
ITEM(Label, dv___20, SetLabel(t_("&Debug options:")).LeftPosZ(160, 100).TopPosZ(172, 19))
|
||||
ITEM(EditString, debug_options, HSizePosZ(276, 8).TopPosZ(172, 19))
|
||||
ITEM(Label, dv___22, SetLabel(t_("Debug fixed flags:")).LeftPosZ(160, 100).TopPosZ(192, 19))
|
||||
ITEM(EditString, debug_flags, HSizePosZ(276, 8).TopPosZ(192, 19))
|
||||
ITEM(Label, dv___24, SetLabel(t_("Debug link options:")).LeftPosZ(160, 100).TopPosZ(212, 19))
|
||||
ITEM(EditString, debug_link, HSizePosZ(276, 8).TopPosZ(212, 19))
|
||||
UNTYPED(release_linkmode, SetLabel(t_("All static\nShared libs\nAll shared")).RightPosZ(-8, 256).TopPosZ(256, 15))
|
||||
ITEM(LabelBox, dv___27, SetLabel(t_("Release mode defaults")).RightPosZ(8, 620).TopPosZ(240, 40))
|
||||
UNTYPED(release_blitz, SwitchImage(false).SetLabel(t_("&Use BLITZ")).RightPosZ(364, 256).TopPosZ(256, 15))
|
||||
ITEM(Label, dv___29, SetLabel(t_("Optimize for speed:")).RightPosZ(520, 108).TopPosZ(284, 19))
|
||||
ITEM(EditString, speed_options, RightPosZ(8, 504).TopPosZ(284, 19))
|
||||
ITEM(Label, dv___31, SetLabel(t_("Optimize for size:")).RightPosZ(520, 108).TopPosZ(304, 19))
|
||||
ITEM(EditString, size_options, RightPosZ(8, 504).TopPosZ(304, 19))
|
||||
ITEM(Label, dv___33, SetLabel(t_("Release fixed flags:")).RightPosZ(520, 108).TopPosZ(324, 19))
|
||||
ITEM(EditString, release_flags, RightPosZ(8, 504).TopPosZ(324, 19))
|
||||
ITEM(Label, dv___35, SetLabel(t_("Release link options:")).RightPosZ(520, 108).TopPosZ(344, 19))
|
||||
ITEM(EditString, release_link, RightPosZ(8, 504).TopPosZ(344, 19))
|
||||
ITEM(Label, dv___7, SetLabel(t_("Common options")).LeftPosZ(160, 108).TopPosZ(28, 19))
|
||||
ITEM(EditString, common_options, HSizePosZ(276, 8).TopPosZ(28, 19))
|
||||
ITEM(Label, dv___9, SetLabel(t_("Common C++ options")).LeftPosZ(160, 116).TopPosZ(48, 19))
|
||||
ITEM(EditString, common_cpp_options, HSizePosZ(276, 8).TopPosZ(48, 19))
|
||||
ITEM(Label, dv___11, SetLabel(t_("Common C options")).LeftPosZ(160, 108).TopPosZ(68, 19))
|
||||
ITEM(EditString, common_c_options, HSizePosZ(276, 8).TopPosZ(68, 19))
|
||||
ITEM(Label, dv___13, SetLabel(t_("Common fixed flags")).LeftPosZ(160, 108).TopPosZ(88, 19))
|
||||
ITEM(EditString, common_flags, HSizePosZ(276, 8).TopPosZ(88, 19))
|
||||
ITEM(LabelBox, dv___15, SetLabel(t_("Debug mode defaults")).HSizePosZ(160, 8).TopPosZ(116, 44))
|
||||
ITEM(Label, dv___16, SetLabel(t_("Default debug info level:")).LeftPosZ(168, 132).TopPosZ(132, 19))
|
||||
ITEM(DropList, debug_info, HSizePosZ(304, 368).TopPosZ(132, 19))
|
||||
UNTYPED(debug_blitz, SwitchImage(false).SetLabel(t_("Use BLIT&Z")).HSizePosZ(428, 272).TopPosZ(132, 15))
|
||||
UNTYPED(debug_linkmode, SetLabel(t_("All static\nShared libs\nAll shared")).HSizePosZ(540, -4).TopPosZ(132, 15))
|
||||
ITEM(Label, dv___20, SetLabel(t_("&Debug options:")).LeftPosZ(160, 100).TopPosZ(164, 19))
|
||||
ITEM(EditString, debug_options, HSizePosZ(276, 8).TopPosZ(164, 19))
|
||||
ITEM(Label, dv___22, SetLabel(t_("Debug fixed flags:")).LeftPosZ(160, 100).TopPosZ(184, 19))
|
||||
ITEM(EditString, debug_flags, HSizePosZ(276, 8).TopPosZ(184, 19))
|
||||
ITEM(Label, dv___24, SetLabel(t_("Debug link options:")).LeftPosZ(160, 100).TopPosZ(204, 19))
|
||||
ITEM(EditString, debug_link, HSizePosZ(276, 8).TopPosZ(204, 19))
|
||||
UNTYPED(release_linkmode, SetLabel(t_("All static\nShared libs\nAll shared")).RightPosZ(-8, 256).TopPosZ(248, 15))
|
||||
ITEM(LabelBox, dv___27, SetLabel(t_("Release mode defaults")).RightPosZ(8, 620).TopPosZ(232, 40))
|
||||
UNTYPED(release_blitz, SwitchImage(false).SetLabel(t_("&Use BLITZ")).RightPosZ(364, 256).TopPosZ(248, 15))
|
||||
ITEM(Label, dv___29, SetLabel(t_("Optimize for speed:")).RightPosZ(520, 108).TopPosZ(276, 19))
|
||||
ITEM(EditString, speed_options, RightPosZ(8, 504).TopPosZ(276, 19))
|
||||
ITEM(Label, dv___31, SetLabel(t_("Optimize for size:")).RightPosZ(520, 108).TopPosZ(296, 19))
|
||||
ITEM(EditString, size_options, RightPosZ(8, 504).TopPosZ(296, 19))
|
||||
ITEM(Label, dv___33, SetLabel(t_("Release fixed flags:")).RightPosZ(520, 108).TopPosZ(316, 19))
|
||||
ITEM(EditString, release_flags, RightPosZ(8, 504).TopPosZ(316, 19))
|
||||
ITEM(Label, dv___35, SetLabel(t_("Release link options:")).RightPosZ(520, 108).TopPosZ(336, 19))
|
||||
ITEM(EditString, release_link, RightPosZ(8, 504).TopPosZ(336, 19))
|
||||
UNTYPED(linkmode_lock, LeftPosZ(4, 148).BottomPosZ(156, 20))
|
||||
ITEM(Label, dv___38, SetLabel(t_("Script file:")).LeftPosZ(4, 68).BottomPosZ(133, 19))
|
||||
ITEM(EditField, scriptfile, LeftPosZ(4, 152).BottomPosZ(113, 19))
|
||||
|
|
@ -219,6 +219,7 @@ LAYOUT(BuildMethodsLayout, 788, 560)
|
|||
ITEM(TabCtrl, paths, HSizePosZ(160, 8).VSizePosZ(376, 40))
|
||||
ITEM(Button, ok, SetLabel(t_("OK")).RightPosZ(76, 64).BottomPosZ(10, 22))
|
||||
ITEM(Button, cancel, SetLabel(t_("Cancel")).RightPosZ(8, 64).BottomPosZ(10, 22))
|
||||
UNTYPED(allow_pch, LeftPosZ(160, 212).TopPosZ(356, 16))
|
||||
END_LAYOUT
|
||||
|
||||
LAYOUT(ModePaneLayout, 288, 460)
|
||||
|
|
|
|||
|
|
@ -156,6 +156,12 @@ bool Ide::IdeConsoleWait()
|
|||
return console.Wait();
|
||||
}
|
||||
|
||||
bool Ide::IdeConsoleWait(int slot)
|
||||
{
|
||||
console.Wait(slot);
|
||||
return true;
|
||||
}
|
||||
|
||||
void Ide::IdeSetRight(Ctrl& ctrl)
|
||||
{
|
||||
right.Add(ctrl.SizePos());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue