[Go] Add -cgo option, required for Go version 1.5 and later.
This commit is contained in:
parent
df36d84f1b
commit
9ad497c08e
11 changed files with 1697 additions and 300 deletions
|
|
@ -1752,15 +1752,18 @@ scilab_clean:
|
|||
|
||||
GO = @GO@
|
||||
GOGCC = @GOGCC@
|
||||
GCCGO = @GCCGO@
|
||||
GO1 = @GO1@
|
||||
GO12 = @GO12@
|
||||
GO13 = @GO13@
|
||||
GO15 = @GO15@
|
||||
GOC = @GOC@
|
||||
GOOPT = @GOOPT@
|
||||
GCCGOOPT = @GCCGOOPT@
|
||||
GOVERSIONOPTION = @GOVERSIONOPTION@
|
||||
|
||||
GOSWIGARG = `if $(GOGCC) ; then echo -gccgo; fi`
|
||||
GOCOMPILEARG = `if $(GOGCC) ; then echo -c -g; elif $(GO1) ; then echo tool $(GOC:c=g) ; fi` `if $(GO13) && ! $(GOGCC); then echo -pack ; fi`
|
||||
GOCOMPILEARG = `if $(GO1) ; then echo tool $(GOC:c=g) ; fi` `if $(GO13) || $(GO15); then echo -pack ; fi`
|
||||
|
||||
GOSRCS = $(INTERFACE:.i=.go)
|
||||
GOCSRCS = $(INTERFACE:.i=_gc.c)
|
||||
|
|
@ -1769,7 +1772,9 @@ GOLD = $(GOC:c=l)
|
|||
GOTOOL = `if $(GO1) ; then echo go tool; fi`
|
||||
GOPACK = `if $(GO1) ; then echo go tool pack; else echo gopack; fi`
|
||||
|
||||
GOPACKAGE = $(INTERFACE:.i=.a)
|
||||
GOPACKAGE = $(notdir $(INTERFACE:.i=.a))
|
||||
|
||||
GOPATHDIR = gopath/src/$(INTERFACE:.i=)
|
||||
|
||||
GOOBJEXT = $(GOC:c=)
|
||||
GOGCOBJS = $(GOSRCS:.go=.$(GOOBJEXT))
|
||||
|
|
@ -1779,19 +1784,21 @@ GOGCCOBJS = $(GOSRCS:.go=.@OBJEXT@)
|
|||
# Build a Go module (C)
|
||||
# ----------------------------------------------------------------
|
||||
|
||||
go: $(SRCDIR_SRCS)
|
||||
go_nocgo: $(SRCDIR_SRCS)
|
||||
$(SWIG) -go $(GOOPT) $(GOSWIGARG) $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH)
|
||||
if $(GO12) || $(GO13) || $(GOGCC); then \
|
||||
if $(GO12) || $(GO13) || $(GO15) || $(GOGCC); then \
|
||||
$(CC) -g -c $(CPPFLAGS) $(CFLAGS) $(SRCDIR_SRCS) $(ISRCS) $(INCLUDES); \
|
||||
else \
|
||||
$(CC) -g -c $(CCSHARED) $(CPPFLAGS) $(CFLAGS) $(SRCDIR_SRCS) $(ISRCS) $(INCLUDES); \
|
||||
$(LDSHARED) $(CFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(LIBS) -o $(LIBPREFIX)$(TARGET)$(SO); \
|
||||
fi
|
||||
$(COMPILETOOL) $(GO) $(GOCOMPILEARG) -I . $(GOSRCS)
|
||||
if ! $(GOGCC) ; then \
|
||||
if $(GOGCC) ; then \
|
||||
$(COMPILETOOL) $(GCCGO) -g -c -I . $(GOSRCS); \
|
||||
else \
|
||||
$(COMPILETOOL) $(GO) $(GOCOMPILEARG) -I . $(GOSRCS); \
|
||||
$(COMPILETOOL) $(GOTOOL) $(GOC) -I $${GOROOT:-`go env GOROOT`}/pkg/$${GOOS:-`go env GOOS`}_$${GOARCH:-`go env GOARCH`} $(GOCSRCS); \
|
||||
rm -f $(GOPACKAGE); \
|
||||
if $(GO13); then \
|
||||
if $(GO13) || $(GO15); then \
|
||||
cp $(GOGCOBJS) $(GOPACKAGE); \
|
||||
$(COMPILETOOL) $(GOPACK) r $(GOPACKAGE) $(GOCSRCS:.c=.$(GOOBJEXT)) $(OBJS) $(IOBJS); \
|
||||
elif $(GO12); then \
|
||||
|
|
@ -1801,12 +1808,54 @@ go: $(SRCDIR_SRCS)
|
|||
fi; \
|
||||
fi
|
||||
if test -f $(SRCDIR)$(RUNME).go; then \
|
||||
$(GO) $(GOCOMPILEARG) $(SRCDIR)$(RUNME).go; \
|
||||
if $(GOGCC) ; then \
|
||||
$(COMPILETOOL) $(GO) -o $(RUNME) $(RUNME).@OBJEXT@ $(GOGCCOBJS) $(OBJS) $(IOBJS); \
|
||||
elif $(GO12) || $(GO13); then \
|
||||
$(COMPILETOOL) $(GCCGO) -g -c $(SRCDIR)$(RUNME).go; \
|
||||
$(COMPILETOOL) $(GCCGO) -o $(RUNME) $(RUNME).@OBJEXT@ $(GOGCCOBJS) $(OBJS) $(IOBJS); \
|
||||
elif $(GO12) || $(GO13) || $(GO15); then \
|
||||
$(GO) $(GOCOMPILEARG) $(SRCDIR)$(RUNME).go; \
|
||||
$(COMPILETOOL) $(GOTOOL) $(GOLD) -linkmode external -extld "$(CC)" -extldflags "$(CFLAGS) $(LDFLAGS)" -o $(RUNME) $(RUNME).$(GOOBJEXT); \
|
||||
else \
|
||||
$(GO) $(GOCOMPILEARG) $(SRCDIR)$(RUNME).go; \
|
||||
$(COMPILETOOL) $(GOTOOL) $(GOLD) -r $${GOROOT:-`go env GOROOT`}/pkg/$${GOOS:-`go env GOOS`}_$${GOARCH:-`go env GOARCH`}:. -o $(RUNME) $(RUNME).$(GOOBJEXT); \
|
||||
fi; \
|
||||
fi
|
||||
|
||||
go: $(SRCDIR_SRCS)
|
||||
$(SWIG) -go -cgo $(GOOPT) $(GOSWIGARG) $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH)
|
||||
@mkdir gopath 2>/dev/null || true
|
||||
@mkdir gopath/src 2>/dev/null || true
|
||||
@mkdir gopath/src/$(INTERFACE:.i=) 2>/dev/null || true
|
||||
rm -f $(GOPATHDIR)/*
|
||||
cp $(ISRCS) $(GOPATHDIR)/
|
||||
if test -f $(IWRAP:.i=.h); then \
|
||||
cp $(IWRAP:.i=.h) $(GOPATHDIR)/; \
|
||||
fi
|
||||
if test -n "$(SRCDIR_SRCS)"; then \
|
||||
cp $(SRCDIR_SRCS) $(GOPATHDIR)/; \
|
||||
fi
|
||||
cp $(GOSRCS) $(GOPATHDIR)/
|
||||
GOPATH=`pwd`/gopath; \
|
||||
export GOPATH; \
|
||||
CGO_CPPFLAGS="$(CPPFLAGS) $(INCLUDES) -I `pwd`"; \
|
||||
export CGO_CPPFLAGS; \
|
||||
CGO_CFLAGS="$(CFLAGS)"; \
|
||||
export CGO_CFLAGS; \
|
||||
CGO_LDFLAGS="$(LDFLAGS) -lm"; \
|
||||
export CGO_LDFLAGS; \
|
||||
(cd $(GOPATHDIR)/ && $(COMPILETOOL) $(GO) build `if $(GOGCC); then echo -compiler=gccgo; fi` -o $(GOPACKAGE))
|
||||
cp $(GOPATHDIR)/$(GOPACKAGE) $(dir $(INTERFACE))/$(GOPACKAGE)
|
||||
if $(GOGCC); then \
|
||||
cp $(dir $(INTERFACE))/$(GOPACKAGE) $(dir $(INTERFACE))/$(GOPACKAGE:.a=.gox); \
|
||||
fi
|
||||
if test -f $(SRCDIR)$(RUNME).go; then \
|
||||
if $(GOGCC) ; then \
|
||||
$(COMPILETOOL) $(GCCGO) -c -g $(SRCDIR)$(RUNME).go; \
|
||||
$(COMPILETOOL) $(GCCGO) -o $(RUNME) $(RUNME).@OBJEXT@ $(dir $(INTERFACE))/$(GOPACKAGE); \
|
||||
elif $(GO12) || $(GO13) || $(GO15); then \
|
||||
$(COMPILETOOL) $(GO) $(GOCOMPILEARG) $(SRCDIR)$(RUNME).go; \
|
||||
$(COMPILETOOL) $(GOTOOL) $(GOLD) -linkmode external -extld "$(CC)" -extldflags "$(CFLAGS) $(LDFLAGS)" -o $(RUNME) $(RUNME).$(GOOBJEXT); \
|
||||
else \
|
||||
$(COMPILETOOL) $(GO) $(GOCOMPILEARG) $(SRCDIR)$(RUNME).go; \
|
||||
$(COMPILETOOL) $(GOTOOL) $(GOLD) -r $${GOROOT:-`go env GOROOT`}/pkg/$${GOOS:-`go env GOOS`}_$${GOARCH:-`go env GOARCH`}:. -o $(RUNME) $(RUNME).$(GOOBJEXT); \
|
||||
fi; \
|
||||
fi
|
||||
|
|
@ -1815,9 +1864,9 @@ go: $(SRCDIR_SRCS)
|
|||
# Build a Go module (C++)
|
||||
# ----------------------------------------------------------------
|
||||
|
||||
go_cpp: $(SRCDIR_SRCS)
|
||||
go_cpp_nocgo: $(SRCDIR_SRCS)
|
||||
$(SWIG) -go -c++ $(GOOPT) $(GOSWIGARG) $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH)
|
||||
if $(GO12) || $(GO13) || $(GOGCC); then \
|
||||
if $(GO12) || $(GO13) || $(GO15) || $(GOGCC); then \
|
||||
if test -n "$(SRCDIR_CXXSRCS)$(SRCDIR_SRCS)"; then \
|
||||
$(CXX) -g -c $(CPPFLAGS) $(CXXFLAGS) $(SRCDIR_CXXSRCS) $(SRCDIR_SRCS) $(INCLUDES); \
|
||||
fi; \
|
||||
|
|
@ -1837,7 +1886,7 @@ go_cpp: $(SRCDIR_SRCS)
|
|||
-o $(addsuffix .$(GOOBJEXT),$(basename $f)) $f; \
|
||||
) \
|
||||
rm -f $(GOPACKAGE); \
|
||||
if $(GO13); then \
|
||||
if $(GO13) || $(GO15); then \
|
||||
cp $(GOGCOBJS) $(GOPACKAGE); \
|
||||
$(COMPILETOOL) $(GOPACK) r $(GOPACKAGE) $(GOCSRCS:.c=.$(GOOBJEXT)) $(OBJS) $(IOBJS); \
|
||||
elif $(GO12); then \
|
||||
|
|
@ -1847,16 +1896,63 @@ go_cpp: $(SRCDIR_SRCS)
|
|||
fi; \
|
||||
else \
|
||||
$(foreach f,$(GOSRCS), \
|
||||
$(COMPILETOOL) $(GO) $(GOCOMPILEARG) -I . -o $(addsuffix .@OBJEXT@,$(basename $f)) $f \
|
||||
$(COMPILETOOL) $(GCCGO) -g -c -I . -o $(addsuffix .@OBJEXT@,$(basename $f)) $f \
|
||||
); \
|
||||
fi
|
||||
if test -f $(SRCDIR)$(RUNME).go; then \
|
||||
$(GO) $(GOCOMPILEARG) $(SRCDIR)$(RUNME).go; \
|
||||
if $(GOGCC) ; then \
|
||||
$(COMPILETOOL) $(GO) -o $(RUNME) $(RUNME).@OBJEXT@ $(GOGCCOBJS) $(OBJS) $(IOBJS) -lstdc++; \
|
||||
elif $(GO12) || $(GO13); then \
|
||||
$(COMPILETOOL) $(GCCGO) -g -c $(SRCDIR)$(RUNME).go; \
|
||||
$(COMPILETOOL) $(GCCGO) -o $(RUNME) $(RUNME).@OBJEXT@ $(GOGCCOBJS) $(OBJS) $(IOBJS) -lstdc++; \
|
||||
elif $(GO12) || $(GO13) || $(GO15); then \
|
||||
$(GO) $(GOCOMPILEARG) $(SRCDIR)$(RUNME).go; \
|
||||
$(COMPILETOOL) $(GOTOOL) $(GOLD) -linkmode external -extld "$(CXX)" -extldflags "$(CXXFLAGS) $(LDFLAGS)" -o $(RUNME) $(RUNME).$(GOOBJEXT); \
|
||||
else \
|
||||
$(GO) $(GOCOMPILEARG) $(SRCDIR)$(RUNME).go; \
|
||||
$(COMPILETOOL) $(GOTOOL) $(GOLD) -r $${GOROOT:-`go env GOROOT`}/pkg/$${GOOS:-`go env GOOS`}_$${GOARCH:-`go env GOARCH`}:. -o $(RUNME) $(RUNME).$(GOOBJEXT); \
|
||||
fi; \
|
||||
fi
|
||||
|
||||
go_cpp: $(SRCDIR_SRCS)
|
||||
$(SWIG) -go -c++ -cgo $(GOOPT) $(GOSWIGARG) $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH)
|
||||
@mkdir gopath 2>/dev/null || true
|
||||
@mkdir gopath/src 2>/dev/null || true
|
||||
@mkdir gopath/src/$(INTERFACE:.i=) 2>/dev/null || true
|
||||
rm -f $(GOPATHDIR)/*
|
||||
cp $(ICXXSRCS) $(GOPATHDIR)/
|
||||
if test -f $(IWRAP:.i=.h); then \
|
||||
cp $(IWRAP:.i=.h) $(GOPATHDIR)/; \
|
||||
fi
|
||||
if test -n "$(SRCDIR_CXXSRCS)"; then \
|
||||
cp $(SRCDIR_CXXSRCS) $(GOPATHDIR)/; \
|
||||
fi
|
||||
if test -n "$(SRCDIR_SRCS)"; then \
|
||||
cp $(SRCDIR_SRCS) $(GOPATHDIR)/; \
|
||||
fi
|
||||
cp $(GOSRCS) $(GOPATHDIR)/
|
||||
GOPATH=`pwd`/gopath; \
|
||||
export GOPATH; \
|
||||
CGO_CPPFLAGS="$(CPPFLAGS) $(INCLUDES) -I `pwd`"; \
|
||||
export CGO_CPPFLAGS; \
|
||||
CGO_CFLAGS="$(CFLAGS)"; \
|
||||
export CGO_CFLAGS; \
|
||||
CGO_CXXFLAGS="$(CXXFLAGS)"; \
|
||||
export CGO_CXXFLAGS; \
|
||||
CGO_LDFLAGS="$(LDFLAGS) -lm"; \
|
||||
export CGO_LDFLAGS; \
|
||||
(cd $(GOPATHDIR) && $(COMPILETOOL) $(GO) build `if $(GOGCC); then echo -compiler=gccgo; fi` -o $(GOPACKAGE))
|
||||
cp $(GOPATHDIR)/$(GOPACKAGE) $(dir $(INTERFACE))/$(GOPACKAGE)
|
||||
if $(GOGCC); then \
|
||||
cp $(dir $(INTERFACE))/$(GOPACKAGE) $(dir $(INTERFACE))/$(GOPACKAGE:.a=.gox); \
|
||||
fi
|
||||
if test -f $(SRCDIR)$(RUNME).go; then \
|
||||
if $(GOGCC) ; then \
|
||||
$(COMPILETOOL) $(GCCGO) -g -c $(SRCDIR)$(RUNME).go; \
|
||||
$(COMPILETOOL) $(GCCGO) -o $(RUNME) $(RUNME).@OBJEXT@ $(dir $(INTERFACE))/$(GOPACKAGE) -lstdc++; \
|
||||
elif $(GO12) || $(GO13) || $(GO15); then \
|
||||
$(COMPILETOOL) $(GO) $(GOCOMPILEARG) $(SRCDIR)$(RUNME).go; \
|
||||
$(COMPILETOOL) $(GOTOOL) $(GOLD) -linkmode external -extld "$(CXX)" -extldflags "$(CXXFLAGS) $(LDFLAGS)" -o $(RUNME) $(RUNME).$(GOOBJEXT); \
|
||||
else \
|
||||
$(COMPILETOOL) $(GO) $(GOCOMPILEARG) $(SRCDIR)$(RUNME).go; \
|
||||
$(COMPILETOOL) $(GOTOOL) $(GOLD) -r $${GOROOT:-`go env GOROOT`}/pkg/$${GOOS:-`go env GOOS`}_$${GOARCH:-`go env GOARCH`}:. -o $(RUNME) $(RUNME).$(GOOBJEXT); \
|
||||
fi; \
|
||||
fi
|
||||
|
|
@ -1880,7 +1976,8 @@ go_version:
|
|||
# -----------------------------------------------------------------
|
||||
|
||||
go_clean:
|
||||
rm -f *_wrap* *_gc* .~* $(RUNME) $(GOSRCS)
|
||||
rm -f *_wrap* *_gc* *.gox .~* $(RUNME) $(GOSRCS)
|
||||
rm -rf gopath
|
||||
rm -f core @EXTRA_CLEAN@
|
||||
rm -f *.@OBJEXT@ *.[568] *.a *@SO@
|
||||
|
||||
|
|
|
|||
|
|
@ -5,13 +5,15 @@
|
|||
LANGUAGE = go
|
||||
GO = @GO@
|
||||
GOGCC = @GOGCC@
|
||||
GCCGO = @GCCGO@
|
||||
GO1 = @GO1@
|
||||
GO12 = @GO12@
|
||||
GO13 = @GO13@
|
||||
GO15 = @GO15@
|
||||
GOC = @GOC@
|
||||
SCRIPTSUFFIX = _runme.go
|
||||
|
||||
GOCOMPILEARG = `if $(GOGCC) ; then echo -c -g; elif $(GO1) ; then echo tool $(GOC:c=g) ; fi`
|
||||
GOCOMPILEARG = `if $(GO1) ; then echo tool $(GOC:c=g) ; fi`
|
||||
GOLD = $(GOC:c=l)
|
||||
GOTOOL = `if $(GO1) ; then echo go tool; fi`
|
||||
GOPACK = `if $(GO1) ; then echo go tool pack; else echo gopack; fi`
|
||||
|
|
@ -20,9 +22,10 @@ GOOBJEXT = $(GOC:c=)
|
|||
|
||||
SO = @SO@
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
top_builddir = @top_builddir@
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
top_builddir = @top_builddir@
|
||||
abs_top_srcdir = @abs_top_srcdir@
|
||||
|
||||
CPP_TEST_CASES = \
|
||||
go_inout \
|
||||
|
|
@ -33,6 +36,8 @@ MULTI_CPP_TEST_CASES = \
|
|||
|
||||
include $(srcdir)/../common.mk
|
||||
|
||||
INCLUDES = -I$(abs_top_srcdir)/$(EXAMPLES)/$(TEST_SUITE)
|
||||
|
||||
.SUFFIXES: .cpptest .ctest .multicpptest
|
||||
|
||||
# Rules for the different types of tests
|
||||
|
|
@ -40,17 +45,37 @@ include $(srcdir)/../common.mk
|
|||
$(setup)
|
||||
+$(swig_and_compile_cpp)
|
||||
$(run_testcase_cpp)
|
||||
if ! $(GO15); then \
|
||||
$(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR="$(SRCDIR)" CXXSRCS="$(CXXSRCS)" \
|
||||
SWIG_LIB="$(SWIG_LIB)" SWIG="$(SWIG)" \
|
||||
INCLUDES="$(INCLUDES)" SWIGOPT="$(SWIGOPT)" NOLINK=true \
|
||||
TARGET="$(TARGETPREFIX)$*$(TARGETSUFFIX)" INTERFACEDIR="$(INTERFACEDIR)" INTERFACE="$*.i" \
|
||||
$(LANGUAGE)$(VARIANT)_cpp_nocgo; \
|
||||
$(run_testcase_cpp); \
|
||||
fi
|
||||
|
||||
%.ctest:
|
||||
$(setup)
|
||||
+$(swig_and_compile_c)
|
||||
$(run_testcase)
|
||||
if ! $(GO15); then \
|
||||
$(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR="$(SRCDIR)" CSRCS="$(CSRCS)" \
|
||||
SWIG_LIB="$(SWIG_LIB)" SWIG="$(SWIG)" \
|
||||
INCLUDES="$(INCLUDES)" SWIGOPT="$(SWIGOPT)" NOLINK=true \
|
||||
TARGET="$(TARGETPREFIX)$*$(TARGETSUFFIX)" INTERFACEDIR="$(INTERFACEDIR)" INTERFACE="$*.i" \
|
||||
$(LANGUAGE)$(VARIANT)_nocgo; \
|
||||
$(run_testcase); \
|
||||
fi
|
||||
|
||||
%.multicpptest:
|
||||
$(setup)
|
||||
+$(swig_and_compile_multi_cpp)
|
||||
$(run_multi_testcase)
|
||||
|
||||
li_windows.cpptest:
|
||||
# Does not work because go build won't build li_windows.go,
|
||||
# because file names with "windows" are only built on Windows.
|
||||
|
||||
multi_import.multicpptest:
|
||||
$(setup)
|
||||
for f in multi_import_b multi_import_a; do \
|
||||
|
|
@ -65,6 +90,7 @@ multi_import.multicpptest:
|
|||
go_subdir_import.multicpptest:
|
||||
$(setup)
|
||||
mkdir -p testdir/go_subdir_import/
|
||||
mkdir -p gopath/src/testdir/go_subdir_import/
|
||||
$(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR="$(SRCDIR)" CXXSRCS="$(CXXSRCS)" \
|
||||
SWIG_LIB="$(SWIG_LIB)" SWIG="$(SWIG)" LIBS='$(LIBS)' \
|
||||
INTERFACEPATH="$(SRCDIR)$(INTERFACEDIR)go_subdir_import_b.i" \
|
||||
|
|
@ -80,19 +106,24 @@ go_subdir_import.multicpptest:
|
|||
$(LANGUAGE)$(VARIANT)_cpp; \
|
||||
done
|
||||
if $(GOGCC); then \
|
||||
cp testdir/go_subdir_import/*.@OBJEXT@ .; \
|
||||
cp gopath/src/testdir/go_subdir_import/go_subdir_import_b/go_subdir_import_b.a gopath/src/testdir/go_subdir_import/go_subdir_import_b.gox; \
|
||||
cp gopath/src/testdir/go_subdir_import/go_subdir_import_b/go_subdir_import_b.a .; \
|
||||
cp gopath/src/testdir/go_subdir_import/go_subdir_import_c/go_subdir_import_c.a gopath/src/testdir/go_subdir_import/go_subdir_import_c.gox; \
|
||||
cp gopath/src/testdir/go_subdir_import/go_subdir_import_c/go_subdir_import_c.a testdir/go_subdir_import/; \
|
||||
fi
|
||||
$(run_multi_testcase)
|
||||
|
||||
# Runs the testcase.
|
||||
run_testcase = \
|
||||
if test -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); then \
|
||||
$(COMPILETOOL) $(GO) $(GOCOMPILEARG) -I . $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) && \
|
||||
if $(GOGCC) ; then \
|
||||
$(COMPILETOOL) $(GO) -o $*_runme $(SCRIPTPREFIX)$*_runme.@OBJEXT@ $*.@OBJEXT@ $*_wrap.@OBJEXT@; \
|
||||
elif $(GO12) || $(GO13); then \
|
||||
$(COMPILETOOL) $(GCCGO) -c -g -I . $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) && \
|
||||
$(COMPILETOOL) $(GCCGO) -o $*_runme $(SCRIPTPREFIX)$*_runme.@OBJEXT@ $*.a; \
|
||||
elif $(GO12) || $(GO13) || $(GO15); then \
|
||||
$(COMPILETOOL) $(GO) $(GOCOMPILEARG) -I . $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) && \
|
||||
$(COMPILETOOL) $(GOTOOL) $(GOLD) -linkmode external -extld $(CC) -extldflags "$(CFLAGS)" -o $*_runme $(SCRIPTPREFIX)$*_runme.$(GOOBJEXT); \
|
||||
else \
|
||||
$(COMPILETOOL) $(GO) $(GOCOMPILEARG) -I . $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) && \
|
||||
$(COMPILETOOL) $(GOTOOL) $(GOLD) -L . -r $${GOROOT:-`go env GOROOT`}/pkg/$${GOOS:-`go env GOOS`}_$${GOARCH:-`go env GOARCH`}:. -o $*_runme $(SCRIPTPREFIX)$*_runme.$(GOOBJEXT); \
|
||||
fi && \
|
||||
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) ./$*_runme; \
|
||||
|
|
@ -100,12 +131,14 @@ run_testcase = \
|
|||
|
||||
run_testcase_cpp = \
|
||||
if test -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); then \
|
||||
$(COMPILETOOL) $(GO) $(GOCOMPILEARG) -I . $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) && \
|
||||
if $(GOGCC) ; then \
|
||||
$(COMPILETOOL) $(GO) -o $*_runme $(SCRIPTPREFIX)$*_runme.@OBJEXT@ $*.@OBJEXT@ $*_wrap.@OBJEXT@ -lstdc++; \
|
||||
elif $(GO12) || $(GO13); then \
|
||||
$(COMPILETOOL) $(GCCGO) -c -g -I . $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) && \
|
||||
$(COMPILETOOL) $(GCCGO) -o $*_runme $(SCRIPTPREFIX)$*_runme.@OBJEXT@ $*.a -lstdc++; \
|
||||
elif $(GO12) || $(GO13) || $(GO15); then \
|
||||
$(COMPILETOOL) $(GO) $(GOCOMPILEARG) -I . $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) && \
|
||||
$(COMPILETOOL) $(GOTOOL) $(GOLD) -linkmode external -extld $(CXX) -extldflags "$(CXXFLAGS)" -o $*_runme $(SCRIPTPREFIX)$*_runme.$(GOOBJEXT); \
|
||||
else \
|
||||
$(COMPILETOOL) $(GO) $(GOCOMPILEARG) -I . $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) && \
|
||||
$(COMPILETOOL) $(GOTOOL) $(GOLD) -L . -r $${GOROOT:-`go env GOROOT`}/pkg/$${GOOS:-`go env GOOS`}_$${GOARCH:-`go env GOARCH`}:. -o $*_runme $(SCRIPTPREFIX)$*_runme.$(GOOBJEXT); \
|
||||
fi && \
|
||||
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) ./$*_runme; \
|
||||
|
|
@ -113,29 +146,38 @@ run_testcase_cpp = \
|
|||
|
||||
run_multi_testcase = \
|
||||
if test -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); then \
|
||||
$(COMPILETOOL) $(GO) $(GOCOMPILEARG) -I . $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) && \
|
||||
if $(GOGCC) ; then \
|
||||
$(COMPILETOOL) $(GCCGO) -c -g -I . -I gopath/src $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) && \
|
||||
files=`cat $(top_srcdir)/$(EXAMPLES)/$(TEST_SUITE)/$*.list`; \
|
||||
$(COMPILETOOL) $(GO) -o $*_runme $(SCRIPTPREFIX)$*_runme.@OBJEXT@ `for f in $$files; do echo $$f.@OBJEXT@ $${f}_wrap.@OBJEXT@; done` -lstdc++; \
|
||||
elif $(GO12) || $(GO13); then \
|
||||
$(COMPILETOOL) $(GCCGO) -o $*_runme $(SCRIPTPREFIX)$*_runme.@OBJEXT@ `for f in $$files; do echo $$f.a; done` -lstdc++; \
|
||||
elif $(GO12) || $(GO13) || $(GO15); then \
|
||||
$(COMPILETOOL) $(GO) $(GOCOMPILEARG) -I . $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) && \
|
||||
$(COMPILETOOL) $(GOTOOL) $(GOLD) -L . -linkmode external -extld $(CXX) -extldflags "$(CXXFLAGS)" -o $*_runme $(SCRIPTPREFIX)$*_runme.$(GOOBJEXT); \
|
||||
else \
|
||||
$(COMPILETOOL) $(GO) $(GOCOMPILEARG) -I . $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) && \
|
||||
$(COMPILETOOL) $(GOTOOL) $(GOLD) -L . -r $${GOROOT:-`go env GOROOT`}/pkg/$${GOOS:-`go env GOOS`}_$${GOARCH:-`go env GOARCH`}:. -o $*_runme $(SCRIPTPREFIX)$*_runme.$(GOOBJEXT); \
|
||||
fi && \
|
||||
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) ./$*_runme; \
|
||||
fi
|
||||
|
||||
%.clean:
|
||||
@rm -f $*.go $*_gc.c $*_wrap.* $*_runme
|
||||
@rm -rf $*.go $*_gc.c $*_wrap.* $*_runme $*.gox $*.a
|
||||
|
||||
clean:
|
||||
$(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR="$(SRCDIR)" go_clean
|
||||
rm -f mod_a.go mod_b.go imports_a.go imports_b.go
|
||||
rm -f clientdata_prop_a.go clientdata_prop_b.go
|
||||
rm -f multi_import_a.go multi_import_b.go
|
||||
rm -rf go_subdir_import_a.go testdir
|
||||
rm -f packageoption_a.go packageoption_b.go packageoption_c.go
|
||||
rm -f import_stl_a.go import_stl_b.go
|
||||
rm -f mod_a.go mod_a.gox mod_b.go mod_b.gox
|
||||
rm -f imports_a.go imports_a.gox imports_b.go imports_b.gox
|
||||
rm -f clientdata_prop_a.go clientdata_prop_a.gox
|
||||
rm -f clientdata_prop_b.go clientdata_prop_b.gox
|
||||
rm -f multi_import_a.go multi_import_a.gox
|
||||
rm -f multi_import_b.go multi_import_b.gox
|
||||
rm -rf go_subdir_import_a.go go_subdir_import_a.gox testdir
|
||||
rm -f packageoption_a.go packageoption_a.gox
|
||||
rm -f packageoption_b.go packageoption_b.gox
|
||||
rm -f packageoption_c.go packageoption_c.gox
|
||||
rm -f import_stl_a.go import_stl_a.gox
|
||||
rm -f import_stl_b.go import_stl_b.gox
|
||||
rm -rf gopath
|
||||
|
||||
cvsignore:
|
||||
@echo '*_gc.c *_wrap.* *.so *.dll *.exp *.lib'
|
||||
|
|
|
|||
|
|
@ -20,12 +20,12 @@
|
|||
%{
|
||||
class ObjC {
|
||||
public:
|
||||
int getInt() const;
|
||||
virtual int getInt() const;
|
||||
};
|
||||
|
||||
class ObjB {
|
||||
public:
|
||||
int getInt() const;
|
||||
virtual int getInt() const;
|
||||
};
|
||||
%}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
%inline %{
|
||||
class ObjB {
|
||||
public:
|
||||
int getInt() const {
|
||||
virtual int getInt() const {
|
||||
return 27;
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
%inline %{
|
||||
class ObjC {
|
||||
public:
|
||||
int getInt() const {
|
||||
virtual int getInt() const {
|
||||
return 18;
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue