From 253e9ec8fcd89a79b9cf3f62b9bfbc331fefcb88 Mon Sep 17 00:00:00 2001 From: Kayne Ruse Date: Sat, 8 Jun 2013 01:52:19 +1000 Subject: [PATCH] Created server shell --- makefile | 1 + server/main.cpp | 26 ++++++++++++++++++++++++ server/makefile | 38 +++++++++++++++++++++++++++++++++++ server/server_application.cpp | 21 +++++++++++++++++++ server/server_application.hpp | 15 ++++++++++++++ 5 files changed, 101 insertions(+) create mode 100644 server/main.cpp create mode 100644 server/makefile create mode 100644 server/server_application.cpp create mode 100644 server/server_application.hpp diff --git a/makefile b/makefile index 345b69b..cb89da0 100644 --- a/makefile +++ b/makefile @@ -2,6 +2,7 @@ OUTDIR=out all: $(OUTDIR) $(MAKE) -C libs + $(MAKE) -C server $(MAKE) -C client $(OUTDIR): diff --git a/server/main.cpp b/server/main.cpp new file mode 100644 index 0000000..c098d11 --- /dev/null +++ b/server/main.cpp @@ -0,0 +1,26 @@ +#include "server_application.hpp" + +#include +#include + +using namespace std; + +int main(int, char**) { +#ifdef DEBUG + cout << "Beginning server" << endl; +#endif + try { + ServerApplication app; + app.Init(); + app.Proc(); + app.Quit(); + } + catch(exception& e) { + cerr << "Fatal error: " << e.what() << endl; + return 1; + } +#ifdef DEBUG + cout << "Clean exit" << endl; +#endif + return 0; +} diff --git a/server/makefile b/server/makefile new file mode 100644 index 0000000..fd86c59 --- /dev/null +++ b/server/makefile @@ -0,0 +1,38 @@ +#config +LIBDIR=../libs +LIB=-lmingw32 -lSDLmain -lSDL $(LIBDIR)/out/libCodebase.a $(LIBDIR)/out/libSDL_net.a +INCLUDES=$(LIBDIR)/Codebase $(LIBDIR)/SDL_net +CXXFLAGS+=-std=c++11 -DDEBUG $(addprefix -I,$(INCLUDES)) + +#source +SRC=$(wildcard *.cpp) + +#objects +OBJDIR=obj +OBJ=$(addprefix $(OBJDIR)/,$(SRC:.cpp=.o)) + +#output +OUTDIR=../out +OUT=$(addprefix $(OUTDIR)/,server) + +#targets +all: $(OBJ) $(OUT) + $(CXX) $(CXXFLAGS) -o $(OUT) $(OBJ) $(LIB) + +$(OBJ): | $(OBJDIR) + +$(OUT): | $(OUTDIR) + +$(OBJDIR): + mkdir $(OBJDIR) + +$(OUTDIR): + mkdir $(OUTDIR) + +$(OBJDIR)/%.o: %.cpp + $(CXX) $(CXXFLAGS) -c -o $@ $< + +clean: + $(RM) *.o *.a *.exe + +rebuild: clean all diff --git a/server/server_application.cpp b/server/server_application.cpp new file mode 100644 index 0000000..242f5af --- /dev/null +++ b/server/server_application.cpp @@ -0,0 +1,21 @@ +#include "server_application.hpp" + +ServerApplication::ServerApplication() { + // +} + +ServerApplication::~ServerApplication() { + // +} + +void ServerApplication::Init() { + // +} + +void ServerApplication::Proc() { + // +} + +void ServerApplication::Quit() { + // +} diff --git a/server/server_application.hpp b/server/server_application.hpp new file mode 100644 index 0000000..254dbb5 --- /dev/null +++ b/server/server_application.hpp @@ -0,0 +1,15 @@ +#ifndef SERVERAPPLICATION_HPP_ +#define SERVERAPPLICATION_HPP_ + +class ServerApplication { +public: + ServerApplication(); + ~ServerApplication(); + void Init(); + void Proc(); + void Quit(); +private: + bool running = true; +}; + +#endif