mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-16 14:16:09 -06:00
refactored includes and defines
This commit is contained in:
parent
4b6d63e0ec
commit
34eaef290c
11 changed files with 106 additions and 38 deletions
|
|
@ -796,7 +796,7 @@ void ExtractIncludes(Index<String>& r, String h)
|
|||
}
|
||||
|
||||
String Ide::GetIncludePath()
|
||||
{
|
||||
{ // TODO: remove
|
||||
if(include_path.GetCount())
|
||||
return include_path;
|
||||
SetupDefaultMethod();
|
||||
|
|
@ -853,6 +853,7 @@ String Ide::GetIncludePath()
|
|||
}
|
||||
}
|
||||
|
||||
// TODO: replicate with clang
|
||||
const Workspace& wspc = GetIdeWorkspace();
|
||||
Host dummy_host;
|
||||
One<Builder> b = CreateBuilder(&dummy_host);
|
||||
|
|
@ -875,6 +876,50 @@ String Ide::GetIncludePath()
|
|||
return include_path;
|
||||
}
|
||||
|
||||
String Ide::GetCurrentIncludePath()
|
||||
{
|
||||
String include_path;
|
||||
VectorMap<String, String> bm = GetMethodVars(method);
|
||||
include_path = Join(GetUppDirs(), ";") + ';' + bm.Get("INCLUDE", "");
|
||||
|
||||
const Workspace& wspc = GetIdeWorkspace();
|
||||
Host dummy_host;
|
||||
One<Builder> b = CreateBuilder(&dummy_host);
|
||||
Index<String> pkg_config;
|
||||
for(int i = 0; i < wspc.GetCount(); i++) {
|
||||
const Package& pkg = wspc.GetPackage(i);
|
||||
for(int j = 0; j < pkg.include.GetCount(); j++)
|
||||
MergeWith(include_path, ";", SourcePath(wspc[i], pkg.include[j].text));
|
||||
for(String h : Split(Gather(pkg.pkg_config, b->config.GetKeys()), ' '))
|
||||
pkg_config.FindAdd(h);
|
||||
}
|
||||
|
||||
static VectorMap<String, String> cflags;
|
||||
for(String s : pkg_config) {
|
||||
int q = cflags.Find(s);
|
||||
if(q < 0) {
|
||||
q = cflags.GetCount();
|
||||
cflags.Add(s, Sys("pkg-config --cflags " + s));
|
||||
}
|
||||
for(String p : Split(cflags[q], ' '))
|
||||
if(p.TrimStart("-I"))
|
||||
MergeWith(include_path, ";", p);
|
||||
}
|
||||
|
||||
return include_path;
|
||||
}
|
||||
|
||||
String Ide::GetCurrentDefines()
|
||||
{
|
||||
Index<String> flags;
|
||||
flags = SplitFlags(mainconfigparam, false); // TODO: MAIN
|
||||
AddHostFlags(flags);
|
||||
String r;
|
||||
for(String s : flags)
|
||||
MergeWith(r, ";", "flag" + s);
|
||||
return r;
|
||||
}
|
||||
|
||||
String Ide::IdeGetIncludePath()
|
||||
{
|
||||
return GetIncludePath();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue