build system now is like qt 4.2

svn path=/trunk/kdesupport/qca/; revision=664012
This commit is contained in:
Justin Karneges 2007-05-12 22:35:15 +00:00
parent f85cccff59
commit 34efc21f23
8 changed files with 263 additions and 83 deletions

View File

@ -2,8 +2,8 @@ unix:include(confapp_unix.pri)
windows:include(confapp_win.pri)
CONFIG(debug, debug|release) {
unix:QCA_LIBNAME = qca_debug
else:QCA_LIBNAME = qcad
windows:QCA_LIBNAME = qcad
mac:QCA_LIBNAME = qca_debug
} else {
QCA_LIBNAME = qca
}

View File

@ -4,9 +4,9 @@ CONFIG *= qt
INCLUDEPATH += $$QCA_PREFIX/include/QtCrypto
LIBS += -L$$QCA_PREFIX/lib
LINKAGE = -lqca
CONFIG(debug, debug|release) {
unix:LIBS += -lqca_debug
else:LIBS += -lqcad
} else {
LIBS += -lqca
windows:LINKAGE = -lqcad
mac:LINKAGE = -lqca_debug
}
LIBS += $$LINKAGE

7
qca.qc
View File

@ -8,7 +8,12 @@
<dep type='qt42'>
<required/>
</dep>
<dep type='dnotify'/>
<dep type='buildmode'>
<required/>
</dep>
<dep type='universal'>
<required/>
</dep>
<dep type='extra'>
<required/>
</dep>

167
qcm/buildmode.qcm Normal file
View File

@ -0,0 +1,167 @@
/*
-----BEGIN QCMOD-----
name: buildmode
section: project
arg: release,Build with debugging turned off (default).
arg: debug,Build with debugging turned on.
arg: debug-and-release,Build two versions, with and without debugging turned on (mac only).
arg: no-separate-debug-info,Do not store debug information in a separate file (default for mac).
arg: separate-debug-info,Strip debug information into a separate .debug file (default for non-mac).
-----END QCMOD-----
arg: no-framework,Do not build as a Mac framework (default).
arg: framework,Build as a Mac framework.
*/
#define QC_BUILDMODE
bool qc_buildmode_release = false;
bool qc_buildmode_debug = false;
bool qc_buildmode_framework = false;
bool qc_buildmode_separate_debug_info = false;
class qc_buildmode : public ConfObj
{
public:
qc_buildmode(Conf *c) : ConfObj(c) {}
QString name() const { return "buildmode"; }
QString shortname() const { return "buildmode"; }
// no output
QString checkString() const { return QString(); }
bool exec()
{
// first, parse out the options
bool opt_release = false;
bool opt_debug = false;
bool opt_debug_and_release = false;
//bool opt_no_framework = false;
//bool opt_framework = false;
bool opt_no_separate_debug_info = false;
bool opt_separate_debug_info = false;
if(conf->getenv("QC_RELEASE") == "Y")
opt_release = true;
if(conf->getenv("QC_DEBUG") == "Y")
opt_debug = true;
if(conf->getenv("QC_DEBUG_AND_RELEASE") == "Y")
opt_debug_and_release = true;
//if(conf->getenv("QC_NO_FRAMEWORK") == "Y")
// opt_no_framework = true;
//if(conf->getenv("QC_FRAMEWORK") == "Y")
// opt_framework = true;
if(conf->getenv("QC_NO_SEPARATE_DEBUG_INFO") == "Y")
opt_no_separate_debug_info = true;
if(conf->getenv("QC_SEPARATE_DEBUG_INFO") == "Y")
opt_separate_debug_info = true;
#ifndef Q_OS_MAC
if(opt_debug_and_release)
{
printf("\nError: The --debug-and-release option is for mac only.\n");
exit(1);
}
#endif
// sanity check exclusive options
int x;
// build mode
x = 0;
if(opt_release)
++x;
if(opt_debug)
++x;
if(opt_debug_and_release)
++x;
if(x > 1)
{
printf("\nError: Use only one of --release, --debug, or --debug-and-release.\n");
exit(1);
}
// framework
/*x = 0;
if(opt_no_framework)
++x;
if(opt_framework)
++x;
if(x > 1)
{
printf("\nError: Use only one of --framework or --no-framework.\n");
exit(1);
}*/
// debug info
x = 0;
if(opt_no_separate_debug_info)
++x;
if(opt_separate_debug_info)
++x;
if(x > 1)
{
printf("\nError: Use only one of --separate-debug-info or --no-separate-debug-info\n");
exit(1);
}
// now process the options
if(opt_release)
qc_buildmode_release = true;
else if(opt_debug)
qc_buildmode_debug = true;
else if(opt_debug_and_release)
{
qc_buildmode_release = true;
qc_buildmode_debug = true;
}
else // default
qc_buildmode_release = true;
/*if(opt_framework)
qc_buildmode_framework = true;
else if(opt_no_framework)
{
// nothing to do
}
else // default
{
// nothing to do
}*/
if(opt_separate_debug_info)
qc_buildmode_separate_debug_info = true;
else if(opt_no_separate_debug_info)
{
// nothing to do
}
else // default
{
#ifndef Q_OS_MAC
qc_buildmode_separate_debug_info = true;
#endif
}
// make the string
QStringList opts;
if(qc_buildmode_release && qc_buildmode_debug)
{
opts += "debug_and_release";
opts += "build_all";
}
else if(qc_buildmode_release)
opts += "release";
else // qc_buildmode_debug
opts += "debug";
//if(qc_buildmode_framework)
// opts += "lib_bundle";
if(qc_buildmode_separate_debug_info)
opts += "separate_debug_info";
QString str = QString("CONFIG += ") + opts.join(" ") + '\n';
conf->addExtra(str);
return true;
}
};

