diff --git a/.hgignore b/.hgignore index d72f39e..24cfe49 100644 --- a/.hgignore +++ b/.hgignore @@ -3,3 +3,4 @@ syntax: glob *.a *.swp ws +test_adapter diff --git a/Makefile b/Makefile index d67c5e3..cbe9e8d 100644 --- a/Makefile +++ b/Makefile @@ -3,12 +3,10 @@ include Makefile.conf -include local.conf -TARGET?=libpEpAdapter.a -PEPENGINE_IN?=$(HOME) - CXXFLAGS += -I$(HOME)/include -std=c++14 -O0 -g SOURCE=$(wildcard *.cc) +HEADERS=$(wildcard *.hh) OBJECTS=$(subst .cc,.o,$(SOURCE)) WITHOUT_TESTS=$(patsubst test%.o,,$(OBJECTS)) @@ -20,7 +18,7 @@ all: $(TARGET) $(TARGET): $(WITHOUT_TESTS) ar -rc $@ $^ -.PHONY: clean test +.PHONY: clean test install clean: rm -f $(TARGET) $(OBJECTS) *.a test_adapter @@ -29,5 +27,9 @@ test: test_adapter ./test_adapter test_adapter: test_adapter.o $(TARGET) - $(CXX) -o $@ -L$(HOME)/lib -lpEpEngine -L. -lpEpAdapter $< + $(CXX) -o $@ -L$(PEP)/lib -lpEpEngine -L. -lpEpAdapter $< + +install: + -mkdir -p $(PEP)/include + cp $(HEADERS) $(PEP)/include diff --git a/Makefile.conf b/Makefile.conf index be29840..e652e79 100644 --- a/Makefile.conf +++ b/Makefile.conf @@ -1,2 +1,4 @@ -# TARGET=libpEpAdapter.a -# PEPENGINE_IN=$(HOME) +TARGET=libpEpAdapter.a +PREFIX=$(HOME) +PEP=$(HOME) + diff --git a/test_adapter.cc b/test_adapter.cc new file mode 100644 index 0000000..15f8d88 --- /dev/null +++ b/test_adapter.cc @@ -0,0 +1,29 @@ +#include "Adapter.hh" +#include +#include +#include + +using namespace pEp; +using namespace std; + +PEP_STATUS messageToSend(struct _message *msg) +{ + cout << "calling messageToSend();\n"; + return PEP_STATUS_OK; +} + +PEP_STATUS notifyHandshake(void *obj, pEp_identity *me, pEp_identity *partner, sync_handshake_signal signal) +{ + cout << "calling notifyHandshake();\n"; + return PEP_STATUS_OK; +} + +int main() +{ + Adapter(messageToSend, notifyHandshake); + sleep(3); + Adapter::shutdown(); + + return 0; +} +