From c8df1f88f43b5f467cd8d3725a477c6532ce7f4d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Remko=20Tron=C3=A7on?= <git@el-tramo.be>
Date: Sun, 13 Sep 2009 21:09:47 +0200
Subject: Start splitting up monolithic Swiften SConscript file.


diff --git a/Swiften/Application/SConscript b/Swiften/Application/SConscript
new file mode 100644
index 0000000..d13b63b
--- /dev/null
+++ b/Swiften/Application/SConscript
@@ -0,0 +1,15 @@
+Import("swiften_env")
+
+sources = [
+		"Application.cpp",
+		"ApplicationMessageDisplay.cpp",
+	]
+
+if swiften_env["PLATFORM"] == "darwin" :
+	sources += [
+			"MacOSX/MacOSXApplication.cpp",
+			"MacOSX/MacOSXApplicationMessageDisplay.mm"
+		]
+
+objects = swiften_env.StaticObject(sources)
+swiften_env.Append(SWIFTEN_OBJECTS = [objects])
diff --git a/Swiften/Base/SConscript b/Swiften/Base/SConscript
new file mode 100644
index 0000000..d308e11
--- /dev/null
+++ b/Swiften/Base/SConscript
@@ -0,0 +1,9 @@
+Import("swiften_env")
+
+objects = swiften_env.StaticObject([
+			"ByteArray.cpp",
+			"IDGenerator.cpp",
+			"String.cpp",
+			"sleep.cpp",
+		])
+swiften_env.Append(SWIFTEN_OBJECTS = [objects])
diff --git a/Swiften/EventLoop/SConscript b/Swiften/EventLoop/SConscript
new file mode 100644
index 0000000..93341a3
--- /dev/null
+++ b/Swiften/EventLoop/SConscript
@@ -0,0 +1,17 @@
+Import("swiften_env")
+
+sources = [
+		"EventLoop.cpp",
+		"EventOwner.cpp",
+		"MainEventLoop.cpp",
+		"SimpleEventLoop.cpp",
+	]
+
+if swiften_env["PLATFORM"] == "darwin" :
+	sources += [
+			"Cocoa/CocoaEventLoop.mm",
+			"Cocoa/CocoaEvent.mm"
+		]
+
+objects = swiften_env.StaticObject(sources)
+swiften_env.Append(SWIFTEN_OBJECTS = [objects])
diff --git a/Swiften/History/SConscript b/Swiften/History/SConscript
new file mode 100644
index 0000000..328ce1c
--- /dev/null
+++ b/Swiften/History/SConscript
@@ -0,0 +1,10 @@
+Import("swiften_env")
+
+myenv = swiften_env.Clone()
+myenv.MergeFlags(swiften_env["SQLITE_FLAGS"])
+
+objects = myenv.StaticObject([
+			"HistoryManager.cpp",
+			"SQLiteHistoryManager.cpp",
+		])
+swiften_env.Append(SWIFTEN_OBJECTS = [objects])
diff --git a/Swiften/JID/SConscript b/Swiften/JID/SConscript
new file mode 100644
index 0000000..d48fbb0
--- /dev/null
+++ b/Swiften/JID/SConscript
@@ -0,0 +1,9 @@
+Import("swiften_env")
+
+myenv = swiften_env.Clone()
+myenv.MergeFlags(swiften_env["LIBIDN_FLAGS"])
+
+objects = myenv.StaticObject([
+			"JID.cpp",
+		])
+swiften_env.Append(SWIFTEN_OBJECTS = [objects])
diff --git a/Swiften/LinkLocal/SConscript b/Swiften/LinkLocal/SConscript
new file mode 100644
index 0000000..f36d467
--- /dev/null
+++ b/Swiften/LinkLocal/SConscript
@@ -0,0 +1,34 @@
+Import("swiften_env")
+
+myenv = swiften_env.Clone()
+myenv.MergeFlags(swiften_env.get("BONJOUR_FLAGS", ""))
+
+sources = [
+		"DNSSD/DNSSDBrowseQuery.cpp",
+		"DNSSD/DNSSDQuerier.cpp",
+		"DNSSD/DNSSDRegisterQuery.cpp",
+		"DNSSD/DNSSDResolveHostnameQuery.cpp",
+		"DNSSD/DNSSDResolveServiceQuery.cpp",
+		"DNSSD/DNSSDServiceID.cpp",
+		"DNSSD/Fake/FakeDNSSDQuerier.cpp",
+		"DNSSD/Fake/FakeDNSSDQuery.cpp",
+		"DNSSD/PlatformDNSSDQuerierFactory.cpp",
+		"IncomingLinkLocalSession.cpp",
+		"LinkLocalConnector.cpp",
+		"LinkLocalService.cpp",
+		"LinkLocalServiceBrowser.cpp",
+		"LinkLocalServiceInfo.cpp",
+		"OutgoingLinkLocalSession.cpp",
+	]
+
+if myenv.get("HAVE_BONJOUR", 0) :
+	myenv.Append(CPPDEFINES = "HAVE_BONJOUR")
+	sources += [
+			"DNSSD/Bonjour/BonjourQuerier.cpp",
+			"DNSSD/Bonjour/BonjourQuery.cpp",
+		]
+elif myenv.get("HAVE_AVAHI", 0) :
+	sources += ["DNSSD/Avahi/AvahiQuerier.cpp"]
+
+objects = myenv.StaticObject(sources)
+swiften_env.Append(SWIFTEN_OBJECTS = [objects])
diff --git a/Swiften/Network/SConscript b/Swiften/Network/SConscript
new file mode 100644
index 0000000..06d9350
--- /dev/null
+++ b/Swiften/Network/SConscript
@@ -0,0 +1,18 @@
+Import("swiften_env")
+
+myenv = swiften_env.Clone()
+myenv.MergeFlags(swiften_env["LIBIDN_FLAGS"])
+
+objects = myenv.StaticObject([
+			"BoostConnection.cpp",
+			"BoostConnectionFactory.cpp",
+			"BoostConnectionServer.cpp",
+			"MainBoostIOServiceThread.cpp",
+			"BoostIOServiceThread.cpp",
+			"ConnectionFactory.cpp",
+			"ConnectionServer.cpp",
+			"DomainNameResolver.cpp",
+			"HostAddress.cpp",
+			"Timer.cpp",
+		])
+swiften_env.Append(SWIFTEN_OBJECTS = [objects])
diff --git a/Swiften/Parser/SConscript b/Swiften/Parser/SConscript
new file mode 100644
index 0000000..e3cd288
--- /dev/null
+++ b/Swiften/Parser/SConscript
@@ -0,0 +1,53 @@
+Import("swiften_env")
+
+myenv = swiften_env.Clone()
+myenv.MergeFlags(swiften_env["BOOST_FLAGS"])
+myenv.MergeFlags(swiften_env.get("LIBXML_FLAGS", ""))
+myenv.MergeFlags(swiften_env.get("EXPAT_FLAGS", ""))
+
+sources = [
+		"AuthRequestParser.cpp",
+		"CompressParser.cpp",
+		"ElementParser.cpp",
+		"IQParser.cpp",
+		"MessageParser.cpp",
+		"PayloadParser.cpp",
+		"PayloadParserFactory.cpp",
+		"PayloadParserFactoryCollection.cpp",
+		"PayloadParsers/BodyParser.cpp",
+		"PayloadParsers/DiscoInfoParser.cpp",
+		"PayloadParsers/ErrorParser.cpp",
+		"PayloadParsers/FullPayloadParserFactoryCollection.cpp",
+		"PayloadParsers/PriorityParser.cpp",
+		"PayloadParsers/RawXMLPayloadParser.cpp",
+		"PayloadParsers/ResourceBindParser.cpp",
+		"PayloadParsers/RosterParser.cpp",
+		"PayloadParsers/SecurityLabelParser.cpp",
+		"PayloadParsers/SecurityLabelsCatalogParser.cpp",
+		"PayloadParsers/SoftwareVersionParser.cpp",
+		"PayloadParsers/StorageParser.cpp",
+		"PayloadParsers/StatusParser.cpp",
+		"PayloadParsers/StatusShowParser.cpp",
+		"PayloadParsers/VCardParser.cpp",
+		"PayloadParsers/VCardUpdateParser.cpp",
+		"PlatformXMLParserFactory.cpp",
+		"PresenceParser.cpp",
+		"SerializingParser.cpp",
+		"StanzaParser.cpp",
+		"StreamFeaturesParser.cpp",
+		"XMLParser.cpp",
+		"XMLParserClient.cpp",
+		"XMLParserFactory.cpp",
+		"XMPPParser.cpp",
+		"XMPPParserClient.cpp",
+	]
+
+if myenv.get("HAVE_EXPAT", 0) :
+	myenv.Append(CPPDEFINES = "HAVE_EXPAT")
+	sources += ["ExpatParser.cpp"]
+if myenv.get("HAVE_LIBXML", 0) :
+	myenv.Append(CPPDEFINES = "HAVE_LIBXML")
+	sources += ["LibXMLParser.cpp"]
+
+objects = myenv.StaticObject(sources)
+swiften_env.Append(SWIFTEN_OBJECTS = [objects])
diff --git a/Swiften/SConscript b/Swiften/SConscript
index 77cb61d..6572e9a 100644
--- a/Swiften/SConscript
+++ b/Swiften/SConscript
@@ -5,26 +5,18 @@ env["SWIFTEN_FLAGS"] = {
 		"LIBS": ["Swiften"]
 	}
 
