diff options
author | Olly Betts <olly@survex.com> | 2022-12-03 14:16:28 +1300 |
---|---|---|
committer | Olly Betts <olly@survex.com> | 2023-04-23 11:09:08 +1200 |
commit | d3b17437b12625bd31118f40e06a3bb28b6c5fda (patch) | |
tree | 520b34dbfd464cfcee4c75435cb54c3259569345 | |
parent | 7bb7295a33c78e1739907bbebf151a2a27432a24 (diff) | |
download | swig-d3b17437b12625bd31118f40e06a3bb28b6c5fda.tar.gz |
[js] Stop using swig -c++ for C examples
22 files changed, 41 insertions, 27 deletions
diff --git a/Examples/Makefile.in b/Examples/Makefile.in index 0849597a9..5a4639076 100644 --- a/Examples/Makefile.in +++ b/Examples/Makefile.in @@ -711,14 +711,23 @@ endif # ---------------------------------------------------------------- javascript_wrapper: +ifeq (node,$(JSENGINE)) + $(SWIG) -javascript $(SWIGOPT) -$(JSENGINE) -o $(INTERFACEDIR)$(TARGET)_wrap.cxx $(INTERFACEPATH) +else $(SWIG) -javascript $(SWIGOPT) -$(JSENGINE) -o $(INTERFACEDIR)$(TARGET)_wrap.c $(INTERFACEPATH) +endif javascript_wrapper_cpp: $(SRCDIR_SRCS) $(SWIG) -javascript -c++ $(SWIGOPT) -$(JSENGINE) -o $(INTERFACEDIR)$(TARGET)_wrap.cxx $(INTERFACEPATH) javascript_build: $(SRCDIR_SRCS) +ifeq (node,$(JSENGINE)) + sed -e 's|$$srcdir|./$(SRCDIR)|g' $(SRCDIR)binding.gyp.in > binding.gyp + MAKEFLAGS= $(NODEGYP) --loglevel=silent configure build 1>>/dev/null +else $(CC) -c $(CCSHARED) $(CPPFLAGS) $(CFLAGS) $(ISRCS) $(SRCDIR_SRCS) $(INCLUDES) $(JSINCLUDES) - $(LDSHARED) $(CFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(JSDYNAMICLINKING) $(LIBS) -o $(LIBPREFIX)$(TARGET)$(SO) + $(LDSHARED) $(CCSHARED) $(CFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(JSDYNAMICLINKING) $(LIBS) -o $(LIBPREFIX)$(TARGET)$(SO) +endif javascript_build_cpp: $(SRCDIR_SRCS) ifeq (node,$(JSENGINE)) @@ -727,7 +736,6 @@ ifeq (node,$(JSENGINE)) else $(CXX) -c $(CCSHARED) $(CPPFLAGS) $(CXXFLAGS) $(ICXXSRCS) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS) $(INCLUDES) $(JSINCLUDES) $(CXXSHARED) $(CXXFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(JSDYNAMICLINKING) $(LIBS) $(CPP_DLLIBS) -o $(LIBPREFIX)$(TARGET)$(SO) - endif # These targets are used by the test-suite: diff --git a/Examples/javascript/class/Makefile b/Examples/javascript/class/Makefile index 54a8f7b03..b6805576e 100644 --- a/Examples/javascript/class/Makefile +++ b/Examples/javascript/class/Makefile @@ -1,3 +1,4 @@ -SRCS = example.cxx +CXXSRCS = example.cxx +_CPP = _cpp include $(SRCDIR)../example.mk diff --git a/Examples/javascript/constant/Makefile b/Examples/javascript/constant/Makefile index 0402f8d09..a80ecf16f 100644 --- a/Examples/javascript/constant/Makefile +++ b/Examples/javascript/constant/Makefile @@ -1,3 +1 @@ -SRCS = - include $(SRCDIR)../example.mk diff --git a/Examples/javascript/enum/Makefile b/Examples/javascript/enum/Makefile index 54a8f7b03..b6805576e 100644 --- a/Examples/javascript/enum/Makefile +++ b/Examples/javascript/enum/Makefile @@ -1,3 +1,4 @@ -SRCS = example.cxx +CXXSRCS = example.cxx +_CPP = _cpp include $(SRCDIR)../example.mk diff --git a/Examples/javascript/example.mk b/Examples/javascript/example.mk index cce99fa25..5a9ba8a99 100644 --- a/Examples/javascript/example.mk +++ b/Examples/javascript/example.mk @@ -13,18 +13,22 @@ SWIGEXE = $(SWIG_TOP)/swig SWIG_LIB_DIR = $(SWIG_TOP)/$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib TARGET = example INTERFACE = example.i -SWIGOPT = -DV8_VERSION=$(JSV8_VERSION) +SWIGOPT = + +ifneq (jsc, $(ENGINE)) +SWIGOPT += -DV8_VERSION=$(JSV8_VERSION) +endif check: build $(MAKE) -f $(EXAMPLES_TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='$(TARGET)' javascript_run build: - $(MAKE) -f $(EXAMPLES_TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(SRCS)' \ - SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \ - SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' javascript_wrapper_cpp - $(MAKE) -f $(EXAMPLES_TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(SRCS)' \ - SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \ - SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' javascript_build_cpp + $(MAKE) -f $(EXAMPLES_TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \ + SRCS='$(SRCS)' SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \ + SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' javascript_wrapper$(_CPP) + $(MAKE) -f $(EXAMPLES_TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \ + SRCS='$(SRCS)' SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \ + SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' javascript_build$(_CPP) clean: $(MAKE) -f $(EXAMPLES_TOP)/Makefile SRCDIR='$(SRCDIR)' javascript_clean diff --git a/Examples/javascript/exception/Makefile b/Examples/javascript/exception/Makefile index 54a8f7b03..b6805576e 100644 --- a/Examples/javascript/exception/Makefile +++ b/Examples/javascript/exception/Makefile @@ -1,3 +1,4 @@ -SRCS = example.cxx +CXXSRCS = example.cxx +_CPP = _cpp include $(SRCDIR)../example.mk diff --git a/Examples/javascript/functor/Makefile b/Examples/javascript/functor/Makefile index 0402f8d09..8085356b1 100644 --- a/Examples/javascript/functor/Makefile +++ b/Examples/javascript/functor/Makefile @@ -1,3 +1,3 @@ -SRCS = +_CPP = _cpp include $(SRCDIR)../example.mk diff --git a/Examples/javascript/native/Makefile b/Examples/javascript/native/Makefile index 0402f8d09..8085356b1 100644 --- a/Examples/javascript/native/Makefile +++ b/Examples/javascript/native/Makefile @@ -1,3 +1,3 @@ -SRCS = +_CPP = _cpp include $(SRCDIR)../example.mk diff --git a/Examples/javascript/nspace/Makefile b/Examples/javascript/nspace/Makefile index 0402f8d09..8085356b1 100644 --- a/Examples/javascript/nspace/Makefile +++ b/Examples/javascript/nspace/Makefile @@ -1,3 +1,3 @@ -SRCS = +_CPP = _cpp include $(SRCDIR)../example.mk diff --git a/Examples/javascript/operator/Makefile b/Examples/javascript/operator/Makefile index 0402f8d09..8085356b1 100644 --- a/Examples/javascript/operator/Makefile +++ b/Examples/javascript/operator/Makefile @@ -1,3 +1,3 @@ -SRCS = +_CPP = _cpp include $(SRCDIR)../example.mk diff --git a/Examples/javascript/overload/Makefile b/Examples/javascript/overload/Makefile index 0402f8d09..8085356b1 100644 --- a/Examples/javascript/overload/Makefile +++ b/Examples/javascript/overload/Makefile @@ -1,3 +1,3 @@ -SRCS = +_CPP = _cpp include $(SRCDIR)../example.mk diff --git a/Examples/javascript/pointer/Makefile b/Examples/javascript/pointer/Makefile index 54a8f7b03..413b64bbd 100644 --- a/Examples/javascript/pointer/Makefile +++ b/Examples/javascript/pointer/Makefile @@ -1,3 +1,3 @@ -SRCS = example.cxx +SRCS = example.c include $(SRCDIR)../example.mk diff --git a/Examples/javascript/pointer/binding.gyp.in b/Examples/javascript/pointer/binding.gyp.in index cb2b45e8f..cfd4854b0 100644 --- a/Examples/javascript/pointer/binding.gyp.in +++ b/Examples/javascript/pointer/binding.gyp.in @@ -2,7 +2,7 @@ "targets": [ { "target_name": "example", - "sources": [ "<!(cp $srcdir/example.cxx example-gypcopy.cxx && echo example-gypcopy.cxx)", "example_wrap.cxx" ], + "sources": [ "<!(cp $srcdir/example.c example-gypcopy.cxx && echo example-gypcopy.cxx)", "example_wrap.cxx" ], "include_dirs": ["$srcdir"] } ] diff --git a/Examples/javascript/pointer/example.cxx b/Examples/javascript/pointer/example.c index 8762329fe..8762329fe 100644 --- a/Examples/javascript/pointer/example.cxx +++ b/Examples/javascript/pointer/example.c diff --git a/Examples/javascript/reference/Makefile b/Examples/javascript/reference/Makefile index 54a8f7b03..b6805576e 100644 --- a/Examples/javascript/reference/Makefile +++ b/Examples/javascript/reference/Makefile @@ -1,3 +1,4 @@ -SRCS = example.cxx +CXXSRCS = example.cxx +_CPP = _cpp include $(SRCDIR)../example.mk diff --git a/Examples/javascript/simple/Makefile b/Examples/javascript/simple/Makefile index 54a8f7b03..413b64bbd 100644 --- a/Examples/javascript/simple/Makefile +++ b/Examples/javascript/simple/Makefile @@ -1,3 +1,3 @@ -SRCS = example.cxx +SRCS = example.c include $(SRCDIR)../example.mk diff --git a/Examples/javascript/simple/binding.gyp.in b/Examples/javascript/simple/binding.gyp.in index cb2b45e8f..cfd4854b0 100644 --- a/Examples/javascript/simple/binding.gyp.in +++ b/Examples/javascript/simple/binding.gyp.in @@ -2,7 +2,7 @@ "targets": [ { "target_name": "example", - "sources": [ "<!(cp $srcdir/example.cxx example-gypcopy.cxx && echo example-gypcopy.cxx)", "example_wrap.cxx" ], + "sources": [ "<!(cp $srcdir/example.c example-gypcopy.cxx && echo example-gypcopy.cxx)", "example_wrap.cxx" ], "include_dirs": ["$srcdir"] } ] diff --git a/Examples/javascript/simple/example.cxx b/Examples/javascript/simple/example.c index 1c2af789c..1c2af789c 100644 --- a/Examples/javascript/simple/example.cxx +++ b/Examples/javascript/simple/example.c diff --git a/Examples/javascript/template/Makefile b/Examples/javascript/template/Makefile index 0402f8d09..8085356b1 100644 --- a/Examples/javascript/template/Makefile +++ b/Examples/javascript/template/Makefile @@ -1,3 +1,3 @@ -SRCS = +_CPP = _cpp include $(SRCDIR)../example.mk diff --git a/Examples/javascript/variables/Makefile b/Examples/javascript/variables/Makefile index 54a8f7b03..413b64bbd 100644 --- a/Examples/javascript/variables/Makefile +++ b/Examples/javascript/variables/Makefile @@ -1,3 +1,3 @@ -SRCS = example.cxx +SRCS = example.c include $(SRCDIR)../example.mk diff --git a/Examples/javascript/variables/binding.gyp.in b/Examples/javascript/variables/binding.gyp.in index cb2b45e8f..cfd4854b0 100644 --- a/Examples/javascript/variables/binding.gyp.in +++ b/Examples/javascript/variables/binding.gyp.in @@ -2,7 +2,7 @@ "targets": [ { "target_name": "example", - "sources": [ "<!(cp $srcdir/example.cxx example-gypcopy.cxx && echo example-gypcopy.cxx)", "example_wrap.cxx" ], + "sources": [ "<!(cp $srcdir/example.c example-gypcopy.cxx && echo example-gypcopy.cxx)", "example_wrap.cxx" ], "include_dirs": ["$srcdir"] } ] diff --git a/Examples/javascript/variables/example.cxx b/Examples/javascript/variables/example.c index 15314b383..15314b383 100644 --- a/Examples/javascript/variables/example.cxx +++ b/Examples/javascript/variables/example.c |