From 1633001df881c70f301b5894971612a08eedaf7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Remko=20Tron=C3=A7on?= Date: Sun, 9 Aug 2009 16:59:13 +0200 Subject: Add SConscript files. diff --git a/.gitignore b/.gitignore index 697ca06..1f85c80 100644 --- a/.gitignore +++ b/.gitignore @@ -29,6 +29,8 @@ config.log config.status configure Makefile.config +.sconf_temp +.sconsign.dblite Swiften/Examples/TuneBot/TuneBot Swiften/QA/ClientTest/ClientTest Swiften/config.h diff --git a/3rdParty/Boost/SConscript b/3rdParty/Boost/SConscript new file mode 100644 index 0000000..d75ac29 --- /dev/null +++ b/3rdParty/Boost/SConscript @@ -0,0 +1,63 @@ +Import("env") + +cppdefines = ["BOOST_ALL_NO_LIB", ("BOOST_SIGNALS_NAMESPACE", "bsignals")] +env["BOOST_FLAGS"] = { + "CPPFLAGS": ["-I" + Dir(".").abspath], + "CPPDEFINES": cppdefines, + "LIBPATH": [Dir(".")], + "LIBS": ["Boost"] + } + +sources = [ + "libs/date_time/src/gregorian/date_generators.cpp", + "libs/date_time/src/gregorian/greg_month.cpp", + "libs/date_time/src/gregorian/greg_weekday.cpp", + "libs/date_time/src/gregorian/gregorian_types.cpp", + "libs/date_time/src/posix_time/posix_time_types.cpp", + "libs/system/src/error_code.cpp", + "libs/thread/src/tss_null.cpp", + "libs/signals/src/connection.cpp", + "libs/signals/src/named_slot_map.cpp", + "libs/signals/src/signal_base.cpp", + "libs/signals/src/slot.cpp", + "libs/signals/src/trackable.cpp", + "libs/filesystem/src/operations.cpp", + "libs/filesystem/src/path.cpp", + "libs/filesystem/src/portability.cpp", + "libs/filesystem/src/utf8_codecvt_facet.cpp", + "libs/regex/src/c_regex_traits.cpp", + "libs/regex/src/cpp_regex_traits.cpp", + "libs/regex/src/cregex.cpp", + "libs/regex/src/fileiter.cpp", + "libs/regex/src/icu.cpp", + "libs/regex/src/instances.cpp", + "libs/regex/src/posix_api.cpp", + "libs/regex/src/regex.cpp", + "libs/regex/src/regex_debug.cpp", + "libs/regex/src/regex_raw_buffer.cpp", + "libs/regex/src/regex_traits_defaults.cpp", + "libs/regex/src/static_mutex.cpp", + "libs/regex/src/w32_regex_traits.cpp", + "libs/regex/src/wc_regex_traits.cpp", + "libs/regex/src/wide_posix_api.cpp", + "libs/regex/src/winstances.cpp", + "libs/regex/src/usinstances.cpp"] + +if env.get("HAVE_PTHREAD", 0) : + sources += [ + "libs/thread/src/pthread/exceptions.cpp", + "libs/thread/src/pthread/once.cpp", + "libs/thread/src/pthread/thread.cpp"] + env["BOOST_FLAGS"]["LIBS"] += ["pthread"] +else : + sources += [ + "win32_stubs.cpp", + "libs/thread/src/win32/exceptions.cpp", + "libs/thread/src/win32/thread.cpp", + "libs/thread/src/win32/tss_dll.cpp", + "libs/thread/src/win32/tss_pe.cpp"] + env["BOOST_FLAGS"]["CPPDEFINES"] += [("_WIN32_WINNT", "0x0501")] + if env["PLATFORM"] == "cygwin" : + env["BOOST_FLAGS"]["CPPDEFINES"] += ["__USE_W32_SOCKETS"] + +env.StaticLibrary("Boost", sources, CPPFLAGS = "-I" + Dir(".").abspath, CPPDEFINES = cppdefines) diff --git a/3rdParty/CppUnit/SConscript b/3rdParty/CppUnit/SConscript new file mode 100644 index 0000000..aabb196 --- /dev/null +++ b/3rdParty/CppUnit/SConscript @@ -0,0 +1,42 @@ +Import("env") + +env["CPPUNIT_FLAGS"] = { + "CPPPATH": [env.Dir(".")], + "LIBPATH": [env.Dir(".")], + "LIBS": ["CppUnit"] + } + +env.StaticLibrary("CppUnit", [ + "src/TextTestRunner.cpp", + "src/TextTestProgressListener.cpp", + "src/BriefTestProgressListener.cpp", + "src/TextOutputter.cpp", + "src/XmlOutputter.cpp", + "src/XmlElement.cpp", + "src/XmlDocument.cpp", + "src/StringTools.cpp", + "src/DefaultProtector.cpp", + "src/Protector.cpp", + "src/ProtectorChain.cpp", + "src/SynchronizedObject.cpp", + "src/SourceLine.cpp", + "src/TestRunner.cpp", + "src/TestFactoryRegistry.cpp", + "src/TestSuite.cpp", + "src/TestSuiteBuilderContext.cpp", + "src/TestResult.cpp", + "src/TestResultCollector.cpp", + "src/TestSuccessListener.cpp", + "src/TestComposite.cpp", + "src/TestCase.cpp", + "src/TestFailure.cpp", + "src/TestLeaf.cpp", + "src/TestNamer.cpp", + "src/Asserter.cpp", + "src/TypeInfoHelper.cpp", + "src/Exception.cpp", + "src/Message.cpp", + "src/AdditionalMessage.cpp", + "src/Test.cpp", + "src/TestPath.cpp" + ], CPPPATH = ".") diff --git a/3rdParty/Expat/SConscript b/3rdParty/Expat/SConscript new file mode 100644 index 0000000..cf7b684 --- /dev/null +++ b/3rdParty/Expat/SConscript @@ -0,0 +1,23 @@ +Import("env") + +env["EXPAT_FLAGS"] = { + "CPPDEFINES": ["XML_STATIC"], + "CPPPATH": [Dir("src")], + "LIBPATH": [Dir(".")], + "LIBS": ["Expat"], + } + +myenv = env.Clone() +myenv.Append(CPPDEFINES = ["XML_STATIC", "HAVE_EXPAT_CONFIG_H"]) +myenv.Append(CPPPATH = [".", "src"]) + +conf = Configure(myenv) +if conf.CheckFunc('memmove') : + myenv.Append(CPPDEFINES = ["HAVE_MEMMOVE"]) +conf.Finish() + +myenv.StaticLibrary("Expat", [ + "src/xmltok.c", + "src/xmlparse.c", + "src/xmlrole.c" + ]) diff --git a/3rdParty/Expat/expat_config.h b/3rdParty/Expat/expat_config.h index ba5f588..46f8a75 100644 --- a/3rdParty/Expat/expat_config.h +++ b/3rdParty/Expat/expat_config.h @@ -1,4 +1,3 @@ -#define HAVE_MEMMOVE 1 #define XML_CONTEXT_BYTES 1024 #define XML_NS 1 diff --git a/3rdParty/LibIDN/SConscript b/3rdParty/LibIDN/SConscript new file mode 100644 index 0000000..7e134dd --- /dev/null +++ b/3rdParty/LibIDN/SConscript @@ -0,0 +1,42 @@ +Import("env") + +env["LIBIDN_FLAGS"] = { + "CPPDEFINES": ["IDNA_STATIC"], + "CPPPATH": [Dir("src")], + "LIBPATH": [Dir(".")], + "LIBS": ["IDN"], + } + +myenv = env.Clone() + +# Check for strcasecmp() or replacement +conf = Configure(myenv) +if not conf.CheckFunc('strcasecmp') : + if conf.CheckFunc("stricmp") : + myenv.Append(CPPDEFINES = [("strcasecmp", "stricmp")]) + else : + print "Cannot find strcasecmp() or stricmp()" + Exit(1) +if not conf.CheckFunc('strncasecmp') : + if conf.CheckFunc("strnicmp") : + myenv.Append(CPPDEFINES = [("strncasecmp", "strnicmp")]) + else : + print "Cannot find strncasecmp() or strnicmp()" + Exit(1) +conf.Finish() + +myenv.Append(CPPDEFINES = "IDNA_STATIC") +myenv.Append(CPPPATH = ["src", "stubs"]) +if myenv["PLATFORM"] == "win32" : + myenv.Append(CPPPATH = "stubs/win32") + env["LIBIDN_FLAGS"]["CPPPATH"] += [Dir("stubs/win32")] + +myenv.StaticLibrary("IDN", [ + "src/stringprep.c", + "src/profiles.c", + "src/rfc3454.c", + "src/punycode.c", + "src/idna.c", + "src/toutf8.c", + "src/nfkc.c" + ]) diff --git a/3rdParty/SQLite/SConscript b/3rdParty/SQLite/SConscript new file mode 100644 index 0000000..c13aa7d --- /dev/null +++ b/3rdParty/SQLite/SConscript @@ -0,0 +1,9 @@ +Import("env") + +env["SQLITE_FLAGS"] = { + "CPPPATH": [Dir(".")], + "LIBPATH": [Dir(".")], + "LIBS": ["SQLite"], + } + +env.StaticLibrary("SQLite", ["sqlite3.c"], CPPPATH = ["."]) diff --git a/3rdParty/ZLib/SConscript b/3rdParty/ZLib/SConscript new file mode 100644 index 0000000..0cf0f13 --- /dev/null +++ b/3rdParty/ZLib/SConscript @@ -0,0 +1,22 @@ +Import("env") + +env["ZLIB_FLAGS"] = { + "CPPPATH": [Dir("src")], + "LIBPATH": [Dir(".")], + "LIBS": ["Z"], + } + +env.StaticLibrary("Z", [ + "src/adler32.c", + "src/compress.c", + "src/crc32.c", + "src/deflate.c", + "src/gzio.c", + "src/infback.c", + "src/inffast.c", + "src/inflate.c", + "src/inftrees.c", + "src/trees.c", + "src/uncompr.c", + "src/zutil.c" + ]) diff --git a/QA/UnitTest/SConscript b/QA/UnitTest/SConscript new file mode 100644 index 0000000..6382d56 --- /dev/null +++ b/QA/UnitTest/SConscript @@ -0,0 +1,20 @@ +import os + +Import("env") + +if "check" in COMMAND_LINE_TARGETS or env.GetOption("clean") : + myenv = env.Clone() + myenv.MergeFlags(env["SWIFT_CONTROLLERS_FLAGS"]) + myenv.MergeFlags(env["SWIFTEN_FLAGS"]) + myenv.MergeFlags(env["CPPUNIT_FLAGS"]) + myenv.MergeFlags(env["LIBIDN_FLAGS"]) + myenv.MergeFlags(env["BOOST_FLAGS"]) + myenv.MergeFlags(env["SQLITE_FLAGS"]) + myenv.MergeFlags(env["EXPAT_FLAGS"]) + myenv.MergeFlags(env["ZLIB_FLAGS"]) + checker = myenv.Program("checker", ["checker.cpp"] + env["UNITTEST_SOURCES"]) + for i in ["HOME", "USERPROFILE", "APPDATA"]: + if os.environ.get(i, "") : + myenv["ENV"][i] = os.environ[i] + check = myenv.Alias("check", checker, checker[0].abspath) + myenv.AlwaysBuild(check) diff --git a/SConstruct b/SConstruct new file mode 100644 index 0000000..df51358 --- /dev/null +++ b/SConstruct @@ -0,0 +1,90 @@ +import sys + +# Default build environment +env = Environment(CPPPATH = "#") +env.Dump() + +if ARGUMENTS.get("V") != "1": + if sys.stdout.isatty() and env["PLATFORM"] != "win32": + env["CCCOMSTR"] = " \033[0;33;140mCC\033[0m $TARGET" + env["CXXCOMSTR"] = " \033[0;32;140mCXX\033[0m $TARGET" + env["LINKCOMSTR"] = " \033[0;31;140mLINK\033[0m $TARGET" + env["ARCOMSTR"] = " \033[0;31;140mAR\033[0m $TARGET" + env["RANLIBCOMSTR"] = " \033[0;31;140mRANLIB\033[0m $TARGET" + #Progress(' \033[0;35;140mDEP\033[0m $TARGET\n', overwrite = True) + else : + env["CCCOMSTR"] = " CC $TARGET" + env["CXXCOMSTR"] = " CXX $TARGET" + env["LINKCOMSTR"] = " LINK $TARGET" + env["ARCOMSTR"] = " AR $TARGET" + env["RANLIBCOMSTR"] = " RANLIB $TARGET" + #Progress(' \033[0;35;140mDEP\033[0m $TARGET\n', overwrite = True) + +# FIXME: Should check compiler +if env["PLATFORM"] != "win32" : + if ARGUMENTS.get("debug", 1) : + env.Append(CCFLAGS = "-g") +else : + if ARGUMENTS.get("debug", 1) : + env.Append(CCFLAGS = ["/Zi", "/MDd"]) + env.Append(CCFLAGS = "/EHsc") + +if env["PLATFORM"] == "darwin" : + env.Append(FRAMEWORKS = "AppKit") + +print "Platform: " + env["PLATFORM"] +Export("env") + +################################################################################ +# Platform configuration +################################################################################ + +conf = Configure(env) + +if conf.CheckCHeader("pthread.h") : + env["HAVE_PTHREAD"] = 1 + +if conf.CheckCHeader("openssl/ssl.h") : + env["HAVE_OPENSSL"] = 1 + env["OPENSSL_FLAGS"] = { + "LIBS": ["ssl", "crypto"] + } + +if conf.CheckLib("z") : + env.Append(LIBS = "z") + env["ZLIB_FLAGS"] = "" +else : + SConscript("3rdParty/ZLib/SConscript") + +if conf.CheckLib("dl") : + env.Append(LIBS = "dl") + +if conf.CheckLib("resolv") : + env.Append(LIBS = "resolv") + +if conf.CheckCHeader("expat.h") and conf.CheckLib("expat") : + env["HAVE_EXPAT"] = 1 + env["EXPAT_FLAGS"] = "" + env.Append(LIBS = "expat") + +conf.Finish() + +if not env.get("HAVE_EXPAT", 0) : + print "Expat or LibXML not found. Using bundled Expat" + SConscript("3rdParty/Expat/SConscript") + env["HAVE_EXPAT"] = 1 + + +################################################################################ +# Project files +################################################################################ + +SConscript([ + "3rdParty/CppUnit/SConscript", + "3rdParty/Boost/SConscript", + "3rdParty/LibIDN/SConscript", + "3rdParty/SQLite/SConscript", + "Swiften/SConscript", + "Swift/SConscript", + "QA/UnitTest/SConscript", + ]) diff --git a/Swift/Controllers/SConscript b/Swift/Controllers/SConscript new file mode 100644 index 0000000..ac06e9a --- /dev/null +++ b/Swift/Controllers/SConscript @@ -0,0 +1,26 @@ +Import("env") + +env["SWIFT_CONTROLLERS_FLAGS"] = { + "LIBPATH": [Dir(".")], + "LIBS": ["SwiftControllers"] + } + +myenv = env.Clone() +myenv.MergeFlags(env["BOOST_FLAGS"]) +myenv.StaticLibrary("SwiftControllers", [ + "ChatController.cpp", + "ChatControllerBase.cpp", + "MainController.cpp", + "NickResolver.cpp", + "RosterController.cpp", + "XMPPRosterController.cpp", + "MUCController.cpp", + "EventController.cpp", + "SoundEventController.cpp", + "SystemTrayController.cpp" + ]) + +env.Append(UNITTEST_SOURCES = [ + File("UnitTest/NickResolverTest.cpp"), + File("UnitTest/XMPPRosterControllerTest.cpp") + ]) diff --git a/Swift/QtUI/SConscript b/Swift/QtUI/SConscript new file mode 100644 index 0000000..b07f1de --- /dev/null +++ b/Swift/QtUI/SConscript @@ -0,0 +1,74 @@ +import os + +def generateDefaultTheme(env, target, source) : + sourceDir = source[0].abspath + output = open(target[0].abspath, "w") + output.write("") + output.write("") + for (path, dirs, files) in os.walk(sourceDir) : + for file in files : + filePath = os.path.join(path,file) + output.write("%(path)s" % { + "alias": filePath[len(sourceDir)+1:], + "path": filePath + }) + output.write("") + output.write("") + +Import("env") + +myenv = env.Clone() + +myenv.MergeFlags(env["SWIFT_CONTROLLERS_FLAGS"]) +myenv.MergeFlags(env["SWIFTEN_FLAGS"]) +myenv.MergeFlags(env["CPPUNIT_FLAGS"]) +myenv.MergeFlags(env["LIBIDN_FLAGS"]) +myenv.MergeFlags(env["BOOST_FLAGS"]) +myenv.MergeFlags(env["SQLITE_FLAGS"]) +myenv.MergeFlags(env["EXPAT_FLAGS"]) +myenv.MergeFlags(env["ZLIB_FLAGS"]) +myenv.MergeFlags(env["OPENSSL_FLAGS"]) + +myenv.Tool("qt4") +myenv.EnableQt4Modules(['QtCore', 'QtGui', 'QtWebKit'], debug = False) +myenv.Append(CPPPATH = ["/usr/include/phonon"]) + +myenv.Append(CPPPATH = ["."]) + +myenv.Command("DefaultTheme.qrc", "../resources/themes/Default", generateDefaultTheme) + +sources = [ + "main.cpp", + "QtChatWindow.cpp", + "QtChatWindowFactory.cpp", + "QtJoinMUCDialog.cpp", + "QtLoginWindow.cpp", + "QtLoginWindowFactory.cpp", + "QtMainWindow.cpp", + "QtMainWindowFactory.cpp", + "QtSettingsProvider.cpp", + "QtStatusWidget.cpp", + "QtSwift.cpp", + "QtChatView.cpp", + "QtChatTabs.cpp", + "QtSoundPlayer.cpp", + "QtSystemTray.cpp", + "QtTabbable.cpp", + "ChatSnippet.cpp", + "MessageSnippet.cpp", + "SystemMessageSnippet.cpp", + "Roster/RosterModel.cpp", + "Roster/QtTreeWidget.cpp", + "Roster/QtTreeWidgetItem.cpp", + "Roster/RosterDelegate.cpp", + "qrc_DefaultTheme.cc", + "qrc_Swift.cc", + ] + +if env["PLATFORM"] == "win32" : + sources += ["../resources/Windows/Swift.rc"] + +myenv.Program("swift", sources) +myenv.Uic4("QtJoinMUCDialog.ui") +myenv.Qrc("DefaultTheme.qrc") +myenv.Qrc("Swift.qrc") diff --git a/Swift/SConscript b/Swift/SConscript new file mode 100644 index 0000000..d563e09 --- /dev/null +++ b/Swift/SConscript @@ -0,0 +1,2 @@ +SConscript("Controllers/SConscript") +SConscript("QtUI/SConscript") diff --git a/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDResolveHostnameQuery.h b/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDResolveHostnameQuery.h index 1f9d7f1..5ed42af 100644 --- a/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDResolveHostnameQuery.h +++ b/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDResolveHostnameQuery.h @@ -5,8 +5,6 @@ #include "Swiften/LinkLocal/DNSSD/DNSSDResolveHostnameQuery.h" #include "Swiften/Network/HostAddress.h" -#include - namespace Swift { class FakeDNSSDQuerier; diff --git a/Swiften/SConscript b/Swiften/SConscript new file mode 100644 index 0000000..cf33930 --- /dev/null +++ b/Swiften/SConscript @@ -0,0 +1,255 @@ +Import("env") + +env["SWIFTEN_FLAGS"] = { + "LIBPATH": [Dir(".")], + "LIBS": ["Swiften"] + } + +myenv = env.Clone() +myenv.MergeFlags(env["BOOST_FLAGS"]) +myenv.MergeFlags(env["LIBIDN_FLAGS"]) +myenv.MergeFlags(env["SQLITE_FLAGS"]) +myenv.MergeFlags(env["EXPAT_FLAGS"]) +myenv.MergeFlags(env["ZLIB_FLAGS"]) + +sources = [ + "Application/Application.cpp", + "Application/ApplicationMessageDisplay.cpp", + "Avatars/AvatarFileStorage.cpp", + "Avatars/AvatarManager.cpp", + "Avatars/AvatarStorage.cpp", + "Base/ByteArray.cpp", + "Base/IDGenerator.cpp", + "Base/String.cpp", + "Base/sleep.cpp", + "Client/Client.cpp", + "Client/ClientSession.cpp", + "Compress/ZLibCodecompressor.cpp", + "Disco/CapsInfoGenerator.cpp", + "Elements/DiscoInfo.cpp", + "Elements/Element.cpp", + "Elements/IQ.cpp", + "Elements/MUCPayload.cpp", + "Elements/Payload.cpp", + "Elements/RosterPayload.cpp", + "Elements/Stanza.cpp", + "EventLoop/EventLoop.cpp", + "EventLoop/EventOwner.cpp", + "EventLoop/MainEventLoop.cpp", + "EventLoop/SimpleEventLoop.cpp", + "History/HistoryManager.cpp", + "History/SQLiteHistoryManager.cpp", + "JID/JID.cpp", + "LinkLocal/DNSSD/DNSSDBrowseQuery.cpp", + "LinkLocal/DNSSD/DNSSDQuerier.cpp", + "LinkLocal/DNSSD/DNSSDRegisterQuery.cpp", + "LinkLocal/DNSSD/DNSSDResolveHostnameQuery.cpp", + "LinkLocal/DNSSD/DNSSDResolveServiceQuery.cpp", + "LinkLocal/DNSSD/DNSSDServiceID.cpp", + "LinkLocal/DNSSD/Fake/FakeDNSSDQuerier.cpp", + "LinkLocal/DNSSD/Fake/FakeDNSSDQuery.cpp", + "LinkLocal/DNSSD/PlatformDNSSDQuerierFactory.cpp", + "LinkLocal/IncomingLinkLocalSession.cpp", + "LinkLocal/LinkLocalConnector.cpp", + "LinkLocal/LinkLocalService.cpp", + "LinkLocal/LinkLocalServiceBrowser.cpp", + "LinkLocal/LinkLocalServiceInfo.cpp", + "LinkLocal/OutgoingLinkLocalSession.cpp", + "MUC/MUC.cpp", + "MUC/MUCOccupant.cpp", + "MUC/MUCRegistry.cpp", + "Network/BoostConnection.cpp", + "Network/BoostConnectionFactory.cpp", + "Network/BoostConnectionServer.cpp", + "Network/BoostIOServiceThread.cpp", + "Network/ConnectionFactory.cpp", + "Network/ConnectionServer.cpp", + "Network/DomainNameResolver.cpp", + "Network/HostAddress.cpp", + "Network/Timer.cpp", + "Notifier/Notifier.cpp", + "Parser/AuthRequestParser.cpp", + "Parser/CompressParser.cpp", + "Parser/ElementParser.cpp", + "Parser/IQParser.cpp", + "Parser/MessageParser.cpp", + "Parser/PayloadParser.cpp", + "Parser/PayloadParserFactory.cpp", + "Parser/PayloadParserFactoryCollection.cpp", + "Parser/PayloadParsers/BodyParser.cpp", + "Parser/PayloadParsers/DiscoInfoParser.cpp", + "Parser/PayloadParsers/ErrorParser.cpp", + "Parser/PayloadParsers/FullPayloadParserFactoryCollection.cpp", + "Parser/PayloadParsers/PriorityParser.cpp", + "Parser/PayloadParsers/RawXMLPayloadParser.cpp", + "Parser/PayloadParsers/ResourceBindParser.cpp", + "Parser/PayloadParsers/RosterParser.cpp", + "Parser/PayloadParsers/SecurityLabelParser.cpp", + "Parser/PayloadParsers/SecurityLabelsCatalogParser.cpp", + "Parser/PayloadParsers/SoftwareVersionParser.cpp", + "Parser/PayloadParsers/StatusParser.cpp", + "Parser/PayloadParsers/StatusShowParser.cpp", + "Parser/PayloadParsers/VCardParser.cpp", + "Parser/PayloadParsers/VCardUpdateParser.cpp", + "Parser/PlatformXMLParserFactory.cpp", + "Parser/PresenceParser.cpp", + "Parser/SerializingParser.cpp", + "Parser/StanzaParser.cpp", + "Parser/StreamFeaturesParser.cpp", + "Parser/XMLParser.cpp", + "Parser/XMLParserClient.cpp", + "Parser/XMLParserFactory.cpp", + "Parser/XMPPParser.cpp", + "Parser/XMPPParserClient.cpp", + "Presence/PresenceOracle.cpp", + "Queries/IQChannel.cpp", + "Queries/IQHandler.cpp", + "Queries/IQRouter.cpp", + "Queries/Request.cpp", + "Queries/Responders/DiscoInfoResponder.cpp", + "Queries/Responders/SoftwareVersionResponder.cpp", + "Roster/ContactRosterItem.cpp", + "Roster/Roster.cpp", + "Roster/XMPPRoster.cpp", + "SASL/PLAINMessage.cpp", + "Serializer/AuthRequestSerializer.cpp", + "Serializer/CompressRequestSerializer.cpp", + "Serializer/ElementSerializer.cpp", + "Serializer/MessageSerializer.cpp", + "Serializer/PayloadSerializer.cpp", + "Serializer/PayloadSerializerCollection.cpp", + "Serializer/PayloadSerializers/CapsInfoSerializer.cpp", + "Serializer/PayloadSerializers/DiscoInfoSerializer.cpp", + "Serializer/PayloadSerializers/ErrorSerializer.cpp", + "Serializer/PayloadSerializers/FullPayloadSerializerCollection.cpp", + "Serializer/PayloadSerializers/MUCPayloadSerializer.cpp", + "Serializer/PayloadSerializers/ResourceBindSerializer.cpp", + "Serializer/PayloadSerializers/RosterSerializer.cpp", + "Serializer/PayloadSerializers/SecurityLabelSerializer.cpp", + "Serializer/PayloadSerializers/SecurityLabelsCatalogSerializer.cpp", + "Serializer/PayloadSerializers/SoftwareVersionSerializer.cpp", + "Serializer/PayloadSerializers/VCardSerializer.cpp", + "Serializer/PayloadSerializers/VCardUpdateSerializer.cpp", + "Serializer/PresenceSerializer.cpp", + "Serializer/StanzaSerializer.cpp", + "Serializer/StreamFeaturesSerializer.cpp", + "Serializer/XML/XMLElement.cpp", + "Serializer/XML/XMLNode.cpp", + "Serializer/XMPPSerializer.cpp", + "Server/ServerFromClientSession.cpp", + "Server/ServerSession.cpp", + "Server/ServerStanzaRouter.cpp", + "Server/SimpleUserRegistry.cpp", + "Server/UserRegistry.cpp", + "Session/Session.cpp", + "StreamStack/HighLayer.cpp", + "StreamStack/LowLayer.cpp", + "StreamStack/PlatformTLSLayerFactory.cpp", + "StreamStack/StreamStack.cpp", + "StreamStack/TLSLayerFactory.cpp", + "StreamStack/WhitespacePingLayer.cpp", + "StreamStack/XMPPLayer.cpp", + "StringCodecs/Base64.cpp", + "StringCodecs/SHA1.cpp", + ] + +# "Notifier/GrowlNotifier.cpp", + +if myenv.get("HAVE_AVAHI", 0) : + sources += ["LinkLocal/DNSSD/Avahi/AvahiQuerier.cpp"] +if myenv.get("HAVE_BONJOUR", 0) : + sources += [ + "LinkLocal/DNSSD/Bonjour/BonjourQuerier.cpp", + "LinkLocal/DNSSD/Bonjour/BonjourQuery.cpp", + ] + +if myenv.get("HAVE_OPENSSL", 0) : + myenv.Append(CPPDEFINES = "HAVE_OPENSSL") + sources += ["StreamStack/OpenSSLLayer.cpp"] + sources += ["TLS/OpenSSL/OpenSSLContext.cpp"] + +if myenv.get("HAVE_EXPAT", 0) : + myenv.Append(CPPDEFINES = "HAVE_EXPAT") + sources += ["Parser/ExpatParser.cpp"] +if myenv.get("HAVE_LIBXML", 0) : + myenv.Append(CPPDEFINES = "HAVE_LIBXML") + sources += ["Parser/LibXMLParser.cpp"] + +if myenv["PLATFORM"] == "darwin" : + sources += [ + "Application/MacOSX/MacOSXApplication.cpp", + "Application/MacOSX/MacOSXApplicationMessageDisplay.mm" + ] + +myenv.StaticLibrary("Swiften", sources) + +env.Append(UNITTEST_SOURCES = [ + File("Application/UnitTest/ApplicationTest.cpp"), + File("Base/UnitTest/IDGeneratorTest.cpp"), + File("Base/UnitTest/StringTest.cpp"), + File("Client/UnitTest/ClientSessionTest.cpp"), + File("Compress/UnitTest/ZLibCompressorTest.cpp"), + File("Compress/UnitTest/ZLibDecompressorTest.cpp"), + File("Disco/UnitTest/CapsInfoGeneratorTest.cpp"), + File("Elements/UnitTest/IQTest.cpp"), + File("Elements/UnitTest/StanzaTest.cpp"), + File("Elements/UnitTest/StanzasTest.cpp"), + File("EventLoop/UnitTest/EventLoopTest.cpp"), + File("EventLoop/UnitTest/SimpleEventLoopTest.cpp"), + File("History/UnitTest/SQLiteHistoryManagerTest.cpp"), + File("JID/UnitTest/JIDTest.cpp"), + File("LinkLocal/UnitTest/LinkLocalConnectorTest.cpp"), + File("LinkLocal/UnitTest/LinkLocalServiceBrowserTest.cpp"), + File("LinkLocal/UnitTest/LinkLocalServiceInfoTest.cpp"), + File("LinkLocal/UnitTest/LinkLocalServiceTest.cpp"), + File("Network/UnitTest/HostAddressTest.cpp"), + File("Parser/PayloadParsers/UnitTest/BodyParserTest.cpp"), + File("Parser/PayloadParsers/UnitTest/DiscoInfoParserTest.cpp"), + File("Parser/PayloadParsers/UnitTest/ErrorParserTest.cpp"), + File("Parser/PayloadParsers/UnitTest/PriorityParserTest.cpp"), + File("Parser/PayloadParsers/UnitTest/RawXMLPayloadParserTest.cpp"), + File("Parser/PayloadParsers/UnitTest/ResourceBindParserTest.cpp"), + File("Parser/PayloadParsers/UnitTest/RosterParserTest.cpp"), + File("Parser/PayloadParsers/UnitTest/SecurityLabelParserTest.cpp"), + File("Parser/PayloadParsers/UnitTest/SecurityLabelsCatalogParserTest.cpp"), + File("Parser/PayloadParsers/UnitTest/SoftwareVersionParserTest.cpp"), + File("Parser/PayloadParsers/UnitTest/StatusParserTest.cpp"), + File("Parser/PayloadParsers/UnitTest/StatusShowParserTest.cpp"), + File("Parser/PayloadParsers/UnitTest/VCardParserTest.cpp"), + File("Parser/PayloadParsers/UnitTest/VCardUpdateParserTest.cpp"), + File("Parser/UnitTest/IQParserTest.cpp"), + File("Parser/UnitTest/MessageParserTest.cpp"), + File("Parser/UnitTest/PayloadParserFactoryCollectionTest.cpp"), + File("Parser/UnitTest/PresenceParserTest.cpp"), + File("Parser/UnitTest/SerializingParserTest.cpp"), + File("Parser/UnitTest/StanzaParserTest.cpp"), + File("Parser/UnitTest/StreamFeaturesParserTest.cpp"), + File("Parser/UnitTest/XMLParserTest.cpp"), + File("Parser/UnitTest/XMPPParserTest.cpp"), + File("Queries/Responders/UnitTest/DiscoInfoResponderTest.cpp"), + File("Queries/UnitTest/IQRouterTest.cpp"), + File("Queries/UnitTest/RequestTest.cpp"), + File("Queries/UnitTest/ResponderTest.cpp"), + File("Roster/UnitTest/OfflineRosterFilterTest.cpp"), + File("Roster/UnitTest/RosterTest.cpp"), + File("SASL/UnitTest/PLAINMessageTest.cpp"), + File("Serializer/PayloadSerializers/UnitTest/CapsInfoSerializerTest.cpp"), + File("Serializer/PayloadSerializers/UnitTest/DiscoInfoSerializerTest.cpp"), + File("Serializer/PayloadSerializers/UnitTest/ErrorSerializerTest.cpp"), + File("Serializer/PayloadSerializers/UnitTest/PrioritySerializerTest.cpp"), + File("Serializer/PayloadSerializers/UnitTest/ResourceBindSerializerTest.cpp"), + File("Serializer/PayloadSerializers/UnitTest/RosterSerializerTest.cpp"), + File("Serializer/PayloadSerializers/UnitTest/SecurityLabelSerializerTest.cpp"), + File("Serializer/PayloadSerializers/UnitTest/SecurityLabelsCatalogSerializerTest.cpp"), + File("Serializer/PayloadSerializers/UnitTest/SoftwareVersionSerializerTest.cpp"), + File("Serializer/PayloadSerializers/UnitTest/StatusSerializerTest.cpp"), + File("Serializer/PayloadSerializers/UnitTest/StatusShowSerializerTest.cpp"), + File("Serializer/PayloadSerializers/UnitTest/VCardUpdateSerializerTest.cpp"), + File("Serializer/UnitTest/StreamFeaturesSerializerTest.cpp"), + File("Serializer/XML/UnitTest/XMLElementTest.cpp"), + File("Server/UnitTest/ServerStanzaRouterTest.cpp"), + File("StreamStack/UnitTest/StreamStackTest.cpp"), + File("StreamStack/UnitTest/XMPPLayerTest.cpp"), + File("StringCodecs/UnitTest/Base64Test.cpp"), + File("StringCodecs/UnitTest/SHA1Test.cpp"), + ]) diff --git a/site_scons/site_tools/.gitignore b/site_scons/site_tools/.gitignore new file mode 100644 index 0000000..0d20b64 --- /dev/null +++ b/site_scons/site_tools/.gitignore @@ -0,0 +1 @@ +*.pyc diff --git a/site_scons/site_tools/qt4.py b/site_scons/site_tools/qt4.py new file mode 100644 index 0000000..df99a73 --- /dev/null +++ b/site_scons/site_tools/qt4.py @@ -0,0 +1,526 @@ + +"""SCons.Tool.qt + +Tool-specific initialization for Qt. + +There normally shouldn't be any need to import this module directly. +It will usually be imported through the generic SCons.Tool.Tool() +selection method. + +""" + +# +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007 The SCons Foundation +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# + +__revision__ = "/home/scons/scons/branch.0/branch.96/baseline/src/engine/SCons/Tool/qt.py 0.96.92.D001 2006/04/10 23:13:27 knight" + +import os.path +import re + +import SCons.Action +import SCons.Builder +import SCons.Defaults +import SCons.Scanner +import SCons.Tool +import SCons.Util + +class ToolQtWarning(SCons.Warnings.Warning): + pass + +class GeneratedMocFileNotIncluded(ToolQtWarning): + pass + +class QtdirNotFound(ToolQtWarning): + pass + +SCons.Warnings.enableWarningClass(ToolQtWarning) + +qrcinclude_re = re.compile(r'([^<]*)', re.M) + +def transformToWinePath(path) : + return os.popen('winepath -w "%s"'%path).read().strip().replace('\\','/') + +header_extensions = [".h", ".hxx", ".hpp", ".hh"] +if SCons.Util.case_sensitive_suffixes('.h', '.H'): + header_extensions.append('.H') +# TODO: The following two lines will work when integrated back to SCons +# TODO: Meanwhile the third line will do the work +#cplusplus = __import__('c++', globals(), locals(), []) +#cxx_suffixes = cplusplus.CXXSuffixes +cxx_suffixes = [".c", ".cxx", ".cpp", ".cc"] + +def checkMocIncluded(target, source, env): + moc = target[0] + cpp = source[0] + # looks like cpp.includes is cleared before the build stage :-( + # not really sure about the path transformations (moc.cwd? cpp.cwd?) :-/ + path = SCons.Defaults.CScan.path_function(env, moc.cwd) + includes = SCons.Defaults.CScan(cpp, env, path) + if not moc in includes: + SCons.Warnings.warn( + GeneratedMocFileNotIncluded, + "Generated moc file '%s' is not included by '%s'" % + (str(moc), str(cpp))) + +def find_file(filename, paths, node_factory): + for dir in paths: + node = node_factory(filename, dir) + if node.rexists(): + return node + return None + +class _Automoc: + """ + Callable class, which works as an emitter for Programs, SharedLibraries and + StaticLibraries. + """ + + def __init__(self, objBuilderName): + self.objBuilderName = objBuilderName + + def __call__(self, target, source, env): + """ + Smart autoscan function. Gets the list of objects for the Program + or Lib. Adds objects and builders for the special qt files. + """ + try: + if int(env.subst('$QT4_AUTOSCAN')) == 0: + return target, source + except ValueError: + pass + try: + debug = int(env.subst('$QT4_DEBUG')) + except ValueError: + debug = 0 + + # some shortcuts used in the scanner + splitext = SCons.Util.splitext + objBuilder = getattr(env, self.objBuilderName) + + # some regular expressions: + # Q_OBJECT detection + q_object_search = re.compile(r'[^A-Za-z0-9]Q_OBJECT[^A-Za-z0-9]') + # cxx and c comment 'eater' + #comment = re.compile(r'(//.*)|(/\*(([^*])|(\*[^/]))*\*/)') + # CW: something must be wrong with the regexp. See also bug #998222 + # CURRENTLY THERE IS NO TEST CASE FOR THAT + + # The following is kind of hacky to get builders working properly (FIXME) + objBuilderEnv = objBuilder.env + objBuilder.env = env + mocBuilderEnv = env.Moc4.env + env.Moc4.env = env + + # make a deep copy for the result; MocH objects will be appended + out_sources = source[:] + + for obj in source: + if isinstance(obj,basestring): # big kludge! + print "scons: qt4: '%s' MAYBE USING AN OLD SCONS VERSION AND NOT CONVERTED TO 'File'. Discarded." % str(obj) + continue + if not obj.has_builder(): + # binary obj file provided + if debug: + print "scons: qt: '%s' seems to be a binary. Discarded." % str(obj) + continue + cpp = obj.sources[0] + if not splitext(str(cpp))[1] in cxx_suffixes: + if debug: + print "scons: qt: '%s' is no cxx file. Discarded." % str(cpp) + # c or fortran source + continue + #cpp_contents = comment.sub('', cpp.get_contents()) + try: + cpp_contents = cpp.get_contents() + except: continue # may be an still not generated source + h=None + for h_ext in header_extensions: + # try to find the header file in the corresponding source + # directory + hname = splitext(cpp.name)[0] + h_ext + h = find_file(hname, (cpp.get_dir(),), env.File) + if h: + if debug: + print "scons: qt: Scanning '%s' (header of '%s')" % (str(h), str(cpp)) + #h_contents = comment.sub('', h.get_contents()) + h_contents = h.get_contents() + break + if not h and debug: + print "scons: qt: no header for '%s'." % (str(cpp)) + if h and q_object_search.search(h_contents): + # h file with the Q_OBJECT macro found -> add moc_cpp + moc_cpp = env.Moc4(h) + moc_o = objBuilder(moc_cpp) + out_sources.append(moc_o) + #moc_cpp.target_scanner = SCons.Defaults.CScan + if debug: + print "scons: qt: found Q_OBJECT macro in '%s', moc'ing to '%s'" % (str(h), str(moc_cpp)) + if cpp and q_object_search.search(cpp_contents): + # cpp file with Q_OBJECT macro found -> add moc + # (to be included in cpp) + moc = env.Moc4(cpp) + env.Ignore(moc, moc) + if debug: + print "scons: qt: found Q_OBJECT macro in '%s', moc'ing to '%s'" % (str(cpp), str(moc)) + #moc.source_scanner = SCons.Defaults.CScan + # restore the original env attributes (FIXME) + objBuilder.env = objBuilderEnv + env.Moc4.env = mocBuilderEnv + + return (target, out_sources) + +AutomocShared = _Automoc('SharedObject') +AutomocStatic = _Automoc('StaticObject') + +def _detect(env): + """Not really safe, but fast method to detect the QT library""" + try: return env['QTDIR'] + except KeyError: pass + + try: return os.environ['QTDIR'] + except KeyError: pass + + moc = env.WhereIs('moc-qt4') or env.WhereIs('moc4') or env.WhereIs('moc') + if moc: + QTDIR = os.path.dirname(os.path.dirname(moc)) + SCons.Warnings.warn( + QtdirNotFound, + "QTDIR variable is not defined, using moc executable as a hint (QTDIR=%s)" % QTDIR) + return QTDIR + + raise SCons.Errors.StopError( + QtdirNotFound, + "Could not detect Qt 4 installation") + return None + +def generate(env): + """Add Builders and construction variables for qt to an Environment.""" + + def locateQt4Command(env, command, qtdir) : + suffixes = [ + '-qt4', + '-qt4.exe', + '4', + '4.exe', + '', + '.exe', + ] + triedPaths = [] + for suffix in suffixes : + fullpath = os.path.join(qtdir,'bin',command + suffix) + if os.access(fullpath, os.X_OK) : + return fullpath + triedPaths.append(fullpath) + + fullpath = env.Detect([command+'-qt4', command+'4', command]) + if not (fullpath is None) : return fullpath + + raise Exception("Qt4 command '" + command + "' not found. Tried: " + ', '.join(triedPaths)) + + + CLVar = SCons.Util.CLVar + Action = SCons.Action.Action + Builder = SCons.Builder.Builder + splitext = SCons.Util.splitext + + env['QTDIR'] = _detect(env) + # TODO: 'Replace' should be 'SetDefault' +# env.SetDefault( + env.Replace( + QTDIR = _detect(env), + QT4_BINPATH = os.path.join('$QTDIR', 'bin'), + QT4_CPPPATH = os.path.join('$QTDIR', 'include'), + QT4_LIBPATH = os.path.join('$QTDIR', 'lib'), + # TODO: This is not reliable to QTDIR value changes but needed in order to support '-qt4' variants + QT4_MOC = locateQt4Command(env,'moc', env['QTDIR']), + QT4_UIC = locateQt4Command(env,'uic', env['QTDIR']), + QT4_RCC = locateQt4Command(env,'rcc', env['QTDIR']), + QT4_LUPDATE = locateQt4Command(env,'lupdate', env['QTDIR']), + QT4_LRELEASE = locateQt4Command(env,'lrelease', env['QTDIR']), + QT4_LIB = '', # KLUDGE to avoid linking qt3 library + + QT4_AUTOSCAN = 1, # Should the qt tool try to figure out, which sources are to be moc'ed? + + # Some QT specific flags. I don't expect someone wants to + # manipulate those ... + QT4_UICFLAGS = CLVar(''), + QT4_MOCFROMHFLAGS = CLVar(''), + QT4_MOCFROMCXXFLAGS = CLVar('-i'), + QT4_QRCFLAGS = '', + + # suffixes/prefixes for the headers / sources to generate + QT4_UISUFFIX = '.ui', + QT4_UICDECLPREFIX = 'ui_', + QT4_UICDECLSUFFIX = '.h', + QT4_MOCHPREFIX = 'moc_', + QT4_MOCHSUFFIX = '$CXXFILESUFFIX', + QT4_MOCCXXPREFIX = '', + QT4_MOCCXXSUFFIX = '.moc', + QT4_QRCSUFFIX = '.qrc', + QT4_QRCCXXSUFFIX = '$CXXFILESUFFIX', + QT4_QRCCXXPREFIX = 'qrc_', + QT4_MOCCPPPATH = [], + QT4_MOCINCFLAGS = '$( ${_concat(INCPREFIX, QT4_MOCCPPPATH, INCSUFFIX, __env__, RDirs)} $)', + + # Commands for the qt support ... + QT4_UICCOM = '$QT4_UIC $QT4_UICFLAGS -o $TARGET $SOURCE', + QT4_MOCFROMHCOM = '$QT4_MOC $QT4_MOCFROMHFLAGS $QT4_MOCINCFLAGS -o $TARGET $SOURCE', + QT4_MOCFROMCXXCOM = [ + '$QT4_MOC $QT4_MOCFROMCXXFLAGS $QT4_MOCINCFLAGS -o $TARGET $SOURCE', + Action(checkMocIncluded,None)], + QT4_LUPDATECOM = '$QT4_LUPDATE $SOURCE -ts $TARGET', + QT4_LRELEASECOM = '$QT4_LRELEASE $SOURCE', + QT4_RCCCOM = '$QT4_RCC $QT4_QRCFLAGS -name $SOURCE $SOURCE -o $TARGET', + ) + + # Translation builder + tsbuilder = Builder( + action = SCons.Action.Action('$QT4_LUPDATECOM'), #,'$QT4_LUPDATECOMSTR'), + multi=1 + ) + env.Append( BUILDERS = { 'Ts': tsbuilder } ) + qmbuilder = Builder( + action = SCons.Action.Action('$QT4_LRELEASECOM'),# , '$QT4_LRELEASECOMSTR'), + src_suffix = '.ts', + suffix = '.qm', + single_source = True + ) + env.Append( BUILDERS = { 'Qm': qmbuilder } ) + + # Resource builder + def scanResources(node, env, path, arg): + # I've being careful on providing names relative to the qrc file + # If that was not needed that code could be simplified a lot + def recursiveFiles(basepath, path) : + result = [] + for item in os.listdir(os.path.join(basepath, path)) : + itemPath = os.path.join(path, item) + if os.path.isdir(os.path.join(basepath, itemPath)) : + result += recursiveFiles(basepath, itemPath) + else: + result.append(itemPath) + return result + contents = node.get_contents() + includes = qrcinclude_re.findall(contents) + qrcpath = os.path.dirname(node.path) + dirs = [included for included in includes if os.path.isdir(os.path.join(qrcpath,included))] + # dirs need to include files recursively + for dir in dirs : + includes.remove(dir) + includes+=recursiveFiles(qrcpath,dir) + return includes + qrcscanner = SCons.Scanner.Scanner(name = 'qrcfile', + function = scanResources, + argument = None, + skeys = ['.qrc']) + qrcbuilder = Builder( + action = SCons.Action.Action('$QT4_RCCCOM'), #, '$QT4_RCCCOMSTR'), + source_scanner = qrcscanner, + src_suffix = '$QT4_QRCSUFFIX', + suffix = '$QT4_QRCCXXSUFFIX', + prefix = '$QT4_QRCCXXPREFIX', + single_source = True + ) + env.Append( BUILDERS = { 'Qrc': qrcbuilder } ) + + # Interface builder + uic4builder = Builder( + action = SCons.Action.Action('$QT4_UICCOM'), #, '$QT4_UICCOMSTR'), + src_suffix='$QT4_UISUFFIX', + suffix='$QT4_UICDECLSUFFIX', + prefix='$QT4_UICDECLPREFIX', + single_source = True + #TODO: Consider the uiscanner on new scons version + ) + env['BUILDERS']['Uic4'] = uic4builder + + # Metaobject builder + mocBld = Builder(action={}, prefix={}, suffix={}) + for h in header_extensions: + act = SCons.Action.Action('$QT4_MOCFROMHCOM') #, '$QT4_MOCFROMHCOMSTR') + mocBld.add_action(h, act) + mocBld.prefix[h] = '$QT4_MOCHPREFIX' + mocBld.suffix[h] = '$QT4_MOCHSUFFIX' + for cxx in cxx_suffixes: + act = SCons.Action.Action('$QT4_MOCFROMCXXCOM') #, '$QT4_MOCFROMCXXCOMSTR') + mocBld.add_action(cxx, act) + mocBld.prefix[cxx] = '$QT4_MOCCXXPREFIX' + mocBld.suffix[cxx] = '$QT4_MOCCXXSUFFIX' + env['BUILDERS']['Moc4'] = mocBld + + # er... no idea what that was for + static_obj, shared_obj = SCons.Tool.createObjBuilders(env) + static_obj.src_builder.append('Uic4') + shared_obj.src_builder.append('Uic4') + + # We use the emitters of Program / StaticLibrary / SharedLibrary + # to scan for moc'able files + # We can't refer to the builders directly, we have to fetch them + # as Environment attributes because that sets them up to be called + # correctly later by our emitter. + env.AppendUnique(PROGEMITTER =[AutomocStatic], + SHLIBEMITTER=[AutomocShared], + LIBEMITTER =[AutomocStatic], + # Of course, we need to link against the qt libraries +# CPPPATH=["$QT4_CPPPATH"], + LIBPATH=["$QT4_LIBPATH"], + LIBS=['$QT4_LIB']) + + # TODO: Does dbusxml2cpp need an adapter + env.AddMethod(enable_modules, "EnableQt4Modules") + +def enable_modules(self, modules, debug=False, crosscompiling=False) : + import sys + + validModules = [ + 'QtCore', + 'QtGui', + 'QtOpenGL', + 'Qt3Support', + 'QtAssistant', + 'QtScript', + 'QtDBus', + 'QtSql', + # The next modules have not been tested yet so, please + # maybe they require additional work on non Linux platforms + 'QtNetwork', + 'QtSvg', + 'QtTest', + 'QtXml', + 'QtXmlPatterns', + 'QtUiTools', + 'QtDesigner', + 'QtDesignerComponents', + 'QtWebKit', + 'QtHelp', + 'QtScript', + ] + pclessModules = [ +# in qt <= 4.3 designer and designerComponents are pcless, on qt4.4 they are not, so removed. +# 'QtDesigner', +# 'QtDesignerComponents', + ] + staticModules = [ + 'QtUiTools', + ] + invalidModules=[] + for module in modules: + if module not in validModules : + invalidModules.append(module) + if invalidModules : + raise Exception("Modules %s are not Qt4 modules. Valid Qt4 modules are: %s"% ( + str(invalidModules),str(validModules))) + + moduleDefines = { + 'QtScript' : ['QT_SCRIPT_LIB'], + 'QtSvg' : ['QT_SVG_LIB'], + 'Qt3Support' : ['QT_QT3SUPPORT_LIB','QT3_SUPPORT'], + 'QtSql' : ['QT_SQL_LIB'], + 'QtXml' : ['QT_XML_LIB'], + 'QtOpenGL' : ['QT_OPENGL_LIB'], + 'QtGui' : ['QT_GUI_LIB'], + 'QtNetwork' : ['QT_NETWORK_LIB'], + 'QtCore' : ['QT_CORE_LIB'], + } + for module in modules : + try : self.AppendUnique(CPPDEFINES=moduleDefines[module]) + except: pass + debugSuffix = '' + if sys.platform in ["darwin", "linux2"] and not crosscompiling : + if debug : debugSuffix = '_debug' + for module in modules : + if module not in pclessModules : continue + self.AppendUnique(LIBS=[module+debugSuffix]) + self.AppendUnique(LIBPATH=[os.path.join("$QTDIR","lib")]) + self.AppendUnique(CPPPATH=[os.path.join("$QTDIR","include","qt4")]) + self.AppendUnique(CPPPATH=[os.path.join("$QTDIR","include","qt4",module)]) + pcmodules = [module+debugSuffix for module in modules if module not in pclessModules ] + if 'QtDBus' in pcmodules: + self.AppendUnique(CPPPATH=[os.path.join("$QTDIR","include","qt4","QtDBus")]) + if "QtAssistant" in pcmodules: + self.AppendUnique(CPPPATH=[os.path.join("$QTDIR","include","qt4","QtAssistant")]) + pcmodules.remove("QtAssistant") + pcmodules.append("QtAssistantClient") + self.ParseConfig('pkg-config %s --libs --cflags'% ' '.join(pcmodules)) + self["QT4_MOCCPPPATH"] = self["CPPPATH"] + return + if sys.platform == "win32" or crosscompiling : + if crosscompiling: + transformedQtdir = transformToWinePath(self['QTDIR']) + self['QT4_MOC'] = "QTDIR=%s %s"%( transformedQtdir, self['QT4_MOC']) + self.AppendUnique(CPPPATH=[os.path.join("$QTDIR","include")]) + try: modules.remove("QtDBus") + except: pass + if debug : debugSuffix = 'd' + if "QtAssistant" in modules: + self.AppendUnique(CPPPATH=[os.path.join("$QTDIR","include","QtAssistant")]) + modules.remove("QtAssistant") + modules.append("QtAssistantClient") + self.AppendUnique(LIBS=[lib+'4'+debugSuffix for lib in modules if lib not in staticModules]) + self.PrependUnique(LIBS=[lib+debugSuffix for lib in modules if lib in staticModules]) + if 'QtOpenGL' in modules: + self.AppendUnique(LIBS=['opengl32']) + self.AppendUnique(CPPPATH=[ '$QTDIR/include/']) + self.AppendUnique(CPPPATH=[ '$QTDIR/include/'+module for module in modules]) + if crosscompiling : + self["QT4_MOCCPPPATH"] = [ + path.replace('$QTDIR', transformedQtdir) + for path in self['CPPPATH'] ] + else : + self["QT4_MOCCPPPATH"] = self["CPPPATH"] + self.AppendUnique(LIBPATH=[os.path.join('$QTDIR','lib')]) + return + """ + if sys.platform=="darwin" : + # TODO: Test debug version on Mac + self.AppendUnique(LIBPATH=[os.path.join('$QTDIR','lib')]) + self.AppendUnique(LINKFLAGS="-F$QTDIR/lib") + self.AppendUnique(LINKFLAGS="-L$QTDIR/lib") #TODO clean! + if debug : debugSuffix = 'd' + for module in modules : +# self.AppendUnique(CPPPATH=[os.path.join("$QTDIR","include")]) +# self.AppendUnique(CPPPATH=[os.path.join("$QTDIR","include",module)]) +# port qt4-mac: + self.AppendUnique(CPPPATH=[os.path.join("$QTDIR","include", "qt4")]) + self.AppendUnique(CPPPATH=[os.path.join("$QTDIR","include", "qt4", module)]) + if module in staticModules : + self.AppendUnique(LIBS=[module+debugSuffix]) # TODO: Add the debug suffix + self.AppendUnique(LIBPATH=[os.path.join("$QTDIR","lib")]) + else : +# self.Append(LINKFLAGS=['-framework', module]) +# port qt4-mac: + self.Append(LIBS=module) + if 'QtOpenGL' in modules: + self.AppendUnique(LINKFLAGS="-F/System/Library/Frameworks") + self.Append(LINKFLAGS=['-framework', 'AGL']) #TODO ughly kludge to avoid quotes + self.Append(LINKFLAGS=['-framework', 'OpenGL']) + self["QT4_MOCCPPPATH"] = self["CPPPATH"] + return +# This should work for mac but doesn't +# env.AppendUnique(FRAMEWORKPATH=[os.path.join(env['QTDIR'],'lib')]) +# env.AppendUnique(FRAMEWORKS=['QtCore','QtGui','QtOpenGL', 'AGL']) + """ + + +def exists(env): + return _detect(env) -- cgit v0.10.2-6-g49f6