View File

@ -1,44 +0,0 @@
/*
-----BEGIN QCMOD-----
name: Linux Directory Notification
-----END QCMOD-----
*/
#include<unistd.h>
#include<fcntl.h>
#include<signal.h>
#include<sys/utsname.h>
//----------------------------------------------------------------------------
// qc_dnotify
//----------------------------------------------------------------------------
class qc_dnotify : public ConfObj
{
public:
qc_dnotify(Conf *c) : ConfObj(c) { }
QString name() const { return "Linux Directory Notification"; }
QString shortname() const { return "dnotify"; }
bool exec()
{
QString str =
"#define _GNU_SOURCE\n"
"#include<unistd.h>\n"
"#include<fcntl.h>\n"
"#include<signal.h>\n"
"#include<sys/utsname.h>\n"
"\n"
"int main()\n"
"{\n"
" DN_DELETE|DN_CREATE|DN_RENAME|DN_MULTISHOT|DN_MODIFY|DN_ATTRIB;\n"
" return 0;\n"
"}\n";
int ret;
if (!conf->doCompileAndLink(str, QStringList(), QString(), QString(), &ret) || ret != 0)
return false;
conf->addDefine("HAVE_DNOTIFY");
return true;
}
};

View File

@ -2,9 +2,6 @@
-----BEGIN QCMOD-----
name: extra
section: project
arg: release,Build QCA with debugging turned off
arg: debug,Build QCA with debugging turned on
arg: debug-and-release,Build two versions of QCA, with and without debugging turned on (default)
arg: disable-tests,Don't build examples and unittests
-----END QCMOD-----
*/
@ -33,45 +30,49 @@ public:
QString str;
QFile f;
str = QString();
bool release = false;
bool debug = false;
QString config_buildmode;
if(conf->getenv("QC_RELEASE") == "Y")
{
release = true;
config_buildmode = "CONFIG += release\n";
}
else if(conf->getenv("QC_DEBUG") == "Y")
{
debug = true;
config_buildmode = "CONFIG += debug\n";
}
else // if(conf->getenv("QC_DEBUG_AND_RELEASE") == "Y")
{
release = true;
debug = true;
config_buildmode = "CONFIG += debug_and_release build_all\n";
}
str += config_buildmode;
if(conf->getenv("QC_DISABLE_TESTS") == "Y")
str += "QCA_NO_TESTS = 1\n";
conf->addExtra(str);
bool release = true;
bool debug = false;
bool debug_info = false;
bool universal = false;
QString sdk;
#ifdef QC_BUILDMODE
release = qc_buildmode_release;
debug = qc_buildmode_debug;
debug_info = qc_buildmode_separate_debug_info;
#endif
#ifdef QC_UNIVERSAL
universal = qc_universal_enabled;
sdk = qc_universal_sdk;
#endif
// write confapp_unix.pri
str = QString();
QString var = conf->getenv("BINDIR");
if(!var.isEmpty())
str += QString("BINDIR = %1\n").arg(var);
str += QString("BINDIR = %1\n").arg(var);
if(debug) // debug or debug-and-release
str += QString("CONFIG += debug\n");
else // release
str += QString("CONFIG += release\n");
if(debug_info)
str += QString("CONFIG += separate_debug_info\n");
if(universal)
{
str +=
"contains(QT_CONFIG,x86):contains(QT_CONFIG,ppc) {\n"
" CONFIG += x86 ppc\n"
"}\n";
if(!sdk.isEmpty())
str += QString("QMAKE_MAC_SDK = %1\n").arg(sdk);
}
f.setFileName("confapp_unix.pri");
if(f.open(QFile::WriteOnly | QFile::Truncate))
f.write(str.toLatin1());

49
qcm/universal.qcm Normal file
View File

@ -0,0 +1,49 @@
/*
-----BEGIN QCMOD-----
name: Mac universal binary support
section: project
arg: universal,Build with Mac universal binary support.
arg: mac-sdk=[path],Path to Mac universal SDK (PPC host only).
-----END QCMOD-----
*/
#define QC_UNIVERSAL
bool qc_universal_enabled = false;
QString qc_universal_sdk;
//----------------------------------------------------------------------------
// qc_universal
//----------------------------------------------------------------------------
class qc_universal : public ConfObj
{
public:
qc_universal(Conf *c) : ConfObj(c) {}
QString name() const { return "Mac universal binary support"; }
QString shortname() const { return "universal"; }
QString checkString() const { return QString(); }
bool exec()
{
#ifdef Q_OS_MAC
if(qc_getenv("QC_MAC_UNIVERSAL") == "Y")
{
qc_universal_enabled = true;
QString str =
"contains(QT_CONFIG,x86):contains(QT_CONFIG,ppc) {\n"
" CONFIG += x86 ppc\n"
"}\n";
QString sdk = qc_getenv("QC_MAC_SDK");
if(!sdk.isEmpty())
{
str += QString("QMAKE_MAC_SDK = %1\n").arg(sdk);
qc_universal_sdk = sdk;
}
conf->addExtra(str);
}
#endif
return true;
}
};

View File

@ -93,7 +93,9 @@ unix: {
INSTALLS += incfiles
}
CONFIG(debug, debug|release) {
unix:TARGET = $$join(TARGET,,,_debug)
else:TARGET = $$join(TARGET,,,d)
!debug_and_release|build_pass {
CONFIG(debug, debug|release) {
mac:TARGET = $$member(TARGET, 0)_debug
windows:TARGET = $$member(TARGET, 0)d
}
}