Updated Guile modules.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@815 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
011819c2d1
commit
277186567a
8 changed files with 61 additions and 35 deletions
|
|
@ -9,10 +9,17 @@ INCLUDE = -I../../Include
|
|||
|
||||
all:: static
|
||||
|
||||
static::
|
||||
$(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \
|
||||
dynamic::
|
||||
$(MAKE) -f $(TOP)/Makefile TOP='$(TOP)' \
|
||||
SRCS='$(SRCS)' SWIG='$(SWIG)' \
|
||||
INCLUDE='$(INCLUDE)' LIBS='$(LIBS)' SWIGOPT='$(SWIGOPT)' \
|
||||
TARGET='gifguile' INTERFACE='$(INTERFACE)' guile_static
|
||||
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' guile
|
||||
|
||||
static::
|
||||
$(MAKE) -f $(TOP)/Makefile TOP='$(TOP)' \
|
||||
SRCS='$(SRCS)' SWIG='$(SWIG)' \
|
||||
INCLUDE='$(INCLUDE)' LIBS='$(LIBS)' SWIGOPT='$(SWIGOPT)' \
|
||||
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' guile_static
|
||||
|
||||
clean::
|
||||
rm -f *_wrap* *.o *~ *.so gifguile .~* core *.gif
|
||||
|
|
|
|||
|
|
@ -1,5 +1,8 @@
|
|||
;;; Plot a 3D function
|
||||
|
||||
;; Use the wrapped GIFPlot library
|
||||
(use-modules (gifplot))
|
||||
|
||||
;; Here is the function to plot
|
||||
(define (func x y)
|
||||
(* 5
|
||||
|
|
|
|||
|
|
@ -9,10 +9,17 @@ INCLUDE = -I../../Include
|
|||
|
||||
all:: static
|
||||
|
||||
static::
|
||||
$(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \
|
||||
dynamic::
|
||||
$(MAKE) -f $(TOP)/Makefile TOP='$(TOP)' \
|
||||
SRCS='$(SRCS)' SWIG='$(SWIG)' \
|
||||
INCLUDE='$(INCLUDE)' LIBS='$(LIBS)' SWIGOPT='$(SWIGOPT)' \
|
||||
TARGET='gifguile' INTERFACE='$(INTERFACE)' guile_static
|
||||
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' guile
|
||||
|
||||
static::
|
||||
$(MAKE) -f $(TOP)/Makefile TOP='$(TOP)' \
|
||||
SRCS='$(SRCS)' SWIG='$(SWIG)' \
|
||||
INCLUDE='$(INCLUDE)' LIBS='$(LIBS)' SWIGOPT='$(SWIGOPT)' \
|
||||
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' guile_static
|
||||
|
||||
clean::
|
||||
rm -f *_wrap* *.o *~ *.so gifguile .~* core *.gif
|
||||
|
|
|
|||
|
|
@ -1,3 +1,11 @@
|
|||
This is a very minimalistic example in which just a few functions
|
||||
and constants from library are wrapped and used to draw some simple
|
||||
shapes. Run `gifguile -s runme.scm'.
|
||||
shapes.
|
||||
|
||||
`make' will build a version of Guile which defines an additional
|
||||
module (simple). Run `./simple-guile -s runme.scm' to test it.
|
||||
|
||||
`make dynamic' will build a dynamically loadable module, which can be
|
||||
loaded from any Guile interpreter. Run `guile -s runme.scm' to test
|
||||
it. The `use-modules' call in `runme.scm' dynamically loads the
|
||||
module.
|
||||
|
|
|
|||
|
|
@ -1,4 +1,8 @@
|
|||
;; Draw some simple shapes
|
||||
;;; Draw some simple shapes
|
||||
|
||||
;; Use the wrapped GIFPlot library
|
||||
(use-modules (simple))
|
||||
|
||||
(display "Drawing some basic shapes\n")
|
||||
|
||||
(define cmap (new-ColorMap))
|
||||
|
|
|
|||
|
|
@ -244,39 +244,23 @@ python_static_cpp: $(SRCS)
|
|||
GUILE_INCLUDE = @GUILEINCLUDE@
|
||||
GUILE_LIB = @GUILELIB@
|
||||
|
||||
|
||||
# ----------------------------------------------------------------
|
||||
# Build a C dynamically loadable module
|
||||
# ----------------------------------------------------------------
|
||||
|
||||
guile-hobbit: $(SRCS)
|
||||
$(SWIG) -guile -Linkage hobbit $(SWIGOPT) $(INTERFACE)
|
||||
for f in $^ ; do $(libtool_comp) $(CC) -c -O2 $(INCLUDE) $$f ; done
|
||||
$(libtool_link) $(CC) -g -O2 -o lib$^.la -rpath `pwd` $^
|
||||
|
||||
# ----------------------------------------------------------------
|
||||
# Build a C dynamically loadable module
|
||||
# ----------------------------------------------------------------
|
||||
|
||||
guile: $(SRCS)
|
||||
$(SWIG) -guile $(SWIGOPT) $(INTERFACE)
|
||||
for f in $(ISRCS) ; do $(libtool_comp) \
|
||||
$(CC) -c $(INCLUDE) $(GUILE_INCLUDE) $(ISRCS) ; done
|
||||
$(libtool_link) $(LDSHARED) -o lib$(TARGET)$(SO) \
|
||||
$(OBJS) $(IOBJS) $(LIBS)
|
||||
$(SWIG) -guile -Linkage ltdlmod $(SWIGOPT) $(INTERFACE)
|
||||
$(CC) -c $(CCSHARED) $(CFLAGS) $(INCLUDE) $(GUILE_INCLUDE) $(ISRCS) $(SRCS)
|
||||
$(LDSHARED) $(OBJS) $(IOBJS) $(LIBS) -o lib$(TARGET)$(SO)
|
||||
|
||||
# -----------------------------------------------------------------
|
||||
# Build a C++ dynamically loadable module
|
||||
# -----------------------------------------------------------------
|
||||
|
||||
guile_cpp: $(SRCS)
|
||||
$(SWIG) -c++ -guile $(SWIGOPT) $(INTERFACE)
|
||||
$(libtool) compile \
|
||||
$(CXX) -c $(CCSHARED) $(CFLAGS) $(ISRCS) $(SRCS) $(CXXSRCS) \
|
||||
$(INCLUDE) $(GUILE_INCLUDE)
|
||||
$(libtool) link \
|
||||
$(CXXSHARED) $(OBJS) $(IOBJS) $(LIBS) $(CPP_DLLIBS) \
|
||||
-o lib$(TARGET)$(SO)
|
||||
$(SWIG) -c++ -guile -Linkage ltdlmod $(SWIGOPT) $(INTERFACE)
|
||||
$(CXX) -c $(CCSHARED) $(CFLAGS) $(INCLUDE) $(GUILE_INCLUDE) $(ISRCS) $(SRCS) $(CXXSRCS)
|
||||
$(LDSHARED) $(OBJS) $(IOBJS) $(LIBS) -o lib$(TARGET)$(SO)
|
||||
|
||||
# -----------------------------------------------------------------
|
||||
# Build statically linked Guile interpreter
|
||||
|
|
@ -285,14 +269,16 @@ guile_cpp: $(SRCS)
|
|||
GUILE_LIBOPTS = @GUILELINK@ @LIBS@ $(SYSLIBS)
|
||||
|
||||
guile_static: $(SRCS)
|
||||
$(SWIG) -guile -lguilemain.i $(SWIGOPT) $(INTERFACE)
|
||||
$(CC) $(CFLAGS) @LINKFORSHARED@ $(ISRCS) $(SRCS) $(INCLUDE) \
|
||||
$(GUILE_INCLUDE) $(LIBS) -L$(GUILE_LIB) $(GUILE_LIBOPTS) -o $(TARGET)
|
||||
$(SWIG) -guile -lguilemain.i -Linkage ltdlmod $(SWIGOPT) $(INTERFACE)
|
||||
$(CC) $(CFLAGS) $(ISRCS) $(SRCS) $(INCLUDE) \
|
||||
-DSWIGINIT="scm_init_$(TARGET)_module();" \
|
||||
$(GUILE_INCLUDE) $(LIBS) -L$(GUILE_LIB) $(GUILE_LIBOPTS) -o $(TARGET)-guile
|
||||
|
||||
guile_static_cpp: $(SRCS)
|
||||
$(SWIG) -c++ -guile -lguilemain.i $(SWIGOPT) $(INTERFACE)
|
||||
$(SWIG) -c++ -guile -lguilemain.i -Linkage ltdlmod $(SWIGOPT) $(INTERFACE)
|
||||
$(CXX) $(CFLAGS) $(ISRCS) $(SRCS) $(CXXSRCS) $(INCLUDE) \
|
||||
$(GUILE_INCLUDE) $(LIBS) -L$(GUILE_LIB) $(GUILE_LIBOPTS) -o $(TARGET)
|
||||
-DSWIGINIT="scm_init_$(TARGET)_module();" \
|
||||
$(GUILE_INCLUDE) $(LIBS) -L$(GUILE_LIB) $(GUILE_LIBOPTS) -o $(TARGET)-guile
|
||||
|
||||
|
||||
##################################################################
|
||||
|
|
|
|||
|
|
@ -2,3 +2,10 @@ This directory contains examples for Guile.
|
|||
|
||||
simple - The simple example from the user manual.
|
||||
matrix - A very simple Matrix example.
|
||||
|
||||
Note that the examples in this directory build a special version of
|
||||
Guile which includes the wrapped functions in the top-level module.
|
||||
|
||||
If you want to put the wrapped functions into an own module,
|
||||
statically or dynamically linked, see the Examples/GIFPlot/Guile
|
||||
directory.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue