I`m trying develop a extension to PHP with PHP-CPP on Windows. I build the .a and .so of PHP-CPP with MingW, but, when i go build the extension the compiler not found the phpcpp.h.
My file Makefile:
NAME = Teste
INI_DIR = /etc/php5/conf.d
EXTENSION_DIR = $(shell php-config --extension-dir)
EXTENSION = ${NAME}.so
INI = ${NAME}.ini
COMPILER = g++
LINKER = g++
COMPILER_FLAGS = -Wall -c -O2 -std=c++11 -fpic -o
LINKER_FLAGS = -shared
LINKER_DEPENDENCIES = -lphpcpp
RM = rm -f
CP = cp -f
MKDIR = mkdir -p
SOURCES = $(wildcard *.cpp)
OBJECTS = $(SOURCES:%.cpp=%.o)
all: ${OBJECTS} ${EXTENSION}
${EXTENSION}: ${OBJECTS}
${LINKER} ${LINKER_FLAGS} -o $@ ${OBJECTS}
${LINKER_DEPENDENCIES}
${OBJECTS}:
${COMPILER} ${COMPILER_FLAGS} $@ ${@:%.o=%.cpp}
install:
${CP} ${EXTENSION} ${EXTENSION_DIR}
${CP} ${INI} ${INI_DIR}
clean:
${RM} ${EXTENSION} ${OBJECTS}
Folder Structure:
main.cpp
Makefile
phpcpp.a
phpcpp.so
Sorry for my bad English.
You can try to generate a visual studio project with cmake / cmake gui - there is a "CMakeLists.txt" in the root folder of "PHP-CPP" Directory.
Now you can compile it with msvc ... but be aware of the mixed code from c and c++ - there are some .c headers included - maybe you have to edit some compiler options ...