This repository has been archived on 2025-12-24. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
yachat/qcm/growl.qcm

64 lines
1.5 KiB
Text
Raw Normal View History

2025-12-25 01:37:49 +05:00
/*
-----BEGIN QCMOD-----
name: Growl
arg: with-growl=[path],Path to the Growl framework
-----END QCMOD-----
*/
//----------------------------------------------------------------------------
// qc_growl
//----------------------------------------------------------------------------
class qc_growl : public ConfObj
{
public:
qc_growl(Conf *c) : ConfObj(c) {}
QString name() const { return "Growl"; }
QString shortname() const { return "growl"; }
#ifndef Q_WS_MAC
QString checkString() const { return QString(); }
#endif
// TODO: This should go into ConfObj
bool checkFramework(const QString &path, const QString &name)
{
QString str =
"int main()\n"
"{\n"
" return 0;\n"
"}\n";
QString extra;
if(!path.isEmpty())
extra += QString("-F") + path + ' ';
extra += QString("-framework ") + name;
if(!conf->doCompileAndLink(str, QStringList(), extra, "", NULL))
return false;
return true;
}
// TODO: This should go into ConfObj
void addFrameworkPath(const QString& str)
{
conf->addExtra("QMAKE_CXXFLAGS += -F" + str);
conf->addLib("-F" + str);
}
bool exec()
{
#ifdef Q_WS_MAC
QString growl_path = conf->getenv("QC_WITH_GROWL");
if(!checkFramework(growl_path, "Growl"))
return false;
if(!growl_path.isEmpty())
addFrameworkPath(growl_path);
conf->addLib("-framework Growl");
conf->addDefine("HAVE_GROWL");
return true;
#else
return false;
#endif
}
};