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)
|
||||
return false;
|
||||
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;
|
||||
b->version = m.version;
|
||||
b->method = method;
|
||||
|
|
|
|||
|
|
@ -15,7 +15,9 @@ String GccBuilder::CmdLine(const String& package, const Package& pkg)
|
|||
{
|
||||
String cc = CompilerName();
|
||||
cc << " -c";
|
||||
cc << IncludesDefinesTargetTime(package, pkg);
|
||||
for(String s : pkg_config)
|
||||
cc << " `pkg-config --cflags " << s << "`";
|
||||
cc << ' ' << IncludesDefinesTargetTime(package, pkg);
|
||||
return cc;
|
||||
}
|
||||
|
||||
|
|
@ -127,6 +129,10 @@ bool GccBuilder::BuildPackage(const String& package, Vector<String>& linkfile, V
|
|||
}
|
||||
|
||||
String cc = CmdLine(package, pkg);
|
||||
|
||||
DDUMP(pkg_config);
|
||||
DDUMP(cc);
|
||||
|
||||
if(HasFlag("WIN32")/* && HasFlag("MT")*/)
|
||||
cc << " -mthreads";
|
||||
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"))
|
||||
lnk << " -Wl,--start-group ";
|
||||
for(String s : pkg_config)
|
||||
lnk << " `pkg-config --libs " << s << "`";
|
||||
for(int pass = 0; pass < 2; pass++) {
|
||||
for(i = 0; i < lib.GetCount(); i++) {
|
||||
String ln = lib[i];
|
||||
|
|
|
|||
|
|
@ -347,6 +347,7 @@ public:
|
|||
Array<OptItem> link;
|
||||
Array<OptItem> option;
|
||||
Array<OptItem> include;
|
||||
Array<OptItem> pkg_config;
|
||||
Array<File> file;
|
||||
Array<Config> config;
|
||||
Array<CustomStep> custom;
|
||||
|
|
@ -443,6 +444,8 @@ struct Builder {
|
|||
bool allow_pch;
|
||||
FileTime start_time;
|
||||
|
||||
Index<String> pkg_config; // names of packages for pkg-config
|
||||
|
||||
String CmdX(const char *s);
|
||||
|
||||
virtual bool BuildPackage(const String& package, Vector<String>& linkfile, Vector<String>& immfile,
|
||||
|
|
|
|||
|
|
@ -220,6 +220,7 @@ bool Package::Load(const char *path)
|
|||
link.Clear();
|
||||
uses.Clear();
|
||||
include.Clear();
|
||||
pkg_config.Clear();
|
||||
accepts.Clear();
|
||||
file.Clear();
|
||||
config.Clear();
|
||||
|
|
@ -240,7 +241,8 @@ bool Package::Load(const char *path)
|
|||
!LoadOpt(p, "flags", flag) &&
|
||||
!LoadOpt(p, "target", target) &&
|
||||
!LoadOpt(p, "uses", uses) &&
|
||||
!LoadOpt(p, "include", include)) {
|
||||
!LoadOpt(p, "include", include) &&
|
||||
!LoadOpt(p, "pkg_config", pkg_config)) {
|
||||
if(p.Id("charset"))
|
||||
charset = CharsetByNameX(p.ReadString());
|
||||
else
|
||||
|
|
@ -473,6 +475,7 @@ bool Package::Save(const char *path) const {
|
|||
putopt(out, "options", option);
|
||||
putopt(out, "link", link);
|
||||
putopt(out, "include", include);
|
||||
putopt(out, "pkg_config", pkg_config);
|
||||
if(file.GetCount()) {
|
||||
out << "file\n";
|
||||
int i;
|
||||
|
|
|
|||
|
|
@ -234,7 +234,7 @@ void PackageEditor::PackageCursor()
|
|||
accepts.Enable();
|
||||
option.Enable();
|
||||
option.Clear();
|
||||
for(int i = FLAG; i <= INCLUDE; i++)
|
||||
for(int i = FLAG; i <= PKG_LAST; i++)
|
||||
OptionAdd(i, opt_name[i], *opt[i]);
|
||||
}
|
||||
}
|
||||
|
|
@ -316,7 +316,7 @@ void PackageEditor::RemoveOption()
|
|||
if(!option.IsCursor() || IsNull(actualpackage))
|
||||
return;
|
||||
int type = option.Get(0);
|
||||
if(type >= FLAG && type <= INCLUDE) {
|
||||
if(type >= FLAG && type <= PKG_LAST) {
|
||||
Array<OptItem>& m = *opt[type];
|
||||
int i = option.Get(1);
|
||||
if(i >= 0 && i < m.GetCount())
|
||||
|
|
@ -342,7 +342,7 @@ void PackageEditor::EditOption()
|
|||
}
|
||||
return;
|
||||
}
|
||||
if(type >= FLAG && type <= INCLUDE) {
|
||||
if(type >= FLAG && type <= PKG_LAST) {
|
||||
Array<OptItem>& m = *opt[type];
|
||||
int i = option.Get(1);
|
||||
if(i >= 0 && i < m.GetCount()) {
|
||||
|
|
@ -363,7 +363,7 @@ void PackageEditor::MoveOption(int d)
|
|||
if(!option.IsCursor() || IsNull(actualpackage))
|
||||
return;
|
||||
int type = option.Get(0);
|
||||
if(type >= FLAG && type <= INCLUDE) {
|
||||
if(type >= FLAG && type <= PKG_LAST) {
|
||||
Array<OptItem>& m = *opt[type];
|
||||
int i = option.Get(1);
|
||||
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);
|
||||
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)
|
||||
bar.Add(b, "New " + opt_name[j] + "..", THISBACK1(AddOption, j));
|
||||
bar.Separator();
|
||||
|
|
@ -391,7 +391,7 @@ void PackageEditor::OptionMenu(Bar& bar)
|
|||
int type = option.IsCursor() ? (int)option.Get(0) : -1;
|
||||
int i = -1;
|
||||
Array<OptItem> *m = NULL;
|
||||
if(type >= FLAG && type <= INCLUDE) {
|
||||
if(type >= FLAG && type <= PKG_LAST) {
|
||||
m = opt[type];
|
||||
i = option.Get(1);
|
||||
}
|
||||
|
|
@ -646,6 +646,7 @@ PackageEditor::PackageEditor()
|
|||
Add("Link options", actual.link);
|
||||
Add("Compiler options", actual.option);
|
||||
Add("Internal includes", actual.include);
|
||||
Add("pkg-config", actual.pkg_config);
|
||||
|
||||
Init(option);
|
||||
option.WhenCursor = THISBACK(AdjustPackageOptionCursor);
|
||||
|
|
|
|||
|
|
@ -413,7 +413,8 @@ struct PackageEditor : WorkspaceWork, WithUppLayout<TopWindow> {
|
|||
virtual void PackageCursor();
|
||||
|
||||
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
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue