Added support for the D programming languge.

It is still a bit rough around some edges, particularly with regard to multi-threading and operator overloading, and there are some documentation bits missing, but it should be fine for basic use.

The test-suite should build and run fine with the current versions of DMD, LDC and Tango (at least) on Linux x86_64 and Mac OS X 10.6.

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12299 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
David Nadlinger 2010-11-18 00:24:02 +00:00
commit 03aefbc6e9
176 changed files with 16449 additions and 29 deletions

View file

@ -69,7 +69,7 @@ IOBJS = $(IWRAP:.i=.@OBJEXT@)
CPP_DLLIBS = #-L/usr/local/lib/gcc-lib/sparc-sun-solaris2.5.1/2.7.2 \
-L/usr/local/lib -lg++ -lstdc++ -lgcc
# Solaris workshop 5.0
# Solaris workshop 5.0
# CPP_DLLIBS = -L/opt/SUNWspro/lib -lCrun
# Symbols used for using shared libraries
@ -159,7 +159,7 @@ tcl_cpp: $(SRCS)
# -----------------------------------------------------------------
tcl_clean:
rm -f *_wrap* *~ .~* mytclsh@EXEEXT@
rm -f *_wrap* *~ .~* mytclsh@EXEEXT@
rm -f core @EXTRA_CLEAN@
rm -f *.@OBJEXT@ *@SO@
@ -296,9 +296,9 @@ python_static_cpp: $(SRCS)
$(CXX) $(CFLAGS) $(ICXXSRCS) $(SRCS) $(CXXSRCS) $(INCLUDES) \
$(PYTHON_INCLUDE) $(LIBS) -L$(PYTHON_LIB) $(PYTHON_LIBOPTS) -o $(TARGET)
# -----------------------------------------------------------------
# -----------------------------------------------------------------
# Running a Python example
# -----------------------------------------------------------------
# -----------------------------------------------------------------
ifeq (,$(PY3))
PYSCRIPT = runme.py
@ -313,7 +313,7 @@ python_run: $(PYSCRIPT)
runme3.py: runme.py
cp $< $@
$(PY2TO3) -w $@ >/dev/null 2>&1
$(PY2TO3) -w $@ >/dev/null 2>&1
# -----------------------------------------------------------------
# Cleaning the python examples
@ -332,7 +332,7 @@ python_clean:
# Make sure these locate your Octave installation
OCTAVE_INCLUDE= $(DEFS) @OCTAVEEXT@
OCTAVE_LIB =
OCTAVE_LIB =
# Extra Octave specific dynamic linking options
OCTAVE_DLNK = @OCTAVEDYNAMICLINKING@
@ -548,14 +548,14 @@ mzscheme: $(SRCS)
mzscheme_cpp: $(SRCS)
$(SWIG) -mzscheme -c++ $(SWIGOPT) $(INTERFACEPATH)
$(COMPILETOOL) $(MZC) `echo $(INCLUDES) | sed 's/-I/++ccf -I/g'` --cc $(ICXXSRCS) $(SRCS) $(CXXSRCS)
$(CXXSHARED) $(CFLAGS) -o $(LIBPREFIX)$(TARGET)$(MZSCHEME_SO) $(OBJS) $(IOBJS) $(MZDYNOBJ) $(CPP_DLLIBS)
$(CXXSHARED) $(CFLAGS) -o $(LIBPREFIX)$(TARGET)$(MZSCHEME_SO) $(OBJS) $(IOBJS) $(MZDYNOBJ) $(CPP_DLLIBS)
# -----------------------------------------------------------------
# Cleaning the mzscheme examples
# -----------------------------------------------------------------
mzscheme_clean:
rm -f *_wrap* *~ .~*
rm -f *_wrap* *~ .~*
rm -f core @EXTRA_CLEAN@
rm -f *.@OBJEXT@ *@SO@
@ -643,7 +643,7 @@ ocaml_static_cpp: $(SRCS)
$(INTERFACE:%.i=%.cmo) \
$(PROGFILE:%.ml=%.cmo) \
$(INTERFACE:%.i=%_wrap.@OBJEXT@) $(OBJS) \
-cclib "$(LIBS)" -cc '$(CXX)'
-cclib "$(LIBS)" -cc '$(CXX)'
ocaml_static_cpp_toplevel: $(SRCS)
$(OCAMLCORE)
@ -661,7 +661,7 @@ ocaml_static_cpp_toplevel: $(SRCS)
-g -ccopt -g -cclib -g -custom -o $(TARGET)_top \
$(INTERFACE:%.i=%.cmo) \
$(INTERFACE:%.i=%_wrap.@OBJEXT@) $(OBJS) \
-cclib "$(LIBS)" -cc '$(CXX)'
-cclib "$(LIBS)" -cc '$(CXX)'
ocaml_dynamic_cpp: $(SRCS)
$(OCAMLCORE)
@ -844,7 +844,7 @@ pike_cpp_static: $(SRCS)
# -----------------------------------------------------------------
pike_clean:
rm -f *_wrap* *~ .~* mypike@EXEEXT@
rm -f *_wrap* *~ .~* mypike@EXEEXT@
rm -f core @EXTRA_CLEAN@
rm -f *.@OBJEXT@ *@SO@
@ -861,7 +861,7 @@ CHICKEN_CFLAGS = @CHICKENOPTS@
CHICKENOPTS = -quiet
CHICKEN_MAIN =
# SWIG produces $(ISRCS) (the C wrapper file)
# SWIG produces $(ISRCS) (the C wrapper file)
# and $(CHICKEN_GENERATED_SCHEME) (the Scheme wrapper file):
CHICKEN_GENERATED_SCHEME = $(INTERFACE:.i=.scm)
CHICKEN_COMPILED_SCHEME = $(INTERFACE:.i=_chicken.c)
@ -1053,12 +1053,12 @@ lua_clean:
allegrocl: $(SRCS)
$(SWIG) -allegrocl -cwrap $(SWIGOPT) $(INTERFACEPATH)
$(CC) -c $(CCSHARED) $(CFLAGS) $(ISRCS) $(INCLUDES) $(SRCS)
$(CC) -c $(CCSHARED) $(CFLAGS) $(ISRCS) $(INCLUDES) $(SRCS)
$(LDSHARED) $(CFLAGS) $(OBJS) $(IOBJS) $(LIBS) -o $(LIBPREFIX)$(TARGET)$(SO)
allegrocl_cpp: $(SRCS)
$(SWIG) -c++ -allegrocl $(SWIGOPT) $(INTERFACEPATH)
$(CXX) -c $(CCSHARED) $(CFLAGS) $(ICXXSRCS) $(SRCS) $(CXXSRCS) $(INCLUDES)
$(CXX) -c $(CCSHARED) $(CFLAGS) $(ICXXSRCS) $(SRCS) $(CXXSRCS) $(INCLUDES)
$(CXXSHARED) $(CFLAGS) $(OBJS) $(IOBJS) $(LIBS) $(CPP_DLLIBS) -o $(LIBPREFIX)$(TARGET)$(SO)
allegrocl_clean:
@ -1087,12 +1087,12 @@ clisp_clean:
cffi: $(SRCS)
$(SWIG) -cffi $(SWIGOPT) $(INTERFACEPATH)
# $(CC) -c $(CCSHARED) $(CFLAGS) $(ISRCS) $(INCLUDES) $(SRCS)
# $(CC) -c $(CCSHARED) $(CFLAGS) $(ISRCS) $(INCLUDES) $(SRCS)
# $(LDSHARED) $(CFLAGS) $(OBJS) $(IOBJS) $(LIBS) -o $(LIBPREFIX)$(TARGET)$(SO)
cffi_cpp: $(SRCS)
$(SWIG) -c++ -cffi $(SWIGOPT) $(INTERFACEPATH)
$(CXX) -c $(CCSHARED) $(CFLAGS) $(ICXXSRCS) $(SRCS) $(CXXSRCS) $(INCLUDES)
$(CXX) -c $(CCSHARED) $(CFLAGS) $(ICXXSRCS) $(SRCS) $(CXXSRCS) $(INCLUDES)
$(CXXSHARED) $(CFLAGS) $(OBJS) $(IOBJS) $(LIBS) $(CPP_DLLIBS) -o $(LIBPREFIX)$(TARGET)$(SO)
cffi_clean:
@ -1106,12 +1106,12 @@ cffi_clean:
uffi: $(SRCS)
$(SWIG) -uffi $(SWIGOPT) $(INTERFACEPATH)
# $(CC) -c $(CCSHARED) $(CFLAGS) $(ISRCS) $(INCLUDES) $(SRCS)
# $(CC) -c $(CCSHARED) $(CFLAGS) $(ISRCS) $(INCLUDES) $(SRCS)
# $(LDSHARED) $(CFLAGS) $(OBJS) $(IOBJS) $(LIBS) -o $(LIBPREFIX)$(TARGET)$(SO)
uffi_cpp: $(SRCS)
$(SWIG) -c++ -uffi $(SWIGOPT) $(INTERFACEPATH)
# $(CXX) -c $(CCSHARED) $(CFLAGS) $(ICXXSRCS) $(SRCS) $(CXXSRCS) $(INCLUDES)
# $(CXX) -c $(CCSHARED) $(CFLAGS) $(ICXXSRCS) $(SRCS) $(CXXSRCS) $(INCLUDES)
# $(CXXSHARED) $(CFLAGS) $(OBJS) $(IOBJS) $(LIBS) $(CPP_DLLIBS) -o $(LIBPREFIX)$(TARGET)$(SO)
uffi_clean:
@ -1212,3 +1212,56 @@ go_clean:
rm -f *_wrap* *_gc* .~* runme
rm -f core @EXTRA_CLEAN@
rm -f *.@OBJEXT@ *.[568] *.a *@SO@
##################################################################
##### D ######
##################################################################
DLIBPREFIX = @DLIBPREFIX@
ifeq (2,$(D_VERSION))
SWIGD = $(SWIG) -d -d2
DCOMPILER = @D2COMPILER@
else
SWIGD = $(SWIG) -d
DCOMPILER = @D1COMPILER@
endif
ifeq (dmd,$(DCOMPILER))
# DMD is 32bit only by now
CFLAGS += -m32
endif
# ----------------------------------------------------------------
# Build a dynamically loadable D wrapper for a C module
# ----------------------------------------------------------------
d: $(SRCS)
$(SWIGD) $(SWIGOPT) $(INTERFACEPATH)
$(CC) -c $(CCSHARED) $(CFLAGS) $(EXTRA_CFLAGS) $(SRCS) $(ISRCS) $(INCLUDES)
$(LDSHARED) $(CFLAGS) $(EXTRA_LDFLAGS) $(OBJS) $(IOBJS) $(LIBS) -o $(DLIBPREFIX)$(TARGET)$(SO)
# ----------------------------------------------------------------
# Build a dynamically loadable D wrapper for a C++ module
# ----------------------------------------------------------------
d_cpp: $(SRCS)
$(SWIGD) -c++ $(SWIGOPT) $(INTERFACEPATH)
$(CXX) -c $(CCSHARED) $(CFLAGS) $(EXTRA_CFLAGS) $(SRCS) $(CXXSRCS) $(ICXXSRCS) $(INCLUDES)
$(CXXSHARED) $(CFLAGS) $(EXTRA_LDFLAGS) $(OBJS) $(IOBJS) $(LIBS) $(CPP_DLLIBS) -o $(DLIBPREFIX)$(TARGET)$(SO)
# ----------------------------------------------------------------
# Compile D files
# ----------------------------------------------------------------
d_compile: $(SRCS)
$(COMPILETOOL) $(DCOMPILER) $(DFLAGS) $(DSRCS)
# -----------------------------------------------------------------
# Clean the D examples
# -----------------------------------------------------------------
d_clean:
rm -f *_wrap* *~ .~* runme runme.exe `find . -name \*.d | grep -v runme.d`
rm -f core @EXTRA_CLEAN@
rm -f *.@OBJEXT@ *@SO@