source: psi/trunk/qcm/growl.qcm@ 59

Last change on this file since 59 was 2, checked in by dmik, 19 years ago

Imported original Psi 0.10 sources from Affinix

File size: 1.4 KB
Line 
1/*
2-----BEGIN QCMOD-----
3name: Growl
4arg: with-growl=[path],Path to the Growl framework
5-----END QCMOD-----
6*/
7
8//----------------------------------------------------------------------------
9// qc_growl
10//----------------------------------------------------------------------------
11class qc_growl : public ConfObj
12{
13public:
14 qc_growl(Conf *c) : ConfObj(c) {}
15 QString name() const { return "Growl"; }
16 QString shortname() const { return "growl"; }
17
18 // TODO: This should go into ConfObj
19 bool checkFramework(const QString &path, const QString &name)
20 {
21 QString str =
22 "int main()\n"
23 "{\n"
24 " return 0;\n"
25 "}\n";
26
27 QString extra;
28 if(!path.isEmpty())
29 extra += QString("-F") + path + ' ';
30 extra += QString("-framework ") + name;
31 if(!conf->doCompileAndLink(str, extra))
32 return false;
33 return true;
34 }
35
36 // TODO: This should go into ConfObj
37 void addFrameworkPath(const QString& str)
38 {
39 conf->addExtra("QMAKE_CXXFLAGS += -F" + str);
40 conf->addLib("-F" + str);
41 }
42
43 bool exec()
44 {
45#ifdef Q_WS_MAC
46 QString growl_path = conf->getenv("QC_WITH_GROWL");
47 if(!checkFramework(growl_path, "Growl"))
48 return false;
49
50 if(!growl_path.isEmpty())
51 addFrameworkPath(growl_path);
52 conf->addLib("-framework Growl");
53 conf->addDefine("HAVE_GROWL");
54
55 return true;
56#else
57 return false;
58#endif
59 }
60};
Note: See TracBrowser for help on using the repository browser.