Skip to content

Commit

Permalink
Added more configure checks. probably not all yet. #275
Browse files Browse the repository at this point in the history
  • Loading branch information
Ri0n committed Oct 23, 2017
1 parent b6c0abc commit f3735e4
Show file tree
Hide file tree
Showing 9 changed files with 212 additions and 192 deletions.
187 changes: 99 additions & 88 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -589,28 +589,87 @@ fi

gen_files() {
cat >"$1/modules.cpp" <<EOT
#line 1 "qt4.qcm"
#line 1 "qt5.qcm"
/*
-----BEGIN QCMOD-----
name: Qt >= 4.7.0
name: Qt >= 5.0.0
-----END QCMOD-----
*/
class qc_qt4 : public ConfObj
class qc_qt5 : public ConfObj
{
public:
qc_qt4(Conf *c) : ConfObj(c) {}
QString name() const { return "Qt >= 4.7.0"; }
QString shortname() const { return "qt4"; }
qc_qt5(Conf *c) : ConfObj(c) {}
QString name() const { return "Qt >= 5.0.0"; }
QString shortname() const { return "qt5"; }
bool exec()
{
return(QT_VERSION >= 0x040700);
return(QT_VERSION >= 0x050000);
}
QString resultString() const
{
return QT_VERSION_STR;
}
};
class QtCompFinder : public ConfObj
{
protected:
QString compId;
QString compShortName;
QString compName;
QString extraConfIfFound;
public:
QtCompFinder(const QString &id,const QString &shortName, const QString &name,
const QString &extraConfIfFound, Conf *c) :
ConfObj(c), compId(id), compShortName(shortName), compName(name),
extraConfIfFound(extraConfIfFound)
{}
QString name() const { return compName; }
QString shortname() const { return compShortName; }
bool exec()
{
QString proextra =
"CONFIG += qt\\n"
"QT -= gui\\n";
"QT += ";
proextra += compId;
proextra += "multimedia\\n";
QString str =
"\\n"
"int main()\\n"
"{\\n"
" return 0;\\n"
"}\\n";
int ret;
if(!conf->doCompileAndLink(str, QStringList(), QString(), proextra, &ret))
return false;
if(ret != 0)
return false;
if (!extraConfIfFound.isEmpty()) {
conf->addExtra("CONFIG += dbus");
}
return true;
}
};
#define QC_AS_STR(s) #s
#define QC_FIND_QT_COMP_E(id, shortname, name, extraConfIfFound) \\
class qc_##shortname : public QtCompFinder \\
{ \\
public: \\
qc_##shortname(Conf *c) : QtCompFinder(QC_AS_STR(id), QC_AS_STR(shortname), QC_AS_STR(name), extraConfIfFound, c) {} \\
};
#define QC_FIND_QT_COMP(id, shortname, name) QC_FIND_QT_COMP_E(id, shortname, name, "")
#line 1 "buildmodeapp.qcm"
/*
-----BEGIN QCMOD-----
Expand Down Expand Up @@ -1299,49 +1358,8 @@ name: QDBUS
//----------------------------------------------------------------------------
// qc_qdbus
//----------------------------------------------------------------------------
class qc_qdbus : public ConfObj
{
public:
qc_qdbus(Conf *c) : ConfObj(c) {}
QString name() const { return "QDBUS"; }
QString shortname() const { return "qdbus"; }
#ifdef Q_OS_WIN
QString checkString() const { return QString(); }
#endif
bool exec()
{
#ifdef Q_OS_WIN
// skip dbus support on windows
return false;
#else
if (!conf->getenv("QC_DISABLE_qdbus").isEmpty())
return false;
// test for "qdbus" feature
QString proextra =
"CONFIG += qt\\n"
"QT -= gui\\n";
"QT += dbus\\n";
QString str =
"\\n"
"int main()\\n"
"{\\n"
" return 0;\\n"
"}\\n";
int ret;
if(!conf->doCompileAndLink(str, QStringList(), QString(), proextra, &ret))
return false;
if(ret != 0)
return false;
conf->addExtra("CONFIG += dbus");
return true;
#endif
}
};
// id, shortname, name, extraConfIfFound
QC_FIND_QT_COMP_E(dbus, qdbus, QtDbus, "CONFIG += dbus")
#line 1 "qtmultimedia.qcm"
/*
-----BEGIN QCMOD-----
Expand All @@ -1352,45 +1370,32 @@ name: QtMultimedia
//----------------------------------------------------------------------------
// qc_qtmultimedia
//----------------------------------------------------------------------------
class qc_qtmultimedia : public ConfObj
{
public:
qc_qtmultimedia(Conf *c) : ConfObj(c) {}
QString name() const { return "QtMultimedia"; }
QString shortname() const { return "qtmultimedia"; }
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
QString checkString() const { return QString(); }
#endif
bool exec()
{
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
// was not required with qt4
return true;
#else
// test for "qtmultimedia" feature
QString proextra =
"CONFIG += qt\\n"
"QT -= gui\\n";
"QT += multimedia\\n";
QString str =
"\\n"
"int main()\\n"
"{\\n"
" return 0;\\n"
"}\\n";
// id, shortname, name
QC_FIND_QT_COMP(multimedia, qtmultimedia, QtMultimedia)
#line 1 "qtconcurrent.qcm"
/*
-----BEGIN QCMOD-----
name: QtConcurrent
-----END QCMOD-----
*/
int ret;
if(!conf->doCompileAndLink(str, QStringList(), QString(), proextra, &ret))
return false;
if(ret != 0)
return false;
//----------------------------------------------------------------------------
// qc_qtconcurrent
//----------------------------------------------------------------------------
// id, shortname, name
QC_FIND_QT_COMP(concurrent, qtconcurrent, QtConcurrent)
#line 1 "qtwidgets.qcm"
/*
-----BEGIN QCMOD-----
name: QtWidgets
-----END QCMOD-----
*/
return true;
#endif
}
};
//----------------------------------------------------------------------------
// qc_qtwidgets
//----------------------------------------------------------------------------
// id, shortname, name
QC_FIND_QT_COMP(widgets, qtwidgets, QtWidgets)
#line 1 "webkit.qcm"
/*
-----BEGIN QCMOD-----
Expand Down Expand Up @@ -2236,7 +2241,7 @@ public:
EOT
cat >"$1/modules_new.cpp" <<EOT
o = new qc_qt4(conf);
o = new qc_qt5(conf);
o->required = true;
o->disabled = false;
o = new qc_buildmodeapp(conf);
Expand Down Expand Up @@ -2266,6 +2271,12 @@ cat >"$1/modules_new.cpp" <<EOT
o = new qc_qtmultimedia(conf);
o->required = true;
o->disabled = false;
o = new qc_qtconcurrent(conf);
o->required = true;
o->disabled = false;
o = new qc_qtwidgets(conf);
o->required = true;
o->disabled = false;
o = new qc_webkit(conf);
o->required = false;
o->disabled = true;
Expand Down
Binary file modified configure.exe
Binary file not shown.
8 changes: 7 additions & 1 deletion psi.qc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<moddir>qcm</moddir>
<libdir/>
<datadir/>
<dep type='qt4'>
<dep type='qt5'>
<required/>
</dep>
<dep type='buildmodeapp'>
Expand Down Expand Up @@ -33,6 +33,12 @@
<dep type='qtmultimedia'>
<required/>
</dep>
<dep type='qtconcurrent'>
<required/>
</dep>
<dep type='qtwidgets'>
<required/>
</dep>
<dep type='webkit'>
<disabled/>
</dep>
Expand Down
45 changes: 2 additions & 43 deletions qcm/qdbus.qcm
Original file line number Diff line number Diff line change
Expand Up @@ -7,46 +7,5 @@ name: QDBUS
//----------------------------------------------------------------------------
// qc_qdbus
//----------------------------------------------------------------------------
class qc_qdbus : public ConfObj
{
public:
qc_qdbus(Conf *c) : ConfObj(c) {}
QString name() const { return "QDBUS"; }
QString shortname() const { return "qdbus"; }
#ifdef Q_OS_WIN
QString checkString() const { return QString(); }
#endif
bool exec()
{
#ifdef Q_OS_WIN
// skip dbus support on windows
return false;
#else
if (!conf->getenv("QC_DISABLE_qdbus").isEmpty())
return false;

// test for "qdbus" feature

QString proextra =
"CONFIG += qt\n"
"QT -= gui\n";
"QT += dbus\n";

QString str =
"\n"
"int main()\n"
"{\n"
" return 0;\n"
"}\n";

int ret;
if(!conf->doCompileAndLink(str, QStringList(), QString(), proextra, &ret))
return false;
if(ret != 0)
return false;

conf->addExtra("CONFIG += dbus");
return true;
#endif
}
};
// id, shortname, name, extraConfIfFound
QC_FIND_QT_COMP_E(dbus, qdbus, QtDbus, "CONFIG += dbus")
21 changes: 0 additions & 21 deletions qcm/qt4.qcm

This file was deleted.

Loading

0 comments on commit f3735e4

Please sign in to comment.