Reading this post and this article I got my first PHP extension up and running.
Here is the config.m4 file from the article that I used (to keep it clear I kept the same vehicles and car class names from the article, although my real classes has different names):
PHP_ARG_ENABLE(vehicles,
[Whether to enable the "vehicles" extension],
[ --enable-vehicles Enable "vehicles" extension support])
if test $PHP_VEHICLES != "no"; then
PHP_REQUIRE_CXX()
PHP_SUBST(VEHICLES_SHARED_LIBADD)
PHP_ADD_LIBRARY(stdc++, 1, VEHICLES_SHARED_LIBADD)
PHP_NEW_EXTENSION(vehicles, vehicles.cc car.cc, $ext_shared)
fi
What I need now is to move o another level of code organization as follow:
a) Moving the carclass to a common vehicle class folder with other vehicle classes (truck, bus, etc.)
b) Build a shared library will all of those classes
c) Call that shared library class from PHP
So, I would have the following directory structure like:
vehicles -> src = The .cpp classes and include files
vehicles -> lib = The vehicle.so shared library
How do I modify the config.m4 to work with this structure, considering all the vehicle´s classes include files from the original paths and including the shared .so library to the final built.
Thanks for helping.