From fe3c7fdf52e4bfd6e736a54c20eb12bb5cfd1f30 Mon Sep 17 00:00:00 2001 From: Emiel Bruijntjes Date: Sat, 24 Aug 2013 17:38:05 +0200 Subject: initial setup for library --- tests/Makefile | 5 +++++ tests/simple/Makefile | 22 ++++++++++++++++++++++ tests/simple/simple.cpp | 35 +++++++++++++++++++++++++++++++++++ 3 files changed, 62 insertions(+) create mode 100644 tests/Makefile create mode 100644 tests/simple/Makefile create mode 100644 tests/simple/simple.cpp (limited to 'tests') diff --git a/tests/Makefile b/tests/Makefile new file mode 100644 index 0000000..2f74b32 --- /dev/null +++ b/tests/Makefile @@ -0,0 +1,5 @@ +all: + cd simple; $(MAKE) + +clean: + cd simple; $(MAKE) clean diff --git a/tests/simple/Makefile b/tests/simple/Makefile new file mode 100644 index 0000000..e3bd7c7 --- /dev/null +++ b/tests/simple/Makefile @@ -0,0 +1,22 @@ +CPP = g++ +RM = rm -f +CPP_FLAGS = -Wall -c -I. -O2 + +LD = g++ +LD_FLAGS = -Wall -shared -O2 +RESULT = simple.so + +SOURCES = $(wildcard *.cpp) +OBJECTS = $(SOURCES:%.cpp=%.o) + +all: ${OBJECTS} ${RESULT} + +${RESULT}: ${OBJECTS} + ${LD} ${LD_FLAGS} -o $@ ${OBJECTS} -lphpcpp + +clean: + ${RM} *.obj *~* ${OBJECTS} ${RESULT} + +${OBJECTS}: + ${CPP} ${CPP_FLAGS} -fpic -o $@ ${@:%.o=%.cpp} + diff --git a/tests/simple/simple.cpp b/tests/simple/simple.cpp new file mode 100644 index 0000000..36db294 --- /dev/null +++ b/tests/simple/simple.cpp @@ -0,0 +1,35 @@ +/** + * Simple.h + * + * A very simple extension that does almost nothing + * + * @author Emiel Bruijntjes + * @copyright 2013 Copernica BV + */ +#include + +/** + * Override the extension class + */ +class SimpleExtension : public PhpCpp::Extension +{ +public: + /** + * Constructor + */ + SimpleExtension() : Extension( + "simple", + "1.0", + "Emiel Bruijntjes ", + "http://www.copernica.com", + "Copyright 2013 Copernica BV") + { + } +}; + +extern "C" { + +// create the object for the PHP extension +PHP_CPP_EXTENSION(SimpleExtension); + +} -- cgit v1.2.3