From d94769a975612072dc03fa378bc79856c07cd66b Mon Sep 17 00:00:00 2001 From: Rob Savoye Date: Sat, 30 Oct 2010 12:14:41 -0600 Subject: add load-extension support --- gr-howto-write-a-block/swig/howto.i | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'gr-howto-write-a-block/swig') diff --git a/gr-howto-write-a-block/swig/howto.i b/gr-howto-write-a-block/swig/howto.i index 8dc502010..9a37ea228 100644 --- a/gr-howto-write-a-block/swig/howto.i +++ b/gr-howto-write-a-block/swig/howto.i @@ -9,3 +9,13 @@ %include "howto_square_ff.i" %include "howto_square2_ff.i" + +#if SWIGGUILE +%scheme %{ +(load-extension "libguile-howto" "scm_init_gnuradio_howto_module") +%} + +%goops %{ +(use-modules (gnuradio gnuradio_core_runtime)) +%} +#endif -- cgit From c8835c285c6abbc334701238f53f87f93e6f125a Mon Sep 17 00:00:00 2001 From: Rob Savoye Date: Mon, 15 Nov 2010 19:08:28 -0700 Subject: make howto build the new way --- gr-howto-write-a-block/swig/Makefile.am | 35 ++-- gr-howto-write-a-block/swig/Makefile.swig.gen | 220 ++++++-------------------- 2 files changed, 72 insertions(+), 183 deletions(-) (limited to 'gr-howto-write-a-block/swig') diff --git a/gr-howto-write-a-block/swig/Makefile.am b/gr-howto-write-a-block/swig/Makefile.am index 4737ad619..a57834683 100644 --- a/gr-howto-write-a-block/swig/Makefile.am +++ b/gr-howto-write-a-block/swig/Makefile.am @@ -20,8 +20,19 @@ # include $(top_srcdir)/Makefile.common +include $(top_srcdir)/Makefile.swig + +# add some of the variables generated inside the Makefile.swig.gen +BUILT_SOURCES = $(swig_built_sources) + +CLEANFILES = python/*.cc python/*.h python/*.d +if GUILE +CLEANFILES += guile/*.cc gnuradio/*.scm guile/*.d +endif -AM_CPPFLAGS += -I$(top_srcdir)/lib +AM_CPPFLAGS += -I$(top_srcdir)/lib + +swig_built_sources = if PYTHON ################################### @@ -34,21 +45,23 @@ TOP_SWIG_IFILES = \ # import howto # This ends up at: # ${prefix}/lib/python${python_version}/site-packages/$(modname) - howto_la_swig_libadd = \ $(top_builddir)/lib/libgnuradio-howto.la -include $(top_srcdir)/Makefile.swig - -# add some of the variables generated inside the Makefile.swig.gen -BUILT_SOURCES = $(swig_built_sources) - -# Do not distribute the output of SWIG -no_dist_files = $(swig_built_sources) - # additional SWIG files to be installed -howto_swiginclude_headers = \ +aqhowto_swiginclude_headers = \ howto_square_ff.i \ howto_square2_ff.i +PYTHON_GEN = $(foreach HFILE,$(TOP_SWIG_IFILES), $(subst .i,.py,$(HFILE))) +swig_built_sources += $(PYTHON_GEN) endif + +if GUILE +GUILE_GEN = $(foreach HFILE,$(TOP_SWIG_IFILES), $(patsubst %.i,gnuradio/%.scm,$(HFILE))) +swig_built_sources += $(GUILE_GEN) +endif + +# Do not distribute the output of SWIG +no_dist_files = $(swig_built_sources) + diff --git a/gr-howto-write-a-block/swig/Makefile.swig.gen b/gr-howto-write-a-block/swig/Makefile.swig.gen index 6c6e66290..b42bd12a3 100644 --- a/gr-howto-write-a-block/swig/Makefile.swig.gen +++ b/gr-howto-write-a-block/swig/Makefile.swig.gen @@ -25,16 +25,28 @@ ## Default install locations for these files: ## ## Default location for the Python directory is: -## ${prefix}/lib/python${python_version}/site-packages/howto +## ${prefix}/lib/python${python_version}/site-packages/[category]/howto ## Default location for the Python exec directory is: -## ${exec_prefix}/lib/python${python_version}/site-packages/howto +## ${exec_prefix}/lib/python${python_version}/site-packages/[category]/howto ## ## The following can be overloaded to change the install location, but ## this has to be done in the including Makefile.am -before- ## Makefile.swig is included. -howto_pythondir = $(pythondir)/howto -howto_pylibdir = $(pyexecdir)/howto +howto_pythondir_category ?= gnuradio/howto +howto_pylibdir_category ?= $(howto_pythondir_category) +howto_pythondir = $(pythondir)/$(howto_pythondir_category) +howto_pylibdir = $(pyexecdir)/$(howto_pylibdir_category) + +# The .so libraries for the guile modules get installed whereever guile +# is installed, usually /usr/lib/guile/gnuradio/ +# FIXME: determince whether these should be installed with gnuradio. +howto_scmlibdir = $(libdir) + +# The scm files for the guile modules get installed where ever guile +# is installed, usually /usr/share/guile/site/howto +# FIXME: determince whether these should be installed with gnuradio. +howto_scmdir = $(guiledir) ## SWIG headers are always installed into the same directory. @@ -55,23 +67,10 @@ howto_swigincludedir = $(swigincludedir) ## right thing. For more info, see < ## http://sources.redhat.com/automake/automake.html#Multiple-Outputs > -## Stamps used to ensure parallel make does the right thing. These -## are removed by "make clean", but otherwise unused except during the -## parallel built. These will not be included in a tarball, because -## the SWIG-generated files will be removed from the distribution. - -STAMPS += $(DEPDIR)/howto-generate-* - ## Other cleaned files: dependency files generated by SWIG or this Makefile MOSTLYCLEANFILES += $(DEPDIR)/*.S* -## Add the .py and .cc files to the list of SWIG built sources. The -## .h file is sometimes built, but not always ... so that one has to -## be added manually by the including Makefile.am . - -swig_built_sources += howto_swig.py howto_swig.cc - ## Various SWIG variables. These can be overloaded in the including ## Makefile.am by setting the variable value there, then including ## Makefile.swig . @@ -81,177 +80,54 @@ howto_swiginclude_HEADERS = \ $(howto_swiginclude_headers) howto_pylib_LTLIBRARIES = \ - _howto_swig.la + _howto.la -_howto_swig_la_SOURCES = \ - howto_swig.cc \ +_howto_la_SOURCES = \ + python/howto.cc \ $(howto_la_swig_sources) -_howto_swig_la_LIBADD = \ +_howto_la_LIBADD = \ $(STD_SWIG_LA_LIB_ADD) \ $(howto_la_swig_libadd) -_howto_swig_la_LDFLAGS = \ +_howto_la_LDFLAGS = \ $(STD_SWIG_LA_LD_FLAGS) \ $(howto_la_swig_ldflags) -_howto_swig_la_CXXFLAGS = \ +_howto_la_CXXFLAGS = \ $(STD_SWIG_CXX_FLAGS) \ + -I$(top_builddir) \ $(howto_la_swig_cxxflags) howto_python_PYTHON = \ - howto_swig.py \ - $(howto_python) + howto.py \ + $(howto) -## Entry rule for running SWIG +python/howto.cc: howto.py +howto.py: howto.i -howto.h howto_swig.py howto_swig.cc: howto.i -## This rule will get called only when MAKE decides that one of the -## targets needs to be created or re-created, because: -## -## * The .i file is newer than any or all of the generated files; -## -## * Any or all of the .cc, .h, or .py files does not exist and is -## needed (in the case this file is not needed, the rule for it is -## ignored); or -## -## * Some SWIG-based dependecy of the .cc file isn't met and hence the -## .cc file needs be be regenerated. Explanation: Because MAKE -## knows how to handle dependencies for .cc files (regardless of -## their name or extension), then the .cc file is used as a target -## instead of the .i file -- but with the dependencies of the .i -## file. It is this last reason why the line: -## -## if test -f $@; then :; else -## -## cannot be used in this case: If a .i file dependecy is not met, -## then the .cc file needs to be rebuilt. But if the stamp is newer -## than the .cc file, and the .cc file exists, then in the original -## version (with the 'test' above) the internal MAKE call will not -## be issued and hence the .cc file will not be rebuilt. -## -## Once execution gets to here, it should always proceed no matter the -## state of a stamp (as discussed in link above). The -## $(DEPDIR)/howto-generate stuff is used to allow for parallel -## builds to "do the right thing". The stamp has no relationship with -## either the target files or dependency file; it is used solely for -## the protection of multiple builds during a given call to MAKE. -## -## Catch signals SIGHUP (1), SIGINT (2), SIGPIPE (13), and SIGTERM -## (15). At a caught signal, the quoted command will be issued before -## exiting. In this case, remove any stamp, whether temporary of not. -## The trap is valid until the process exits; the process includes all -## commands appended via "\"s. -## - trap 'rm -rf $(DEPDIR)/howto-generate-*' 1 2 13 15; \ -## -## Create a temporary directory, which acts as a lock. The first -## process to create the directory will succeed and issue the MAKE -## command to do the actual work, while all subsequent processes will -## fail -- leading them to wait for the first process to finish. -## - if mkdir $(DEPDIR)/howto-generate-lock 2>/dev/null; then \ -## -## This code is being executed by the first process to succeed in -## creating the directory lock. -## -## Remove the stamp associated with this filename. -## - rm -f $(DEPDIR)/howto-generate-stamp; \ -## -## Tell MAKE to run the rule for creating this stamp. -## - $(MAKE) $(AM_MAKEFLAGS) $(DEPDIR)/howto-generate-stamp WHAT=$<; \ -## -## Now that the .cc, .h, and .py files have been (re)created from the -## .i file, future checking of this rule during the same MAKE -## execution will come back that the rule doesn't need to be executed -## because none of the conditions mentioned at the start of this rule -## will be positive. Remove the the directory lock, which frees up -## any waiting process(es) to continue. -## - rmdir $(DEPDIR)/howto-generate-lock; \ - else \ -## -## This code is being executed by any follower processes while the -## directory lock is in place. -## -## Wait until the first process is done, testing once per second. -## - while test -d $(DEPDIR)/howto-generate-lock; do \ - sleep 1; \ - done; \ -## -## Succeed if and only if the first process succeeded; exit this -## process returning the status of the generated stamp. -## - test -f $(DEPDIR)/howto-generate-stamp; \ - exit $$?; \ - fi; +# Include the python dependencies for this file +-include python/howto.d +# end of PYTHON -$(DEPDIR)/howto-generate-stamp: -## This rule will be called only by the first process issuing the -## above rule to succeed in creating the lock directory, after -## removing the actual stamp file in order to guarantee that MAKE will -## execute this rule. -## -## Call SWIG to generate the various output files; special -## post-processing on 'mingw32' host OS for the dependency file. -## - if $(SWIG) $(STD_SWIG_PYTHON_ARGS) $(howto_swig_args) \ - -MD -MF $(DEPDIR)/howto.Std \ - -module howto_swig -o howto_swig.cc $(WHAT); then \ - if test $(host_os) = mingw32; then \ - $(RM) $(DEPDIR)/howto.Sd; \ - $(SED) 's,\\\\,/,g' < $(DEPDIR)/howto.Std \ - > $(DEPDIR)/howto.Sd; \ - $(RM) $(DEPDIR)/howto.Std; \ - $(MV) $(DEPDIR)/howto.Sd $(DEPDIR)/howto.Std; \ - fi; \ - else \ - $(RM) $(DEPDIR)/howto.S*; exit 1; \ - fi; -## -## Mess with the SWIG output .Std dependency file, to create a -## dependecy file valid for the input .i file: Basically, simulate the -## dependency file created for libraries by GNU's libtool for C++, -## where all of the dependencies for the target are first listed, then -## each individual dependency is listed as a target with no further -## dependencies. -## -## (1) remove the current dependency file -## - $(RM) $(DEPDIR)/howto.d -## -## (2) Copy the whole SWIG file: -## - cp $(DEPDIR)/howto.Std $(DEPDIR)/howto.d -## -## (3) all a carriage return to the end of the dependency file. -## - echo "" >> $(DEPDIR)/howto.d -## -## (4) from the SWIG file, remove the first line (the target); remove -## trailing " \" and " " from each line. Append ":" to each line, -## followed by 2 carriage returns, then append this to the end of -## the dependency file. -## - $(SED) -e '1d;s, \\,,g;s, ,,g' < $(DEPDIR)/howto.Std | \ - awk '{ printf "%s:\n\n", $$0 }' >> $(DEPDIR)/howto.d -## -## (5) remove the SWIG-generated file -## - $(RM) $(DEPDIR)/howto.Std -## -## Create the stamp for this filename generation, to signal success in -## executing this rule; allows other threads waiting on this process -## to continue. -## - touch $(DEPDIR)/howto-generate-stamp +if GUILE +howto_scmlib_LTLIBRARIES = libguile-howto.la +libguile_howto_la_SOURCES = \ + guile/howto.cc \ + $(howto_la_swig_sources) +nobase_howto_scm_DATA = gnuradio/howto.scm gnuradio/howto-primitive.scm + +libguile_howto_la_LIBADD = $(_howto_la_LIBADD) +libguile_howto_la_LDFLAGS = $(_howto_la_LDFLAGS) +libguile_howto_la_CXXFLAGS = $(_howto_la_CXXFLAGS) + +guile/howto.cc: gnuradio/howto.scm +gnuradio/howto.scm: howto.i +gnuradio/howto-primitive.scm: gnuradio/howto.scm + +# Include the guile dependencies for this file +-include guile/howto.d -# KLUDGE: Force runtime include of a SWIG dependency file. This is -# not guaranteed to be portable, but will probably work. If it works, -# we have accurate dependencies for our swig stuff, which is good. +endif # end of GUILE -@am__include@ @am__quote@./$(DEPDIR)/howto.d@am__quote@ -- cgit From f0ed1de2d15b24eae7be7ab8a4762a6fd74ff681 Mon Sep 17 00:00:00 2001 From: Rob Savoye Date: Mon, 15 Nov 2010 19:20:13 -0700 Subject: add other .i files to EXTRA_DIST so it'll almost distcheck --- gr-howto-write-a-block/swig/Makefile.am | 2 ++ 1 file changed, 2 insertions(+) (limited to 'gr-howto-write-a-block/swig') diff --git a/gr-howto-write-a-block/swig/Makefile.am b/gr-howto-write-a-block/swig/Makefile.am index a57834683..17c4334f6 100644 --- a/gr-howto-write-a-block/swig/Makefile.am +++ b/gr-howto-write-a-block/swig/Makefile.am @@ -53,6 +53,8 @@ aqhowto_swiginclude_headers = \ howto_square_ff.i \ howto_square2_ff.i +EXTRA_DIST = $(aqhowto_swiginclude_headers) + PYTHON_GEN = $(foreach HFILE,$(TOP_SWIG_IFILES), $(subst .i,.py,$(HFILE))) swig_built_sources += $(PYTHON_GEN) endif -- cgit From 8180bb1d7020e07c9b0a217820c68d07f0d98a74 Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Tue, 16 Nov 2010 21:33:50 -0800 Subject: regenerated --- gr-howto-write-a-block/swig/Makefile.swig.gen | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gr-howto-write-a-block/swig') diff --git a/gr-howto-write-a-block/swig/Makefile.swig.gen b/gr-howto-write-a-block/swig/Makefile.swig.gen index b42bd12a3..72d8a09aa 100644 --- a/gr-howto-write-a-block/swig/Makefile.swig.gen +++ b/gr-howto-write-a-block/swig/Makefile.swig.gen @@ -101,7 +101,7 @@ _howto_la_CXXFLAGS = \ howto_python_PYTHON = \ howto.py \ - $(howto) + $(howto_python) python/howto.cc: howto.py howto.py: howto.i -- cgit From cfb2ff29a33e05b74cc80f3b68609af6bafc96ca Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Wed, 17 Nov 2010 08:17:12 -0800 Subject: Update .gitignore --- gr-howto-write-a-block/swig/.gitignore | 3 +++ 1 file changed, 3 insertions(+) (limited to 'gr-howto-write-a-block/swig') diff --git a/gr-howto-write-a-block/swig/.gitignore b/gr-howto-write-a-block/swig/.gitignore index 7f4c478d9..696b1ae84 100644 --- a/gr-howto-write-a-block/swig/.gitignore +++ b/gr-howto-write-a-block/swig/.gitignore @@ -4,3 +4,6 @@ /Makefile /howto_swig.cc /howto_swig.py +/gnuradio +/guile +/python -- cgit From d692a41f98e7b888c745efbb9fcbbb0400f39025 Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Wed, 24 Nov 2010 17:29:11 -0800 Subject: Major Makefile.am housecleaning. Passes distcheck. Move all occurrences of swig_built_sources out of Makefile.am's. Move all SWIG related use of BUILT_SOURCES out of Makefile.am's. Clean up 'if PYTHON' conditionalization in gr-* Still left to do: fix Makefile.swig CLEANFILES and no_dist_files such that they remove exactly the generated files. --- gr-howto-write-a-block/swig/Makefile.am | 30 +++--------------------------- 1 file changed, 3 insertions(+), 27 deletions(-) (limited to 'gr-howto-write-a-block/swig') diff --git a/gr-howto-write-a-block/swig/Makefile.am b/gr-howto-write-a-block/swig/Makefile.am index 17c4334f6..c6b1786f6 100644 --- a/gr-howto-write-a-block/swig/Makefile.am +++ b/gr-howto-write-a-block/swig/Makefile.am @@ -22,21 +22,10 @@ include $(top_srcdir)/Makefile.common include $(top_srcdir)/Makefile.swig -# add some of the variables generated inside the Makefile.swig.gen -BUILT_SOURCES = $(swig_built_sources) - -CLEANFILES = python/*.cc python/*.h python/*.d -if GUILE -CLEANFILES += guile/*.cc gnuradio/*.scm guile/*.d -endif - AM_CPPFLAGS += -I$(top_srcdir)/lib -swig_built_sources = - -if PYTHON ################################### -# SWIG Python interface and library +# SWIG interfaces and libraries TOP_SWIG_IFILES = \ howto.i @@ -49,21 +38,8 @@ howto_la_swig_libadd = \ $(top_builddir)/lib/libgnuradio-howto.la # additional SWIG files to be installed -aqhowto_swiginclude_headers = \ +howto_swiginclude_headers = \ howto_square_ff.i \ howto_square2_ff.i -EXTRA_DIST = $(aqhowto_swiginclude_headers) - -PYTHON_GEN = $(foreach HFILE,$(TOP_SWIG_IFILES), $(subst .i,.py,$(HFILE))) -swig_built_sources += $(PYTHON_GEN) -endif - -if GUILE -GUILE_GEN = $(foreach HFILE,$(TOP_SWIG_IFILES), $(patsubst %.i,gnuradio/%.scm,$(HFILE))) -swig_built_sources += $(GUILE_GEN) -endif - -# Do not distribute the output of SWIG -no_dist_files = $(swig_built_sources) - +EXTRA_DIST += $(howto_swiginclude_headers) -- cgit From 0b5f66113f43d2ba94a1ca741b5ce65e1f9f2c02 Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Fri, 3 Dec 2010 23:30:54 -0800 Subject: Rename libguile- to libguile-gnuradio- to match guile library naming convention. The stuff in gnuradio-core ends up with funky names, but that could be fixed by renaming gnuradio_core_filter.i -> core_filter.i etc. --- gr-howto-write-a-block/swig/howto.i | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gr-howto-write-a-block/swig') diff --git a/gr-howto-write-a-block/swig/howto.i b/gr-howto-write-a-block/swig/howto.i index 9a37ea228..868df5739 100644 --- a/gr-howto-write-a-block/swig/howto.i +++ b/gr-howto-write-a-block/swig/howto.i @@ -12,7 +12,7 @@ #if SWIGGUILE %scheme %{ -(load-extension "libguile-howto" "scm_init_gnuradio_howto_module") +(load-extension "libguile-gnuradio-howto" "scm_init_gnuradio_howto_module") %} %goops %{ -- cgit From 7a7a4b7ad1ccdb0c1f6814e6c258b1238fd92fd7 Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Fri, 3 Dec 2010 23:40:22 -0800 Subject: Fix EXTRA_DIST in gr-howto-write-a-block --- gr-howto-write-a-block/swig/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gr-howto-write-a-block/swig') diff --git a/gr-howto-write-a-block/swig/Makefile.am b/gr-howto-write-a-block/swig/Makefile.am index c6b1786f6..d55c8070d 100644 --- a/gr-howto-write-a-block/swig/Makefile.am +++ b/gr-howto-write-a-block/swig/Makefile.am @@ -42,4 +42,4 @@ howto_swiginclude_headers = \ howto_square_ff.i \ howto_square2_ff.i -EXTRA_DIST += $(howto_swiginclude_headers) +EXTRA_DIST = $(howto_swiginclude_headers) -- cgit From ea8a60ad9c2e0f9bdc57f77f5506c5906f8d1d6f Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Fri, 3 Dec 2010 23:58:48 -0800 Subject: Make gr-howto-write-a-block work again... Copied Makefile.swig, Mkefile.swig.gen.t from .. Renamed howto.i to howto_swig.i Regenerated Makefile.swig.gen --- gr-howto-write-a-block/swig/Makefile.am | 4 +- gr-howto-write-a-block/swig/Makefile.swig.gen | 102 ++++++++++++++------------ gr-howto-write-a-block/swig/howto.i | 21 ------ gr-howto-write-a-block/swig/howto_swig.i | 21 ++++++ 4 files changed, 80 insertions(+), 68 deletions(-) delete mode 100644 gr-howto-write-a-block/swig/howto.i create mode 100644 gr-howto-write-a-block/swig/howto_swig.i (limited to 'gr-howto-write-a-block/swig') diff --git a/gr-howto-write-a-block/swig/Makefile.am b/gr-howto-write-a-block/swig/Makefile.am index d55c8070d..87134af93 100644 --- a/gr-howto-write-a-block/swig/Makefile.am +++ b/gr-howto-write-a-block/swig/Makefile.am @@ -28,13 +28,13 @@ AM_CPPFLAGS += -I$(top_srcdir)/lib # SWIG interfaces and libraries TOP_SWIG_IFILES = \ - howto.i + howto_swig.i # Install so that they end up available as: # import howto # This ends up at: # ${prefix}/lib/python${python_version}/site-packages/$(modname) -howto_la_swig_libadd = \ +howto_swig_la_swig_libadd = \ $(top_builddir)/lib/libgnuradio-howto.la # additional SWIG files to be installed diff --git a/gr-howto-write-a-block/swig/Makefile.swig.gen b/gr-howto-write-a-block/swig/Makefile.swig.gen index 72d8a09aa..310cfb8da 100644 --- a/gr-howto-write-a-block/swig/Makefile.swig.gen +++ b/gr-howto-write-a-block/swig/Makefile.swig.gen @@ -20,37 +20,37 @@ # Boston, MA 02110-1301, USA. # -# Makefile.swig.gen for howto.i +# Makefile.swig.gen for howto_swig.i ## Default install locations for these files: ## ## Default location for the Python directory is: -## ${prefix}/lib/python${python_version}/site-packages/[category]/howto +## ${prefix}/lib/python${python_version}/site-packages/[category]/howto_swig ## Default location for the Python exec directory is: -## ${exec_prefix}/lib/python${python_version}/site-packages/[category]/howto +## ${exec_prefix}/lib/python${python_version}/site-packages/[category]/howto_swig ## ## The following can be overloaded to change the install location, but ## this has to be done in the including Makefile.am -before- ## Makefile.swig is included. -howto_pythondir_category ?= gnuradio/howto -howto_pylibdir_category ?= $(howto_pythondir_category) -howto_pythondir = $(pythondir)/$(howto_pythondir_category) -howto_pylibdir = $(pyexecdir)/$(howto_pylibdir_category) +howto_swig_pythondir_category ?= gnuradio/howto_swig +howto_swig_pylibdir_category ?= $(howto_swig_pythondir_category) +howto_swig_pythondir = $(pythondir)/$(howto_swig_pythondir_category) +howto_swig_pylibdir = $(pyexecdir)/$(howto_swig_pylibdir_category) # The .so libraries for the guile modules get installed whereever guile # is installed, usually /usr/lib/guile/gnuradio/ # FIXME: determince whether these should be installed with gnuradio. -howto_scmlibdir = $(libdir) +howto_swig_scmlibdir = $(libdir) # The scm files for the guile modules get installed where ever guile -# is installed, usually /usr/share/guile/site/howto +# is installed, usually /usr/share/guile/site/howto_swig # FIXME: determince whether these should be installed with gnuradio. -howto_scmdir = $(guiledir) +howto_swig_scmdir = $(guiledir) ## SWIG headers are always installed into the same directory. -howto_swigincludedir = $(swigincludedir) +howto_swig_swigincludedir = $(swigincludedir) ## This is a template file for a "generated" Makefile addition (in ## this case, "Makefile.swig.gen"). By including the top-level @@ -75,58 +75,70 @@ MOSTLYCLEANFILES += $(DEPDIR)/*.S* ## Makefile.am by setting the variable value there, then including ## Makefile.swig . -howto_swiginclude_HEADERS = \ - howto.i \ - $(howto_swiginclude_headers) +howto_swig_swiginclude_HEADERS = \ + howto_swig.i \ + $(howto_swig_swiginclude_headers) -howto_pylib_LTLIBRARIES = \ - _howto.la +if PYTHON +howto_swig_pylib_LTLIBRARIES = \ + _howto_swig.la -_howto_la_SOURCES = \ - python/howto.cc \ - $(howto_la_swig_sources) +_howto_swig_la_SOURCES = \ + python/howto_swig.cc \ + $(howto_swig_la_swig_sources) -_howto_la_LIBADD = \ +howto_swig_python_PYTHON = \ + howto_swig.py \ + $(howto_swig_python) + +_howto_swig_la_LIBADD = \ $(STD_SWIG_LA_LIB_ADD) \ - $(howto_la_swig_libadd) + $(howto_swig_la_swig_libadd) -_howto_la_LDFLAGS = \ +_howto_swig_la_LDFLAGS = \ $(STD_SWIG_LA_LD_FLAGS) \ - $(howto_la_swig_ldflags) + $(howto_swig_la_swig_ldflags) -_howto_la_CXXFLAGS = \ +_howto_swig_la_CXXFLAGS = \ $(STD_SWIG_CXX_FLAGS) \ -I$(top_builddir) \ - $(howto_la_swig_cxxflags) - -howto_python_PYTHON = \ - howto.py \ - $(howto_python) + $(howto_swig_la_swig_cxxflags) -python/howto.cc: howto.py -howto.py: howto.i +python/howto_swig.cc: howto_swig.py +howto_swig.py: howto_swig.i # Include the python dependencies for this file --include python/howto.d -# end of PYTHON +-include python/howto_swig.d + +endif # end of if python if GUILE -howto_scmlib_LTLIBRARIES = libguile-howto.la -libguile_howto_la_SOURCES = \ - guile/howto.cc \ - $(howto_la_swig_sources) -nobase_howto_scm_DATA = gnuradio/howto.scm gnuradio/howto-primitive.scm -libguile_howto_la_LIBADD = $(_howto_la_LIBADD) -libguile_howto_la_LDFLAGS = $(_howto_la_LDFLAGS) -libguile_howto_la_CXXFLAGS = $(_howto_la_CXXFLAGS) +howto_swig_scmlib_LTLIBRARIES = \ + libguile-gnuradio-howto_swig.la +libguile_gnuradio_howto_swig_la_SOURCES = \ + guile/howto_swig.cc \ + $(howto_swig_la_swig_sources) +nobase_howto_swig_scm_DATA = \ + gnuradio/howto_swig.scm \ + gnuradio/howto_swig-primitive.scm +libguile_gnuradio_howto_swig_la_LIBADD = \ + $(STD_SWIG_LA_LIB_ADD) \ + $(howto_swig_la_swig_libadd) +libguile_gnuradio_howto_swig_la_LDFLAGS = \ + $(STD_SWIG_LA_LD_FLAGS) \ + $(howto_swig_la_swig_ldflags) +libguile_gnuradio_howto_swig_la_CXXFLAGS = \ + $(STD_SWIG_CXX_FLAGS) \ + -I$(top_builddir) \ + $(howto_swig_la_swig_cxxflags) -guile/howto.cc: gnuradio/howto.scm -gnuradio/howto.scm: howto.i -gnuradio/howto-primitive.scm: gnuradio/howto.scm +guile/howto_swig.cc: gnuradio/howto_swig.scm +gnuradio/howto_swig.scm: howto_swig.i +gnuradio/howto_swig-primitive.scm: gnuradio/howto_swig.scm # Include the guile dependencies for this file --include guile/howto.d +-include guile/howto_swig.d endif # end of GUILE diff --git a/gr-howto-write-a-block/swig/howto.i b/gr-howto-write-a-block/swig/howto.i deleted file mode 100644 index 868df5739..000000000 --- a/gr-howto-write-a-block/swig/howto.i +++ /dev/null @@ -1,21 +0,0 @@ -/* -*- c++ -*- */ - -%include "gnuradio.i" // the common stuff - -%{ -#include "howto_square_ff.h" -#include "howto_square2_ff.h" -%} - -%include "howto_square_ff.i" -%include "howto_square2_ff.i" - -#if SWIGGUILE -%scheme %{ -(load-extension "libguile-gnuradio-howto" "scm_init_gnuradio_howto_module") -%} - -%goops %{ -(use-modules (gnuradio gnuradio_core_runtime)) -%} -#endif diff --git a/gr-howto-write-a-block/swig/howto_swig.i b/gr-howto-write-a-block/swig/howto_swig.i new file mode 100644 index 000000000..868df5739 --- /dev/null +++ b/gr-howto-write-a-block/swig/howto_swig.i @@ -0,0 +1,21 @@ +/* -*- c++ -*- */ + +%include "gnuradio.i" // the common stuff + +%{ +#include "howto_square_ff.h" +#include "howto_square2_ff.h" +%} + +%include "howto_square_ff.i" +%include "howto_square2_ff.i" + +#if SWIGGUILE +%scheme %{ +(load-extension "libguile-gnuradio-howto" "scm_init_gnuradio_howto_module") +%} + +%goops %{ +(use-modules (gnuradio gnuradio_core_runtime)) +%} +#endif -- cgit From 910165a9eccf02bf4cb0fb30fb4e620426c1a000 Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Sat, 4 Dec 2010 01:18:36 -0800 Subject: Fix load-extension strings --- gr-howto-write-a-block/swig/howto_swig.i | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gr-howto-write-a-block/swig') diff --git a/gr-howto-write-a-block/swig/howto_swig.i b/gr-howto-write-a-block/swig/howto_swig.i index 868df5739..c62ddf3eb 100644 --- a/gr-howto-write-a-block/swig/howto_swig.i +++ b/gr-howto-write-a-block/swig/howto_swig.i @@ -12,7 +12,7 @@ #if SWIGGUILE %scheme %{ -(load-extension "libguile-gnuradio-howto" "scm_init_gnuradio_howto_module") +(load-extension "libguile-gnuradio-howto_swig" "scm_init_gnuradio_howto_swig_module") %} %goops %{ -- cgit From cc088ab014791450d9d5d88564f3f889ece74909 Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Mon, 6 Dec 2010 19:47:42 -0800 Subject: Add guile QA code to gr-howto-write-a-block --- gr-howto-write-a-block/swig/Makefile.am | 9 ++++ gr-howto-write-a-block/swig/howto.test | 69 ++++++++++++++++++++++++++ gr-howto-write-a-block/swig/run_guile_tests.in | 14 ++++++ 3 files changed, 92 insertions(+) create mode 100644 gr-howto-write-a-block/swig/howto.test create mode 100644 gr-howto-write-a-block/swig/run_guile_tests.in (limited to 'gr-howto-write-a-block/swig') diff --git a/gr-howto-write-a-block/swig/Makefile.am b/gr-howto-write-a-block/swig/Makefile.am index 87134af93..a7d39444e 100644 --- a/gr-howto-write-a-block/swig/Makefile.am +++ b/gr-howto-write-a-block/swig/Makefile.am @@ -43,3 +43,12 @@ howto_swiginclude_headers = \ howto_square2_ff.i EXTRA_DIST = $(howto_swiginclude_headers) + + +if GUILE +TESTS = run_guile_tests +EXTRA_DIST += $(nobase_guile_DATA) + +nobase_guile_DATA = \ + gnuradio/howto.scm +endif diff --git a/gr-howto-write-a-block/swig/howto.test b/gr-howto-write-a-block/swig/howto.test new file mode 100644 index 000000000..ffe7251cd --- /dev/null +++ b/gr-howto-write-a-block/swig/howto.test @@ -0,0 +1,69 @@ +;;; -*- Scheme -*- +;;; +;;; Copyright 2010 Free Software Foundation, Inc. +;;; +;;; This file is part of GNU Radio +;;; +;;; GNU Radio is free software; you can redistribute it and/or modify +;;; it under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3, or (at your option) +;;; any later version. +;;; +;;; GNU Radio is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program. If not, see . +;;; + +;;; If you're using Emacs's Scheme mode: +;;; (put 'with-test-prefix 'scheme-indent-function 1) + +;;; See the comments in gnuradio/test-suite/lib.scm for info on writing tests. +;;; See also the very end of the file, where the test-equal, test-eqv +;;; and test-eq macros are defined. + +(define-module (test-module) + #:use-module (oop goops) + #:use-module (gnuradio core) + #:use-module (gnuradio test-suite lib) + #:duplicates (merge-generics replace check)) + + +;; Use our module +(use-modules (gnuradio howto)) + + +(define (vector-map f v) + (list->vector (map f (vector->list v)))) + + +(with-test-prefix "square-ff" + (let* ((src-data #(-3. 4. -5.5 2. 3.)) + (expected-result (vector-map (lambda (x) (* x x)) src-data)) + (tb (gr:top-block-swig "QA top block")) + (src (gr:vector-source-f src-data #f)) + (op (gr:howto-square-ff)) + (dst (gr:vector-sink-f))) + + (gr:connect tb src op dst) + + (gr:run tb) + (test-equal expected-result (gr:data dst)))) + + +(with-test-prefix "square2-ff" + (let* ((src-data #(-3. 4. -5.5 2. 3.)) + (expected-result (vector-map (lambda (x) (* x x)) src-data)) + (tb (gr:top-block-swig "QA top block")) + (src (gr:vector-source-f src-data #f)) + (op (gr:howto-square2-ff)) + (dst (gr:vector-sink-f))) + + (gr:connect tb src op dst) + + (gr:run tb) + (test-equal expected-result (gr:data dst)))) + diff --git a/gr-howto-write-a-block/swig/run_guile_tests.in b/gr-howto-write-a-block/swig/run_guile_tests.in new file mode 100644 index 000000000..5d08b0dd5 --- /dev/null +++ b/gr-howto-write-a-block/swig/run_guile_tests.in @@ -0,0 +1,14 @@ +#!/bin/sh + +. @top_builddir@/setup_guile_test_env + +# 1st argument is absolute path to hand coded guile source directory +# 2nd argument is absolute path to component C++ shared library build directory +# 3nd argument is absolute path to component SWIG build directory + +add_local_paths \ + @srcdir@ \ + @abs_builddir@ \ + @abs_builddir@ + +@GUILE@ -e main -c '(use-modules (gnuradio test-suite guile-test))' -t @srcdir@ -- cgit From 08907ee94fb6c34531d57b988324c67c26c8b747 Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Fri, 10 Dec 2010 16:15:40 -0800 Subject: Use load-extension-global instead of load-extension --- gr-howto-write-a-block/swig/howto_swig.i | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gr-howto-write-a-block/swig') diff --git a/gr-howto-write-a-block/swig/howto_swig.i b/gr-howto-write-a-block/swig/howto_swig.i index c62ddf3eb..d0bbcdc11 100644 --- a/gr-howto-write-a-block/swig/howto_swig.i +++ b/gr-howto-write-a-block/swig/howto_swig.i @@ -12,7 +12,7 @@ #if SWIGGUILE %scheme %{ -(load-extension "libguile-gnuradio-howto_swig" "scm_init_gnuradio_howto_swig_module") +(load-extension-global "libguile-gnuradio-howto_swig" "scm_init_gnuradio_howto_swig_module") %} %goops %{ -- cgit From fd8f86713d8f9de79850b9e7aabde7c453b7e890 Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Mon, 27 Dec 2010 22:56:47 -0800 Subject: Add missing .test files to tarball. --- gr-howto-write-a-block/swig/Makefile.am | 2 ++ 1 file changed, 2 insertions(+) (limited to 'gr-howto-write-a-block/swig') diff --git a/gr-howto-write-a-block/swig/Makefile.am b/gr-howto-write-a-block/swig/Makefile.am index a7d39444e..ba660f1b3 100644 --- a/gr-howto-write-a-block/swig/Makefile.am +++ b/gr-howto-write-a-block/swig/Makefile.am @@ -22,6 +22,8 @@ include $(top_srcdir)/Makefile.common include $(top_srcdir)/Makefile.swig +noinst_GUILE = howto.test + AM_CPPFLAGS += -I$(top_srcdir)/lib ################################### -- cgit