ide: Optimised build system / pkg-config handling

This commit is contained in:
Mirek Fidler 2022-12-20 14:52:04 +01:00
parent e46cd032cd
commit d85ef7540e
7 changed files with 27 additions and 1 deletions

View file

@ -30,6 +30,7 @@ void Ide::BeginBuilding(bool clear_console)
{
SetupDefaultMethod();
HdependTimeDirty();
Builder::cmdx_cache.Clear();
Renumber();
StopDebug();
ShowConsole();

View file

@ -444,6 +444,7 @@ Vector<String> MakeBuild::GetAllLibraries(const Workspace& wspc, int index,
bool MakeBuild::Build(const Workspace& wspc, String mainparam, String outfile, bool clear_console)
{
InitBlitz();
Builder::cmdx_cache.Clear();
String hfile = outfile + ".xxx";
SaveFile(hfile, "");

View file

@ -32,6 +32,8 @@ Time Builder::GetFileTime(const String& path) const
return GetFileInfo(path);
}
VectorMap<String, String> Builder::cmdx_cache;
String Builder::CmdX(const char *s)
{ // expand ` character delimited sections by executing them as commands
String r, cmd;
@ -39,7 +41,15 @@ String Builder::CmdX(const char *s)
for(; *s; s++)
if(*s == '`') {
if(cmdf) {
r << Sys(cmd);
int q = cmdx_cache.Find(cmd);
if(q >= 0)
r << cmdx_cache[q];
else {
String h = Sys(cmd);
r << h;
cmdx_cache.Add(cmd, h);
IdeProcessEvents();
}
cmd.Clear();
}
cmdf = !cmdf;

View file

@ -179,6 +179,8 @@ public:
virtual bool IdeConsoleWait() = 0;
virtual bool IdeConsoleWait(int slot) = 0;
virtual void IdeConsoleOnFinish(Event<> cb) = 0;
virtual void IdeProcessEvents() = 0;
virtual bool IdeIsDebug() const = 0;
virtual void IdeEndDebug() = 0;
@ -243,6 +245,8 @@ bool IdeConsoleWait();
bool IdeConsoleWait(int slot);
void IdeConsoleOnFinish(Event<> cb);
void IdeProcessEvents();
String GetSourcePackage(const String& path);
String GetDefaultMethod();
@ -576,6 +580,8 @@ struct Builder {
Vector<String> Macro;
VectorMap<String, int> tmpfilei; // for naming automatic response files
static VectorMap<String, String> cmdx_cache; // caching e.g. pkg-config
String CmdX(const char *s);

View file

@ -11,6 +11,8 @@ void PutVerbose(const char *s) { if(the_ide) the_ide->PutVerbose(s); }
void PutLinking() { if(the_ide) the_ide->PutLinking(); }
void PutLinkingEnd(bool ok) { if(the_ide) the_ide->PutLinkingEnd(ok); }
void IdeProcessEvents() { if(the_ide) the_ide->IdeProcessEvents(); }
const Workspace& GetIdeWorkspace()
{
if(the_ide)

View file

@ -399,6 +399,7 @@ public:
virtual bool IdeConsoleWait();
virtual bool IdeConsoleWait(int slot);
virtual void IdeConsoleOnFinish(Event<> cb);
virtual void IdeProcessEvents();
virtual bool IdeIsDebug() const;
virtual void IdeEndDebug();

View file

@ -135,6 +135,11 @@ void Ide::IdeConsoleOnFinish(Event<> cb)
console.OnFinish(cb);
}
void Ide::IdeProcessEvents()
{
Ctrl::ProcessEvents();
}
void Ide::IdeSetRight(Ctrl& ctrl)
{
right.Add(ctrl.SizePos());