From 3c6895ea29dad8a93d7d3ee43bb70e2bf5d8717e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Remko=20Tron=C3=A7on?= Date: Tue, 21 Jul 2009 17:07:02 +0200 Subject: Create a Slimber/CLI module. diff --git a/Slimber/CLI/Makefile.inc b/Slimber/CLI/Makefile.inc new file mode 100644 index 0000000..601929c --- /dev/null +++ b/Slimber/CLI/Makefile.inc @@ -0,0 +1,16 @@ +SLIMBER_CLI_TARGET = Slimber/CLI/slimber +SLIMBER_CLI_SOURCES = \ + Slimber/CLI/main.cpp +SLIMBER_CLI_OBJECTS = \ + $(SLIMBER_CLI_SOURCES:.cpp=.o) + +$(SLIMBER_CLI_TARGET): $(SWIFTEN_TARGET) $(SLIMBER_TARGET) $(SLIMBER_CLI_OBJECTS) + $(QUIET_LINK)$(CXX) -o $(SLIMBER_CLI_TARGET) $(SLIMBER_CLI_OBJECTS) $(LDFLAGS) $(SLIMBER_TARGET) $(SWIFTEN_TARGET) $(LIBS) + +TARGETS += $(SLIMBER_CLI_TARGET) +SLIMBER_TARGETS += $(SLIMBER_CLI_TARGET) +CLEANFILES += \ + $(SLIMBER_CLI_OBJECTS) \ + $(SLIMBER_CLI_TARGET) +DEPS += \ + $(SLIMBER_CLI_SOURCES:.cpp=.dep) \ diff --git a/Slimber/CLI/main.cpp b/Slimber/CLI/main.cpp new file mode 100644 index 0000000..40f41c8 --- /dev/null +++ b/Slimber/CLI/main.cpp @@ -0,0 +1,37 @@ +#include +#include + +#include "Swiften/Base/Platform.h" +#if defined(SWIFTEN_PLATFORM_MACOSX) || defined(SWIFTEN_PLATFORM_WINDOWS) +#include "Swiften/LinkLocal/AppleDNSSDService.h" +#else +#include "Swiften/LinkLocal/AvahiDNSSDService.h" +#endif +#include "Slimber/Server.h" +#include "Slimber/FileVCardCollection.h" +#include "Swiften/LinkLocal/LinkLocalRoster.h" +#include "Swiften/EventLoop/SimpleEventLoop.h" +#include "Swiften/Application/Platform/PlatformApplication.h" + +using namespace Swift; + +int main() { + SimpleEventLoop eventLoop; + + boost::shared_ptr dnsSDService; +#if defined(SWIFTEN_PLATFORM_MACOSX) || defined(SWIFTEN_PLATFORM_WINDOWS) + dnsSDService = boost::shared_ptr( + new AppleDNSSDService()); +#else + dnsSDService = boost::shared_ptr( + new AvahiDNSSDService()); +#endif + + boost::shared_ptr linkLocalRoster = boost::shared_ptr(new LinkLocalRoster(dnsSDService)); + + FileVCardCollection vCardCollection(PlatformApplication("Slimber").getSettingsDir()); + + Server server(5222, 5562, linkLocalRoster, dnsSDService, &vCardCollection); + eventLoop.run(); + return 0; +} diff --git a/Slimber/Cocoa/Makefile.inc b/Slimber/Cocoa/Makefile.inc index e4a9c67..73b0f5d 100644 --- a/Slimber/Cocoa/Makefile.inc +++ b/Slimber/Cocoa/Makefile.inc @@ -17,6 +17,8 @@ SLIMBER_COCOA_RESOURCES = \ Slimber/Resources/UsersOnline.png \ Slimber/Resources/UsersOffline.png +TARGETS += $(SLIMBER_COCOA_TARGET) +SLIMBER_TARGETS += $(SLIMBER_COCOA_TARGET) SLIMBER_COCOA_NIBS = \ $(SLIMBER_COCOA_XIBS:.xib=.nib) SLIMBER_COCOA_OBJECTS = \ diff --git a/Slimber/Makefile.inc b/Slimber/Makefile.inc index 6d52f0f..539646c 100644 --- a/Slimber/Makefile.inc +++ b/Slimber/Makefile.inc @@ -1,21 +1,24 @@ -SLIMBER_TARGET = Slimber/slimber +SLIMBER_TARGET = Slimber/Slimber.a SLIMBER_SOURCES = \ Slimber/FileVCardCollection.cpp \ Slimber/VCardCollection.cpp \ - Slimber/Server.cpp \ - Slimber/main.cpp + Slimber/Server.cpp SLIMBER_OBJECTS = \ $(SLIMBER_SOURCES:.cpp=.o) -.PHONY: slimber -slimber: $(SLIMBER_TARGET) - -$(SLIMBER_TARGET): $(SWIFTEN_TARGET) $(SLIMBER_OBJECTS) - $(QUIET_LINK)$(CXX) -o $(SLIMBER_TARGET) $(SLIMBER_OBJECTS) $(LDFLAGS) $(SWIFTEN_TARGET) $(LIBS) - -#TARGETS += $(SLIMBER_TARGET) -CLEANFILES += $(SLIMBER_OBJECTS) +CLEANFILES += \ + $(SLIMBER_OBJECTS) \ + $(SLIMBER_TARGET) DEPS += \ $(SLIMBER_SOURCES:.cpp=.dep) \ +include Slimber/CLI/Makefile.inc +ifeq ($(MACOSX),1) include Slimber/Cocoa/Makefile.inc +endif + +.PHONY: slimber +slimber: $(SLIMBER_TARGETS) + +$(SLIMBER_TARGET): $(SLIMBER_OBJECTS) + $(QUIET_AR)$(AR) $(ARFLAGS) $@ $(SLIMBER_OBJECTS) diff --git a/Slimber/main.cpp b/Slimber/main.cpp deleted file mode 100644 index 40f41c8..0000000 --- a/Slimber/main.cpp +++ /dev/null @@ -1,37 +0,0 @@ -#include -#include - -#include "Swiften/Base/Platform.h" -#if defined(SWIFTEN_PLATFORM_MACOSX) || defined(SWIFTEN_PLATFORM_WINDOWS) -#include "Swiften/LinkLocal/AppleDNSSDService.h" -#else -#include "Swiften/LinkLocal/AvahiDNSSDService.h" -#endif -#include "Slimber/Server.h" -#include "Slimber/FileVCardCollection.h" -#include "Swiften/LinkLocal/LinkLocalRoster.h" -#include "Swiften/EventLoop/SimpleEventLoop.h" -#include "Swiften/Application/Platform/PlatformApplication.h" - -using namespace Swift; - -int main() { - SimpleEventLoop eventLoop; - - boost::shared_ptr dnsSDService; -#if defined(SWIFTEN_PLATFORM_MACOSX) || defined(SWIFTEN_PLATFORM_WINDOWS) - dnsSDService = boost::shared_ptr( - new AppleDNSSDService()); -#else - dnsSDService = boost::shared_ptr( - new AvahiDNSSDService()); -#endif - - boost::shared_ptr linkLocalRoster = boost::shared_ptr(new LinkLocalRoster(dnsSDService)); - - FileVCardCollection vCardCollection(PlatformApplication("Slimber").getSettingsDir()); - - Server server(5222, 5562, linkLocalRoster, dnsSDService, &vCardCollection); - eventLoop.run(); - return 0; -} -- cgit v0.10.2-6-g49f6