mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-21 06:45:39 -06:00
ide: pkg_config support
git-svn-id: svn://ultimatepp.org/upp/trunk@13559 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
d9441f86d0
commit
13ebef1bff
6 changed files with 30 additions and 10 deletions
|
|
@ -308,6 +308,10 @@ bool MakeBuild::BuildPackage(const Workspace& wspc, int pkindex, int pknumber, i
|
||||||
if(!b)
|
if(!b)
|
||||||
return false;
|
return false;
|
||||||
b->config = PackageConfig(wspc, pkindex, bm, mainparam, *host, *b);
|
b->config = PackageConfig(wspc, pkindex, bm, mainparam, *host, *b);
|
||||||
|
for(int i = 0; i < wspc.GetCount(); i++)
|
||||||
|
for(String h : Split(Gather(wspc.GetPackage(i).pkg_config, b->config.GetKeys()), ' '))
|
||||||
|
b->pkg_config.FindAdd(h);
|
||||||
|
DDUMP(b->pkg_config);
|
||||||
const TargetMode& m = targetmode == 0 ? debug : release;
|
const TargetMode& m = targetmode == 0 ? debug : release;
|
||||||
b->version = m.version;
|
b->version = m.version;
|
||||||
b->method = method;
|
b->method = method;
|
||||||
|
|
|
||||||
|
|
@ -14,8 +14,10 @@ String GccBuilder::CompilerName() const
|
||||||
String GccBuilder::CmdLine(const String& package, const Package& pkg)
|
String GccBuilder::CmdLine(const String& package, const Package& pkg)
|
||||||
{
|
{
|
||||||
String cc = CompilerName();
|
String cc = CompilerName();
|
||||||
cc << " -c ";
|
cc << " -c";
|
||||||
cc << IncludesDefinesTargetTime(package, pkg);
|
for(String s : pkg_config)
|
||||||
|
cc << " `pkg-config --cflags " << s << "`";
|
||||||
|
cc << ' ' << IncludesDefinesTargetTime(package, pkg);
|
||||||
return cc;
|
return cc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -127,6 +129,10 @@ bool GccBuilder::BuildPackage(const String& package, Vector<String>& linkfile, V
|
||||||
}
|
}
|
||||||
|
|
||||||
String cc = CmdLine(package, pkg);
|
String cc = CmdLine(package, pkg);
|
||||||
|
|
||||||
|
DDUMP(pkg_config);
|
||||||
|
DDUMP(cc);
|
||||||
|
|
||||||
if(HasFlag("WIN32")/* && HasFlag("MT")*/)
|
if(HasFlag("WIN32")/* && HasFlag("MT")*/)
|
||||||
cc << " -mthreads";
|
cc << " -mthreads";
|
||||||
if(HasFlag("DEBUG_MINIMAL"))
|
if(HasFlag("DEBUG_MINIMAL"))
|
||||||
|
|
@ -523,6 +529,8 @@ bool GccBuilder::Link(const Vector<String>& linkfile, const String& linkoptions,
|
||||||
}
|
}
|
||||||
if(!HasFlag("SOLARIS") && !HasFlag("OSX") && !HasFlag("OBJC"))
|
if(!HasFlag("SOLARIS") && !HasFlag("OSX") && !HasFlag("OBJC"))
|
||||||
lnk << " -Wl,--start-group ";
|
lnk << " -Wl,--start-group ";
|
||||||
|
for(String s : pkg_config)
|
||||||
|
lnk << " `pkg-config --libs " << s << "`";
|
||||||
for(int pass = 0; pass < 2; pass++) {
|
for(int pass = 0; pass < 2; pass++) {
|
||||||
for(i = 0; i < lib.GetCount(); i++) {
|
for(i = 0; i < lib.GetCount(); i++) {
|
||||||
String ln = lib[i];
|
String ln = lib[i];
|
||||||
|
|
|
||||||
|
|
@ -347,6 +347,7 @@ public:
|
||||||
Array<OptItem> link;
|
Array<OptItem> link;
|
||||||
Array<OptItem> option;
|
Array<OptItem> option;
|
||||||
Array<OptItem> include;
|
Array<OptItem> include;
|
||||||
|
Array<OptItem> pkg_config;
|
||||||
Array<File> file;
|
Array<File> file;
|
||||||
Array<Config> config;
|
Array<Config> config;
|
||||||
Array<CustomStep> custom;
|
Array<CustomStep> custom;
|
||||||
|
|
@ -442,6 +443,8 @@ struct Builder {
|
||||||
bool main_conf;
|
bool main_conf;
|
||||||
bool allow_pch;
|
bool allow_pch;
|
||||||
FileTime start_time;
|
FileTime start_time;
|
||||||
|
|
||||||
|
Index<String> pkg_config; // names of packages for pkg-config
|
||||||
|
|
||||||
String CmdX(const char *s);
|
String CmdX(const char *s);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -220,6 +220,7 @@ bool Package::Load(const char *path)
|
||||||
link.Clear();
|
link.Clear();
|
||||||
uses.Clear();
|
uses.Clear();
|
||||||
include.Clear();
|
include.Clear();
|
||||||
|
pkg_config.Clear();
|
||||||
accepts.Clear();
|
accepts.Clear();
|
||||||
file.Clear();
|
file.Clear();
|
||||||
config.Clear();
|
config.Clear();
|
||||||
|
|
@ -240,7 +241,8 @@ bool Package::Load(const char *path)
|
||||||
!LoadOpt(p, "flags", flag) &&
|
!LoadOpt(p, "flags", flag) &&
|
||||||
!LoadOpt(p, "target", target) &&
|
!LoadOpt(p, "target", target) &&
|
||||||
!LoadOpt(p, "uses", uses) &&
|
!LoadOpt(p, "uses", uses) &&
|
||||||
!LoadOpt(p, "include", include)) {
|
!LoadOpt(p, "include", include) &&
|
||||||
|
!LoadOpt(p, "pkg_config", pkg_config)) {
|
||||||
if(p.Id("charset"))
|
if(p.Id("charset"))
|
||||||
charset = CharsetByNameX(p.ReadString());
|
charset = CharsetByNameX(p.ReadString());
|
||||||
else
|
else
|
||||||
|
|
@ -473,6 +475,7 @@ bool Package::Save(const char *path) const {
|
||||||
putopt(out, "options", option);
|
putopt(out, "options", option);
|
||||||
putopt(out, "link", link);
|
putopt(out, "link", link);
|
||||||
putopt(out, "include", include);
|
putopt(out, "include", include);
|
||||||
|
putopt(out, "pkg_config", pkg_config);
|
||||||
if(file.GetCount()) {
|
if(file.GetCount()) {
|
||||||
out << "file\n";
|
out << "file\n";
|
||||||
int i;
|
int i;
|
||||||
|
|
|
||||||
|
|
@ -234,7 +234,7 @@ void PackageEditor::PackageCursor()
|
||||||
accepts.Enable();
|
accepts.Enable();
|
||||||
option.Enable();
|
option.Enable();
|
||||||
option.Clear();
|
option.Clear();
|
||||||
for(int i = FLAG; i <= INCLUDE; i++)
|
for(int i = FLAG; i <= PKG_LAST; i++)
|
||||||
OptionAdd(i, opt_name[i], *opt[i]);
|
OptionAdd(i, opt_name[i], *opt[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -316,7 +316,7 @@ void PackageEditor::RemoveOption()
|
||||||
if(!option.IsCursor() || IsNull(actualpackage))
|
if(!option.IsCursor() || IsNull(actualpackage))
|
||||||
return;
|
return;
|
||||||
int type = option.Get(0);
|
int type = option.Get(0);
|
||||||
if(type >= FLAG && type <= INCLUDE) {
|
if(type >= FLAG && type <= PKG_LAST) {
|
||||||
Array<OptItem>& m = *opt[type];
|
Array<OptItem>& m = *opt[type];
|
||||||
int i = option.Get(1);
|
int i = option.Get(1);
|
||||||
if(i >= 0 && i < m.GetCount())
|
if(i >= 0 && i < m.GetCount())
|
||||||
|
|
@ -342,7 +342,7 @@ void PackageEditor::EditOption()
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(type >= FLAG && type <= INCLUDE) {
|
if(type >= FLAG && type <= PKG_LAST) {
|
||||||
Array<OptItem>& m = *opt[type];
|
Array<OptItem>& m = *opt[type];
|
||||||
int i = option.Get(1);
|
int i = option.Get(1);
|
||||||
if(i >= 0 && i < m.GetCount()) {
|
if(i >= 0 && i < m.GetCount()) {
|
||||||
|
|
@ -363,7 +363,7 @@ void PackageEditor::MoveOption(int d)
|
||||||
if(!option.IsCursor() || IsNull(actualpackage))
|
if(!option.IsCursor() || IsNull(actualpackage))
|
||||||
return;
|
return;
|
||||||
int type = option.Get(0);
|
int type = option.Get(0);
|
||||||
if(type >= FLAG && type <= INCLUDE) {
|
if(type >= FLAG && type <= PKG_LAST) {
|
||||||
Array<OptItem>& m = *opt[type];
|
Array<OptItem>& m = *opt[type];
|
||||||
int i = option.Get(1);
|
int i = option.Get(1);
|
||||||
if(min(i, i + d) >= 0 && max(i, i + d) < m.GetCount()) {
|
if(min(i, i + d) >= 0 && max(i, i + d) < m.GetCount()) {
|
||||||
|
|
@ -378,7 +378,7 @@ void PackageEditor::OptionMenu(Bar& bar)
|
||||||
{
|
{
|
||||||
bool b = !IsNull(actualpackage);
|
bool b = !IsNull(actualpackage);
|
||||||
bar.Add(b, "Add package..", IdeImg::package_add(), THISBACK1(AddOption, USES));
|
bar.Add(b, "Add package..", IdeImg::package_add(), THISBACK1(AddOption, USES));
|
||||||
for(int j = FLAG; j <= INCLUDE; j++)
|
for(int j = FLAG; j <= PKG_LAST; j++)
|
||||||
if(j != USES)
|
if(j != USES)
|
||||||
bar.Add(b, "New " + opt_name[j] + "..", THISBACK1(AddOption, j));
|
bar.Add(b, "New " + opt_name[j] + "..", THISBACK1(AddOption, j));
|
||||||
bar.Separator();
|
bar.Separator();
|
||||||
|
|
@ -391,7 +391,7 @@ void PackageEditor::OptionMenu(Bar& bar)
|
||||||
int type = option.IsCursor() ? (int)option.Get(0) : -1;
|
int type = option.IsCursor() ? (int)option.Get(0) : -1;
|
||||||
int i = -1;
|
int i = -1;
|
||||||
Array<OptItem> *m = NULL;
|
Array<OptItem> *m = NULL;
|
||||||
if(type >= FLAG && type <= INCLUDE) {
|
if(type >= FLAG && type <= PKG_LAST) {
|
||||||
m = opt[type];
|
m = opt[type];
|
||||||
i = option.Get(1);
|
i = option.Get(1);
|
||||||
}
|
}
|
||||||
|
|
@ -646,6 +646,7 @@ PackageEditor::PackageEditor()
|
||||||
Add("Link options", actual.link);
|
Add("Link options", actual.link);
|
||||||
Add("Compiler options", actual.option);
|
Add("Compiler options", actual.option);
|
||||||
Add("Internal includes", actual.include);
|
Add("Internal includes", actual.include);
|
||||||
|
Add("pkg-config", actual.pkg_config);
|
||||||
|
|
||||||
Init(option);
|
Init(option);
|
||||||
option.WhenCursor = THISBACK(AdjustPackageOptionCursor);
|
option.WhenCursor = THISBACK(AdjustPackageOptionCursor);
|
||||||
|
|
|
||||||
|
|
@ -413,7 +413,8 @@ struct PackageEditor : WorkspaceWork, WithUppLayout<TopWindow> {
|
||||||
virtual void PackageCursor();
|
virtual void PackageCursor();
|
||||||
|
|
||||||
enum OptionType {
|
enum OptionType {
|
||||||
FLAG = 0, USES, TARGET, LIBRARY, STATIC_LIBRARY, LINK, COMPILER, INCLUDE,
|
FLAG = 0, USES, TARGET, LIBRARY, STATIC_LIBRARY, LINK, COMPILER, INCLUDE, PKG_CONFIG,
|
||||||
|
PKG_LAST = PKG_CONFIG,
|
||||||
FILEOPTION, FILEDEPENDS
|
FILEOPTION, FILEDEPENDS
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue