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 = [
		"AttributeMap.cpp",
		"AuthRequestParser.cpp",
		"AuthChallengeParser.cpp",
		"AuthSuccessParser.cpp",
		"AuthResponseParser.cpp",
		"CompressParser.cpp",
		"ElementParser.cpp",
		"IQParser.cpp",
		"MessageParser.cpp",
		"PayloadParser.cpp",
		"StanzaAckParser.cpp",
		"BOSHBodyExtractor.cpp",
		"ComponentHandshakeParser.cpp",
		"PayloadParserFactory.cpp",
		"PayloadParserFactoryCollection.cpp",
		"PayloadParsers/BodyParser.cpp",
		"PayloadParsers/SubjectParser.cpp",
		"PayloadParsers/ChatStateParser.cpp",
		"PayloadParsers/CapsInfoParser.cpp",
		"PayloadParsers/DiscoInfoParser.cpp",
		"PayloadParsers/DiscoItemsParser.cpp",
		"PayloadParsers/ErrorParser.cpp",
		"PayloadParsers/FormParser.cpp",
		"PayloadParsers/IBBParser.cpp",
		"PayloadParsers/JingleParser.cpp",
		"PayloadParsers/JingleReasonParser.cpp",
		"PayloadParsers/JingleContentPayloadParser.cpp",
		"PayloadParsers/JingleIBBTransportMethodPayloadParser.cpp",
		"PayloadParsers/JingleS5BTransportMethodPayloadParser.cpp",
		"PayloadParsers/JingleFileTransferDescriptionParser.cpp",
		"PayloadParsers/JingleFileTransferReceivedParser.cpp",
		"PayloadParsers/JingleFileTransferHashParser.cpp",
		"PayloadParsers/StreamInitiationFileInfoParser.cpp",
		"PayloadParsers/CommandParser.cpp",
		"PayloadParsers/InBandRegistrationPayloadParser.cpp",
		"PayloadParsers/SearchPayloadParser.cpp",
		"PayloadParsers/FullPayloadParserFactoryCollection.cpp",
		"PayloadParsers/PriorityParser.cpp",
		"PayloadParsers/PrivateStorageParser.cpp",
		"PayloadParsers/RawXMLPayloadParser.cpp",
		"PayloadParsers/ResourceBindParser.cpp",
		"PayloadParsers/RosterItemExchangeParser.cpp",
		"PayloadParsers/RosterParser.cpp",
		"PayloadParsers/SecurityLabelParser.cpp",
		"PayloadParsers/SecurityLabelsCatalogParser.cpp",
		"PayloadParsers/SoftwareVersionParser.cpp",
		"PayloadParsers/StorageParser.cpp",
		"PayloadParsers/StatusParser.cpp",
		"PayloadParsers/StatusShowParser.cpp",
		"PayloadParsers/StreamInitiationParser.cpp",
		"PayloadParsers/BytestreamsParser.cpp",
		"PayloadParsers/VCardParser.cpp",
		"PayloadParsers/VCardUpdateParser.cpp",
		"PayloadParsers/DelayParser.cpp",
		"PayloadParsers/MUCUserPayloadParser.cpp",
		"PayloadParsers/MUCAdminPayloadParser.cpp",
		"PayloadParsers/MUCOwnerPayloadParser.cpp",
		"PayloadParsers/MUCDestroyPayloadParser.cpp",
		"PayloadParsers/MUCInvitationPayloadParser.cpp",
		"PayloadParsers/MUCItemParser.cpp",
		"PayloadParsers/NicknameParser.cpp",
		"PayloadParsers/ReplaceParser.cpp",
		"PayloadParsers/LastParser.cpp",
		"PayloadParsers/IdleParser.cpp",
		"PayloadParsers/S5BProxyRequestParser.cpp",
		"PayloadParsers/DeliveryReceiptParser.cpp",
		"PayloadParsers/DeliveryReceiptRequestParser.cpp",
		"PayloadParsers/UserLocationParser.cpp",
		"PayloadParsers/UserTuneParser.cpp",
		"PayloadParsers/WhiteboardParser.cpp",
		"PayloadParsers/PubSubErrorParserFactory.cpp",
		"PayloadParsers/ResultSetParser.cpp",
		"PayloadParsers/ForwardedParser.cpp",
		"PayloadParsers/MAMFinParser.cpp",
		"PayloadParsers/MAMResultParser.cpp",
		"PayloadParsers/MAMQueryParser.cpp",
		"PayloadParsers/IsodeIQDelegationParser.cpp",
		"PlatformXMLParserFactory.cpp",
		"PresenceParser.cpp",
		"SerializingParser.cpp",
		"StanzaParser.cpp",
		"StreamErrorParser.cpp",
		"StreamFeaturesParser.cpp",
		"StreamManagementEnabledParser.cpp",
		"StreamResumeParser.cpp",
		"StreamResumedParser.cpp",
		"Tree/ParserElement.cpp",
		"Tree/NullParserElement.cpp",
		"Tree/TreeReparser.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.SwiftenObject(sources)
swiften_env.Append(SWIFTEN_OBJECTS = [objects])