[PHP7] Make default C++ extension .cxx

This is SWIG's default for every language except PHP, and now is a
good time to make this change so that once we drop PHP5 support, we'll
have the same default everywhere.  It's easy to override the default
with -cppext cxx to get the PHP5 behaviour.
This commit is contained in:
Olly Betts 2016-11-30 13:27:13 +13:00
commit 75a00cd15e
6 changed files with 13 additions and 7 deletions

View file

@ -7,8 +7,10 @@ Version 3.0.11 (in progress)
2016-11-30: olly
[PHP] Add support for PHP7. PHP5's C extension API has changed substantially
so you need to use -php7 to specify you want PHP7 compatible wrappers.
Fixes https://github.com/swig/swig/issues/571
so you need to use -php7 to specify you want PHP7 compatible wrappers. The
default extension for generated wrappers is now .cxx (to match SWIG's default
for every other language - to generate foo_wrap.cpp you can run SWIG with
-cppext cpp). Fixes https://github.com/swig/swig/issues/571
2016-11-28: wsfulton
Fix %rename override of wildcard %rename for templates. For example:

View file

@ -106,7 +106,12 @@ also contain PHP class wrappers.
<p>
SWIG can generate PHP extensions from C++ libraries as well when
given the <tt>-c++</tt> option. The support for C++ is discussed in
more detail in <a href="#Php_nn2_6">section 27.2.6</a>.
more detail in <a href="#Php_nn2_6">section 27.2.6</a>. The generated
C++ wrapper will be called example_wrap.cpp (for PHP5) or
example_wrap.cxx (for PHP7 where the default has been changed to align
with SWIG's default for every other language). You can specify a
different extension for the C++ wrapper using <tt>-cppext</tt> -
e.g. if you want example_wrap.cc use <tt>-cppext cc</tt>.
</p>
<p>

View file

@ -145,7 +145,7 @@ can be obtained by typing <tt>swig -help</tt> or <tt>swig
-c++ Enable C++ parsing
-cppext <em>ext</em> Change file extension of C++ generated files to <em>ext</em>
(default is cxx, except for PHP which uses cpp)
(default is cxx, except for PHP5 which uses cpp)
-D<em>symbol</em> Define a preprocessor symbol
-Fstandard Display error/warning messages in commonly used format
-Fmicrosoft Display error/warning messages in Microsoft format

View file

@ -1188,7 +1188,7 @@ php: $(SRCDIR_SRCS)
# --------------------------------------------------------------------
php_cpp: $(SRCDIR_SRCS)
$(SWIG) -php7 -cppext cxx -c++ $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH)
$(SWIG) -php7 -c++ $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH)
$(CXX) -c $(CCSHARED) $(CPPFLAGS) $(CXXFLAGS) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS) $(ICXXSRCS) $(INCLUDES) $(PHP_INCLUDE)
$(CXXSHARED) $(CXXFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(LIBS) $(CPP_DLLIBS) -o $(LIBPREFIX)$(TARGET)$(PHP_SO)

View file

@ -64,7 +64,7 @@ static const char *usage1 = (const char *) "\
-copyctor - Automatically generate copy constructors wherever possible\n\
-cpperraswarn - Treat the preprocessor #error statement as #warning (default)\n\
-cppext <ext> - Change file extension of generated C++ files to <ext>\n\
(default is cxx, except for PHP which uses cpp)\n\
(default is cxx, except for PHP5 which uses cpp)\n\
-copyright - Display copyright notices\n\
-debug-classes - Display information about the classes found in the interface\n\
-debug-module <n>- Display module parse tree at stages 1-4, <n> is a csv list of stages\n\

View file

@ -191,7 +191,6 @@ public:
virtual void main(int argc, char *argv[]) {
SWIG_library_directory("php");
SWIG_config_cppext("cpp");
for (int i = 1; i < argc; i++) {
if (strcmp(argv[i], "-prefix") == 0) {