import and import_template examples that used the prebuilt runtime library generate their own runtime library DLL/so and use that instead now

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@6023 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2004-07-10 16:37:37 +00:00
commit d1f74a864f
22 changed files with 176 additions and 324 deletions

View file

@ -2,10 +2,12 @@ bar.py
base.py
foo.py
spam.py
runtime.py
bar.pyc
base.pyc
foo.pyc
spam.pyc
runtime.pyc
*_wrap.c
*_wrap.cxx
*.dll

View file

@ -1,21 +1,23 @@
TOP = ../..
SWIG = $(TOP)/../swig
SWIGOPT = -noruntime
RUNTIMEDIR = $(TOP)/../Runtime/.libs
LIBS = -L. -l_runtime
all::
$(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='-runtime' \
LIBPREFIX='lib' TARGET='runtime' INTERFACE='runtime.i' python_cpp
$(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
RUNTIMEDIR='$(RUNTIMEDIR)' TARGET='base' INTERFACE='base.i' python_multi_cpp
LIBS='$(LIBS)' TARGET='base' INTERFACE='base.i' python_cpp
$(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
RUNTIMEDIR='$(RUNTIMEDIR)' TARGET='foo' INTERFACE='foo.i' python_multi_cpp
LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp
$(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
RUNTIMEDIR='$(RUNTIMEDIR)' TARGET='bar' INTERFACE='bar.i' python_multi_cpp
LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' python_cpp
$(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
RUNTIMEDIR='$(RUNTIMEDIR)' TARGET='spam' INTERFACE='spam.i' python_multi_cpp
LIBS='$(LIBS)' TARGET='spam' INTERFACE='spam.i' python_cpp
clean::
$(MAKE) -f $(TOP)/Makefile python_clean
@rm -f foo.py bar.py spam.py base.py
@rm -f foo.py bar.py spam.py base.py runtime.py
check: all

View file

@ -1,5 +1,4 @@
This example tests the SWIG run-time libraries and use of the
%import directive to work with multiple modules.
This example tests the %import directive and working with multiple modules.
Use 'python runme.py' to run a test.
@ -16,25 +15,27 @@ a separate C++ class.
Each module used %import to refer to another module. For
example, the 'foo.i' module uses '%import base.i' to get
definitions for its base class.
definitions for its base class. These modules do not generate
any runtime code (-noruntime commandline option).
If everything is working correctly, all of the modules will load
correctly and type checking will work correctly. The
example requires the use of the SWIG run-time libraries
which must be built and properly installed.
The runtime.i file is an empty SWIG module which will generate
the runtime library code for sharing amongst the other modules
(uses -runtime commandline option).
If everything is okay, all of the modules will load correctly and
type checking will work correctly.
Unix:
-----
- Make sure the SWIG runtime library is built and the path to it is
in LD_LIBRARY_PATH
- Run make
- Make sure your LD_LIBRARY_PATH includes the current directory so that
lib_runtime.so can be loaded.
- Run the test as described above
Windows:
--------
- Make sure the SWIG runtime library is built and in your path. See Windows.html.
- Use the Visual C++ 6 workspace file (example.dsw). Build each project
to create the 4 DLLs. The Batch build option in the Build menu is the
to create the 5 DLLs. The Batch build option in the Build menu is the
easiest way to do this. Only use the Release builds not the Debug builds.
- Run the test as described above

View file

@ -0,0 +1,3 @@
// Empty module for building the runtime library
%module runtime

View file

@ -2,16 +2,18 @@ bar.py
base.py
foo.py
spam.py
runtime.py
bar.pyc
base.pyc
foo.pyc
spam.pyc
runtime.pyc
*_wrap.c
*_wrap.cxx
*.dll
example.dsw
example.exp
example.lib
*.exp
*.lib
example.ncb
example.opt
example.plg

View file

@ -1,21 +1,23 @@
TOP = ../..
SWIG = $(TOP)/../swig
SWIGOPT = -noruntime
RUNTIMEDIR = $(TOP)/../Runtime/.libs
LIBS = -L. -l_runtime
all::
$(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='-runtime' \
LIBPREFIX='lib' TARGET='runtime' INTERFACE='runtime.i' python_cpp
$(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
RUNTIMEDIR='$(RUNTIMEDIR)' TARGET='base' INTERFACE='base.i' python_multi_cpp
LIBS='$(LIBS)' TARGET='base' INTERFACE='base.i' python_cpp
$(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
RUNTIMEDIR='$(RUNTIMEDIR)' TARGET='foo' INTERFACE='foo.i' python_multi_cpp
LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp
$(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
RUNTIMEDIR='$(RUNTIMEDIR)' TARGET='bar' INTERFACE='bar.i' python_multi_cpp
LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' python_cpp
$(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
RUNTIMEDIR='$(RUNTIMEDIR)' TARGET='spam' INTERFACE='spam.i' python_multi_cpp
LIBS='$(LIBS)' TARGET='spam' INTERFACE='spam.i' python_cpp
clean::
$(MAKE) -f $(TOP)/Makefile python_clean
@rm -f foo.py bar.py spam.py base.py
@rm -f foo.py bar.py spam.py base.py runtime.py
check: all

View file

@ -1,7 +1,4 @@
This example tests the SWIG run-time libraries and use of the
%import directive to work with multiple modules. However,
unlike the import example, this uses templates to really
stress test the type-system.
This example tests the %import directive and working with multiple modules.
Use 'python runme.py' to run a test.
@ -18,13 +15,20 @@ a separate C++ class.
Each module used %import to refer to another module. For
example, the 'foo.i' module uses '%import base.i' to get
definitions for its base class.
If everything is working correctly, all of the modules will load
correctly and type checking will work correctly. The
example requires the use of the SWIG run-time libraries
which must be built and properly installed.
definitions for its base class. These modules do not generate
any runtime code (-noruntime commandline option).
The runtime.i file is an empty SWIG module which will generate
the runtime library code for sharing amongst the other modules
(uses -runtime commandline option).
If everything is okay, all of the modules will load correctly and
type checking will work correctly.
Unix:
-----
- Run make
- Make sure your LD_LIBRARY_PATH includes the current directory so that
lib_runtime.so can be loaded.
- Run the test as described above

View file

@ -0,0 +1,3 @@
// Empty module for building the runtime library
%module runtime