-myenv = env.Clone()
-myenv.MergeFlags(env["BOOST_FLAGS"])
-myenv.MergeFlags(env["LIBIDN_FLAGS"])
-myenv.MergeFlags(env["SQLITE_FLAGS"])
-myenv.MergeFlags(env.get("LIBXML_FLAGS", ""))
-myenv.MergeFlags(env.get("EXPAT_FLAGS", ""))
-myenv.MergeFlags(env.get("BONJOUR_FLAGS", ""))
+swiften_env = env.Clone()
+swiften_env.MergeFlags(env["BOOST_FLAGS"])
+Export("swiften_env")
+
+# TODO: Move all this to a submodule SConscript
+myenv = swiften_env.Clone()
 myenv.MergeFlags(env["ZLIB_FLAGS"])
 myenv.MergeFlags(env["OPENSSL_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",
@@ -36,76 +28,10 @@ sources = [
 		"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/MainBoostIOServiceThread.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/StorageParser.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",
@@ -148,52 +74,27 @@ sources = [
 		"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 env["PLATFORM"] == "darwin" :
-	sources += [
-			"EventLoop/Cocoa/CocoaEventLoop.mm",
-			"EventLoop/Cocoa/CocoaEvent.mm"
-		]
-
-if myenv.get("HAVE_BONJOUR", 0) :
-	myenv.Append(CPPDEFINES = "HAVE_BONJOUR")
-	sources += [
-			"LinkLocal/DNSSD/Bonjour/BonjourQuerier.cpp",
-			"LinkLocal/DNSSD/Bonjour/BonjourQuery.cpp",
-		]
-elif myenv.get("HAVE_AVAHI", 0) :
-	sources += ["LinkLocal/DNSSD/Avahi/AvahiQuerier.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"
-		]
+SConscript(dirs = [
+		"Base",
+		"Application",
+		"EventLoop",
+		"Parser",
+		"JID",
+		"Network",
+		"History",
+		"StreamStack",
+		"LinkLocal",
+	])
 
-myenv.StaticLibrary("Swiften", sources)
+myenv.StaticLibrary("Swiften", sources + swiften_env["SWIFTEN_OBJECTS"])
 
 env.Append(UNITTEST_SOURCES = [
 		File("Application/UnitTest/ApplicationTest.cpp"),
diff --git a/Swiften/StreamStack/SConscript b/Swiften/StreamStack/SConscript
new file mode 100644
index 0000000..449a39b
--- /dev/null
+++ b/Swiften/StreamStack/SConscript
@@ -0,0 +1,21 @@
+Import("swiften_env")
+
+myenv = swiften_env.Clone()
+myenv.MergeFlags(swiften_env["OPENSSL_FLAGS"])
+
+sources = [
+		"HighLayer.cpp",
+		"LowLayer.cpp",
+		"PlatformTLSLayerFactory.cpp",
+		"StreamStack.cpp",
+		"TLSLayerFactory.cpp",
+		"WhitespacePingLayer.cpp",
+		"XMPPLayer.cpp",
+	]
+
+if myenv.get("HAVE_OPENSSL", 0) :
+	myenv.Append(CPPDEFINES = "HAVE_OPENSSL")
+	sources += ["OpenSSLLayer.cpp"]
+
+objects = myenv.StaticObject(sources)
+swiften_env.Append(SWIFTEN_OBJECTS = [objects])
-- 
cgit v0.10.2-6-g49f6