diff options
author | Tom Rondeau <tom@trondeau.com> | 2013-07-24 15:14:49 -0400 |
---|---|---|
committer | Tom Rondeau <tom@trondeau.com> | 2013-07-24 15:14:49 -0400 |
commit | 61282ced0f0514449dee74c0646905f3f3d2c9e5 (patch) | |
tree | 95ca9452f226e303a552e4f6e6dc3beae94cebc9 | |
parent | 69d0a9b61c0e3be8919d43652e47c4f85ac3a7d9 (diff) | |
parent | 5432c985f911f4715456846425dbf84121842de8 (diff) |
Merge branch 'maint'
-rw-r--r-- | cmake/Modules/FindICE-3.5.cmake | 60 | ||||
-rw-r--r-- | cmake/Modules/FindICE.cmake | 60 | ||||
-rw-r--r-- | gr-blocks/lib/char_to_short_impl.cc | 7 | ||||
-rw-r--r-- | gr-blocks/lib/complex_to_float_impl.cc | 19 | ||||
-rw-r--r-- | gr-blocks/lib/complex_to_imag_impl.cc | 9 | ||||
-rw-r--r-- | gr-blocks/lib/complex_to_mag_squared_impl.cc | 7 | ||||
-rw-r--r-- | gr-blocks/lib/complex_to_real_impl.cc | 9 | ||||
-rw-r--r-- | gr-blocks/lib/float_to_char_impl.cc | 7 | ||||
-rw-r--r-- | gr-blocks/lib/float_to_int_impl.cc | 7 | ||||
-rw-r--r-- | gr-blocks/lib/float_to_short_impl.cc | 7 | ||||
-rw-r--r-- | gr-blocks/lib/int_to_float_impl.cc | 7 | ||||
-rw-r--r-- | gr-blocks/lib/short_to_char_impl.cc | 7 | ||||
-rw-r--r-- | gr-blocks/lib/short_to_float_impl.cc | 8 | ||||
-rw-r--r-- | gr-utils/python/modtool/gr-newmod/CMakeLists.txt | 3 | ||||
-rw-r--r-- | gr-utils/python/modtool/gr-newmod/python/build_utils.py | 226 | ||||
-rw-r--r-- | gr-utils/python/modtool/gr-newmod/python/build_utils_codes.py | 52 |
16 files changed, 345 insertions, 150 deletions
diff --git a/cmake/Modules/FindICE-3.5.cmake b/cmake/Modules/FindICE-3.5.cmake index bcdaa4cac5..f56a2740c8 100644 --- a/cmake/Modules/FindICE-3.5.cmake +++ b/cmake/Modules/FindICE-3.5.cmake @@ -11,7 +11,7 @@ if(NOT ICE_FOUND) FIND_PATH( ICE_CONFIG_INCLUDE_DIR NAMES IceUtil/Config.h - HINTS ${CMAKE_INSTALL_PREFIX}/${HEADER_DIR} ${ICE_MANUAL_INSTALL_PATH}/include/ + HINTS ${ICE_MANUAL_INSTALL_PATH}/include/ ${CMAKE_INSTALL_PREFIX}/${HEADER_DIR} ) if(ICE_CONFIG_INCLUDE_DIR) file(STRINGS "${ICE_CONFIG_INCLUDE_DIR}/IceUtil/Config.h" @@ -30,71 +30,63 @@ endif(NOT ICE_FOUND) # Recheck if we found the right version of ICE and proceed if true. if(ICE_FOUND) +# Prepare the path hint for the libraries based on the include +# directory found. +string(REGEX REPLACE "/include" "" ICE_PATH ${ICE_CONFIG_INCLUDE_DIR}) + FIND_PATH( - ICE_INCLUDE_DIR - NAMES IceUtil/IceUtil.h Ice/Ice.h IceStorm/IceStorm.h icestorm_publisher_template.h - HINTS ${CMAKE_INSTALL_PREFIX}/${HEADER_DIR} ${ICE_MANUAL_INSTALL_PATH}/include/ + ICE_INCLUDE_DIR + NAMES IceUtil/IceUtil.h Ice/Ice.h + NO_DEFAULT_PATH + HINTS ${ICE_PATH}/include ) set(ICE_LIBRARY ) FIND_LIBRARY( - ICE_ICESTORM IceStorm - PATHS ENV LD_LIBRARY_PATH - HINTS ${PC_ICE_LIBDIR} ${PC_ICE_LIBRARY_DIRS} - ${ICE_MANUAL_INSTALL_PATH}/lib64/ ${ICE_MANUAL_INSTALL_PATH}/lib/ + ICE_ICESTORM IceStorm + NO_DEFAULT_PATH + HINTS ${ICE_PATH}/lib ${ICE_PATH}/lib64 ) FIND_LIBRARY( ICE_ICESTORM IceStorm - PATHS HINTS ${CMAKE_INSTALL_PREFIX}/lib64/ ${CMAKE_INSTALL_PREFIX}/lib/ - PATHS ${PC_ICE_LIBDIR} ${PC_ICE_LIBRARY_DIRS} - ${ICE_MANUAL_INSTALL_PATH}/lib64/ ${ICE_MANUAL_INSTALL_PATH}/lib/ - ENV LD_LIBRARY_PATH + NO_DEFAULT_PATH + HINTS ${ICE_PATH}/lib ${ICE_PATH}/lib64 ) FIND_LIBRARY( ICE_ICE Ice - PATHS HINTS ${CMAKE_INSTALL_PREFIX}/lib64/ ${CMAKE_INSTALL_PREFIX}/lib/ - PATHS ${PC_ICE_LIBDIR} ${PC_ICE_LIBRARY_DIRS} - ${ICE_MANUAL_INSTALL_PATH}/lib64/ ${ICE_MANUAL_INSTALL_PATH}/lib/ - ENV LD_LIBRARY_PATH + NO_DEFAULT_PATH + HINTS ${ICE_PATH}/lib ${ICE_PATH}/lib64 ) FIND_LIBRARY( ICE_ICEGRID IceGrid - PATHS HINTS ${CMAKE_INSTALL_PREFIX}/lib64/ ${CMAKE_INSTALL_PREFIX}/lib/ - PATHS ${PC_ICE_LIBDIR} ${PC_ICE_LIBRARY_DIRS} - ${ICE_MANUAL_INSTALL_PATH}/lib64/ ${ICE_MANUAL_INSTALL_PATH}/lib/ - ENV LD_LIBRARY_PATH + NO_DEFAULT_PATH + HINTS ${ICE_PATH}/lib ${ICE_PATH}/lib64 ) FIND_LIBRARY( ICE_ICEUTIL IceUtil - PATHS HINTS ${CMAKE_INSTALL_PREFIX}/lib64/ ${CMAKE_INSTALL_PREFIX}/lib/ - PATHS ${PC_ICE_LIBDIR} ${PC_ICE_LIBRARY_DIRS} - ${ICE_MANUAL_INSTALL_PATH}/lib64/ ${ICE_MANUAL_INSTALL_PATH}/lib/ - ENV LD_LIBRARY_PATH + NO_DEFAULT_PATH + HINTS ${ICE_PATH}/lib ${ICE_PATH}/lib64 ) FIND_LIBRARY( ICE_GLACIER2 Glacier2 - PATHS HINTS ${CMAKE_INSTALL_PREFIX}/lib64/ ${CMAKE_INSTALL_PREFIX}/lib/ - PATHS ${PC_ICE_LIBDIR} ${PC_ICE_LIBRARY_DIRS} - ${ICE_MANUAL_INSTALL_PATH}/lib64/ ${ICE_MANUAL_INSTALL_PATH}/lib/ - ENV LD_LIBRARY_PATH + NO_DEFAULT_PATH + HINTS ${ICE_PATH}/lib ${ICE_PATH}/lib64 ) if(APPLE) FIND_LIBRARY( ICE_ZEROCICE ZeroCIce - PATHS HINTS ${CMAKE_INSTALL_PREFIX}/lib64/ ${CMAKE_INSTALL_PREFIX}/lib/ - PATHS ${PC_ICE_LIBDIR} ${PC_ICE_LIBRARY_DIRS} - ${ICE_MANUAL_INSTALL_PATH}/lib64/ ${ICE_MANUAL_INSTALL_PATH}/lib/ - ENV LD_LIBRARY_PATH + NO_DEFAULT_PATH + HINTS ${ICE_PATH}/lib ${ICE_PATH}/lib64 ) endif(APPLE) FIND_LIBRARY( ICE_PTHREAD NAMES pthread pthread-2.13 - PATHS HINTS ${CMAKE_INSTALL_PREFIX}/lib64/ ${CMAKE_INSTALL_PREFIX}/lib/ - PATHS ${PC_ICE_LIBDIR} ${PC_ICE_LIBRARY_DIRS} /lib/i386-linux-gnu /lib/x86_64-linux-gnu /usr/lib /lib /lib64 + HINTS ${CMAKE_INSTALL_PREFIX}/lib64/ ${CMAKE_INSTALL_PREFIX}/lib/ + HINTS ${PC_ICE_LIBDIR} ${PC_ICE_LIBRARY_DIRS} /lib/i386-linux-gnu /lib/x86_64-linux-gnu /usr/lib /lib /lib64 ENV LD_LIBRARY_PATH ) diff --git a/cmake/Modules/FindICE.cmake b/cmake/Modules/FindICE.cmake index 86a812de54..7ce9c2b1a8 100644 --- a/cmake/Modules/FindICE.cmake +++ b/cmake/Modules/FindICE.cmake @@ -31,72 +31,63 @@ endif(NOT ICE_FOUND) # Recheck if we found the right version of ICE and proceed if true. if(ICE_FOUND) +# Prepare the path hint for the libraries based on the include +# directory found. +string(REGEX REPLACE "/include" "" ICE_PATH ${ICE_CONFIG_INCLUDE_DIR}) + FIND_PATH( - ICE_INCLUDE_DIR - NAMES IceUtil/IceUtil.h Ice/Ice.h IceStorm/IceStorm.h icestorm_publisher_template.h - HINTS ${CMAKE_INSTALL_PREFIX}/${HEADER_DIR} ${ICE_MANUAL_INSTALL_PATH}/include/ + ICE_INCLUDE_DIR + NAMES IceUtil/IceUtil.h Ice/Ice.h + NO_DEFAULT_PATH + HINTS ${ICE_PATH}/include ) set(ICE_LIBRARY ) FIND_LIBRARY( - ICE_ICESTORM IceStorm - PATHS ENV LD_LIBRARY_PATH - HINTS ${PC_ICE_LIBDIR} ${PC_ICE_LIBRARY_DIRS} - ${ICE_MANUAL_INSTALL_PATH}/lib64/ ${ICE_MANUAL_INSTALL_PATH}/lib/ + ICE_ICESTORM IceStorm + NO_DEFAULT_PATH + HINTS ${ICE_PATH}/lib ${ICE_PATH}/lib64 ) FIND_LIBRARY( ICE_ICESTORM IceStorm - PATHS HINTS ${CMAKE_INSTALL_PREFIX}/lib64/ ${CMAKE_INSTALL_PREFIX}/lib/ - PATHS ${PC_ICE_LIBDIR} ${PC_ICE_LIBRARY_DIRS} - ${ICE_MANUAL_INSTALL_PATH}/lib64/ ${ICE_MANUAL_INSTALL_PATH}/lib/ - ENV LD_LIBRARY_PATH + NO_DEFAULT_PATH + HINTS ${ICE_PATH}/lib ${ICE_PATH}/lib64 ) FIND_LIBRARY( ICE_ICE Ice - PATHS HINTS ${CMAKE_INSTALL_PREFIX}/lib64/ ${CMAKE_INSTALL_PREFIX}/lib/ - PATHS ${PC_ICE_LIBDIR} ${PC_ICE_LIBRARY_DIRS} - ${ICE_MANUAL_INSTALL_PATH}/lib64/ ${ICE_MANUAL_INSTALL_PATH}/lib/ - ENV LD_LIBRARY_PATH + NO_DEFAULT_PATH + HINTS ${ICE_PATH}/lib ${ICE_PATH}/lib64 ) FIND_LIBRARY( ICE_ICEGRID IceGrid - PATHS HINTS ${CMAKE_INSTALL_PREFIX}/lib64/ ${CMAKE_INSTALL_PREFIX}/lib/ - PATHS ${PC_ICE_LIBDIR} ${PC_ICE_LIBRARY_DIRS} - ${ICE_MANUAL_INSTALL_PATH}/lib64/ ${ICE_MANUAL_INSTALL_PATH}/lib/ - ENV LD_LIBRARY_PATH + NO_DEFAULT_PATH + HINTS ${ICE_PATH}/lib ${ICE_PATH}/lib64 ) FIND_LIBRARY( ICE_ICEUTIL IceUtil - PATHS HINTS ${CMAKE_INSTALL_PREFIX}/lib64/ ${CMAKE_INSTALL_PREFIX}/lib/ - PATHS ${PC_ICE_LIBDIR} ${PC_ICE_LIBRARY_DIRS} - ${ICE_MANUAL_INSTALL_PATH}/lib64/ ${ICE_MANUAL_INSTALL_PATH}/lib/ - ENV LD_LIBRARY_PATH + NO_DEFAULT_PATH + HINTS ${ICE_PATH}/lib ${ICE_PATH}/lib64 ) FIND_LIBRARY( ICE_GLACIER2 Glacier2 - PATHS HINTS ${CMAKE_INSTALL_PREFIX}/lib64/ ${CMAKE_INSTALL_PREFIX}/lib/ - PATHS ${PC_ICE_LIBDIR} ${PC_ICE_LIBRARY_DIRS} - ${ICE_MANUAL_INSTALL_PATH}/lib64/ ${ICE_MANUAL_INSTALL_PATH}/lib/ - ENV LD_LIBRARY_PATH + NO_DEFAULT_PATH + HINTS ${ICE_PATH}/lib ${ICE_PATH}/lib64 ) if(APPLE) FIND_LIBRARY( ICE_ZEROCICE ZeroCIce - PATHS HINTS ${CMAKE_INSTALL_PREFIX}/lib64/ ${CMAKE_INSTALL_PREFIX}/lib/ - PATHS ${PC_ICE_LIBDIR} ${PC_ICE_LIBRARY_DIRS} - ${ICE_MANUAL_INSTALL_PATH}/lib64/ ${ICE_MANUAL_INSTALL_PATH}/lib/ - ENV LD_LIBRARY_PATH + NO_DEFAULT_PATH + HINTS ${ICE_PATH}/lib ${ICE_PATH}/lib64 ) endif(APPLE) FIND_LIBRARY( ICE_PTHREAD NAMES pthread pthread-2.13 - PATHS HINTS ${CMAKE_INSTALL_PREFIX}/lib64/ ${CMAKE_INSTALL_PREFIX}/lib/ - PATHS ${PC_ICE_LIBDIR} ${PC_ICE_LIBRARY_DIRS} /lib/i386-linux-gnu - /lib/x86_64-linux-gnu /usr/lib /lib /lib64 + HINTS ${CMAKE_INSTALL_PREFIX}/lib64/ ${CMAKE_INSTALL_PREFIX}/lib/ + HINTS ${PC_ICE_LIBDIR} ${PC_ICE_LIBRARY_DIRS} /lib/i386-linux-gnu /lib/x86_64-linux-gnu /usr/lib /lib /lib64 ENV LD_LIBRARY_PATH ) @@ -104,7 +95,6 @@ set(ICE_FOUND FALSE) if(ICE_ICE OR ICE_ZEROCICE) if(ICE_ICEUTIL) - list(APPEND ICE_LIBRARY ${ICE_ICE} ${ICE_ZEROCICE} diff --git a/gr-blocks/lib/char_to_short_impl.cc b/gr-blocks/lib/char_to_short_impl.cc index 2b5414d673..065fb58bbe 100644 --- a/gr-blocks/lib/char_to_short_impl.cc +++ b/gr-blocks/lib/char_to_short_impl.cc @@ -55,12 +55,7 @@ namespace gr { const int8_t *in = (const int8_t *) input_items[0]; int16_t *out = (int16_t *) output_items[0]; - if(is_unaligned()) { - volk_8i_convert_16i_u(out, in, d_vlen*noutput_items); - } - else { - volk_8i_convert_16i_a(out, in, d_vlen*noutput_items); - } + volk_8i_convert_16i(out, in, d_vlen*noutput_items); return noutput_items; } diff --git a/gr-blocks/lib/complex_to_float_impl.cc b/gr-blocks/lib/complex_to_float_impl.cc index d0b2bc6b9c..ee295dea12 100644 --- a/gr-blocks/lib/complex_to_float_impl.cc +++ b/gr-blocks/lib/complex_to_float_impl.cc @@ -59,27 +59,12 @@ namespace gr { switch (output_items.size ()){ case 1: - if(is_unaligned()) { - for (int i = 0; i < noi; i++){ - out0[i] = in[i].real (); - } - } - else { - volk_32fc_deinterleave_real_32f_a(out0, in, noi); - } + volk_32fc_deinterleave_real_32f(out0, in, noi); break; case 2: out1 = (float *) output_items[1]; - if(is_unaligned()) { - for (int i = 0; i < noi; i++){ - out0[i] = in[i].real (); - out1[i] = in[i].imag (); - } - } - else { - volk_32fc_deinterleave_32f_x2_a(out0, out1, in, noi); - } + volk_32fc_deinterleave_32f_x2(out0, out1, in, noi); break; default: diff --git a/gr-blocks/lib/complex_to_imag_impl.cc b/gr-blocks/lib/complex_to_imag_impl.cc index 27d349aa1d..b58b59bb3b 100644 --- a/gr-blocks/lib/complex_to_imag_impl.cc +++ b/gr-blocks/lib/complex_to_imag_impl.cc @@ -56,14 +56,7 @@ namespace gr { float *out = (float *) output_items[0]; int noi = noutput_items * d_vlen; - if(is_unaligned()) { - for (int i = 0; i < noi; i++){ - out[i] = in[i].imag (); - } - } - else { - volk_32fc_deinterleave_imag_32f_a(out, in, noi); - } + volk_32fc_deinterleave_imag_32f(out, in, noi); return noutput_items; } diff --git a/gr-blocks/lib/complex_to_mag_squared_impl.cc b/gr-blocks/lib/complex_to_mag_squared_impl.cc index 513527c25a..5e3fedc87c 100644 --- a/gr-blocks/lib/complex_to_mag_squared_impl.cc +++ b/gr-blocks/lib/complex_to_mag_squared_impl.cc @@ -56,12 +56,7 @@ namespace gr { float *out = (float *) output_items[0]; int noi = noutput_items * d_vlen; - if(is_unaligned()) { - volk_32fc_magnitude_squared_32f_u(out, in, noi); - } - else { - volk_32fc_magnitude_squared_32f_a(out, in, noi); - } + volk_32fc_magnitude_squared_32f(out, in, noi); return noutput_items; } diff --git a/gr-blocks/lib/complex_to_real_impl.cc b/gr-blocks/lib/complex_to_real_impl.cc index 06d1b5ab0e..36c4b203d8 100644 --- a/gr-blocks/lib/complex_to_real_impl.cc +++ b/gr-blocks/lib/complex_to_real_impl.cc @@ -56,14 +56,7 @@ namespace gr { float *out = (float *) output_items[0]; int noi = noutput_items * d_vlen; - if(is_unaligned()) { - for (int i = 0; i < noi; i++){ - out[i] = in[i].real (); - } - } - else { - volk_32fc_deinterleave_real_32f_a(out, in, noi); - } + volk_32fc_deinterleave_real_32f(out, in, noi); return noutput_items; } diff --git a/gr-blocks/lib/float_to_char_impl.cc b/gr-blocks/lib/float_to_char_impl.cc index cec95cb66b..f51f08455c 100644 --- a/gr-blocks/lib/float_to_char_impl.cc +++ b/gr-blocks/lib/float_to_char_impl.cc @@ -55,12 +55,7 @@ namespace gr { const float *in = (const float *) input_items[0]; int8_t *out = (int8_t *) output_items[0]; - if(is_unaligned()) { - volk_32f_s32f_convert_8i_u(out, in, d_scale, d_vlen*noutput_items); - } - else { - volk_32f_s32f_convert_8i_a(out, in, d_scale, d_vlen*noutput_items); - } + volk_32f_s32f_convert_8i(out, in, d_scale, d_vlen*noutput_items); return noutput_items; } diff --git a/gr-blocks/lib/float_to_int_impl.cc b/gr-blocks/lib/float_to_int_impl.cc index 04db8bed2f..7b4522068b 100644 --- a/gr-blocks/lib/float_to_int_impl.cc +++ b/gr-blocks/lib/float_to_int_impl.cc @@ -62,12 +62,7 @@ namespace gr { const float *in = (const float *) input_items[0]; int32_t *out = (int32_t *) output_items[0]; - if(is_unaligned()) { - volk_32f_s32f_convert_32i_u(out, in, d_scale, d_vlen*noutput_items); - } - else { - volk_32f_s32f_convert_32i_a(out, in, d_scale, d_vlen*noutput_items); - } + volk_32f_s32f_convert_32i(out, in, d_scale, d_vlen*noutput_items); #else const float *in = (const float *) input_items[0]; int *out = (int *) output_items[0]; diff --git a/gr-blocks/lib/float_to_short_impl.cc b/gr-blocks/lib/float_to_short_impl.cc index 6c6b5607a9..791519002f 100644 --- a/gr-blocks/lib/float_to_short_impl.cc +++ b/gr-blocks/lib/float_to_short_impl.cc @@ -55,12 +55,7 @@ namespace gr { const float *in = (const float *) input_items[0]; short *out = (short *) output_items[0]; - if(is_unaligned()) { - volk_32f_s32f_convert_16i_u(out, in, d_scale, d_vlen*noutput_items); - } - else { - volk_32f_s32f_convert_16i_a(out, in, d_scale, d_vlen*noutput_items); - } + volk_32f_s32f_convert_16i(out, in, d_scale, d_vlen*noutput_items); return noutput_items; } diff --git a/gr-blocks/lib/int_to_float_impl.cc b/gr-blocks/lib/int_to_float_impl.cc index 306a6f169d..ec215c446b 100644 --- a/gr-blocks/lib/int_to_float_impl.cc +++ b/gr-blocks/lib/int_to_float_impl.cc @@ -55,12 +55,7 @@ namespace gr { const int32_t *in = (const int32_t *) input_items[0]; float *out = (float *) output_items[0]; - if(is_unaligned()) { - volk_32i_s32f_convert_32f_u(out, in, d_scale, d_vlen*noutput_items); - } - else { - volk_32i_s32f_convert_32f_a(out, in, d_scale, d_vlen*noutput_items); - } + volk_32i_s32f_convert_32f(out, in, d_scale, d_vlen*noutput_items); return noutput_items; } diff --git a/gr-blocks/lib/short_to_char_impl.cc b/gr-blocks/lib/short_to_char_impl.cc index f4a5c80c32..982ed5c20e 100644 --- a/gr-blocks/lib/short_to_char_impl.cc +++ b/gr-blocks/lib/short_to_char_impl.cc @@ -55,12 +55,7 @@ namespace gr { const int16_t *in = (const int16_t *) input_items[0]; int8_t *out = (int8_t *) output_items[0]; - if(is_unaligned()) { - volk_16i_convert_8i_u(out, in, d_vlen*noutput_items); - } - else { - volk_16i_convert_8i_a(out, in, d_vlen*noutput_items); - } + volk_16i_convert_8i(out, in, d_vlen*noutput_items); return noutput_items; } diff --git a/gr-blocks/lib/short_to_float_impl.cc b/gr-blocks/lib/short_to_float_impl.cc index 147b0c07f4..fce0da77b3 100644 --- a/gr-blocks/lib/short_to_float_impl.cc +++ b/gr-blocks/lib/short_to_float_impl.cc @@ -55,12 +55,8 @@ namespace gr { const short *in = (const short *) input_items[0]; float *out = (float *) output_items[0]; - if(is_unaligned()) { - volk_16i_s32f_convert_32f_u(out, in, d_scale, d_vlen*noutput_items); - } - else { - volk_16i_s32f_convert_32f_a(out, in, d_scale, d_vlen*noutput_items); - } + volk_16i_s32f_convert_32f(out, in, d_scale, d_vlen*noutput_items); + return noutput_items; } diff --git a/gr-utils/python/modtool/gr-newmod/CMakeLists.txt b/gr-utils/python/modtool/gr-newmod/CMakeLists.txt index 6f01385e84..7ff80ff7ac 100644 --- a/gr-utils/python/modtool/gr-newmod/CMakeLists.txt +++ b/gr-utils/python/modtool/gr-newmod/CMakeLists.txt @@ -105,7 +105,10 @@ endif() # Setup the include and linker paths ######################################################################## include_directories( + ${CMAKE_SOURCE_DIR}/lib ${CMAKE_SOURCE_DIR}/include + ${CMAKE_BINARY_DIR}/lib + ${CMAKE_BINARY_DIR}/include ${Boost_INCLUDE_DIRS} ${CPPUNIT_INCLUDE_DIRS} ${GNURADIO_RUNTIME_INCLUDE_DIRS} diff --git a/gr-utils/python/modtool/gr-newmod/python/build_utils.py b/gr-utils/python/modtool/gr-newmod/python/build_utils.py new file mode 100644 index 0000000000..cf58a97637 --- /dev/null +++ b/gr-utils/python/modtool/gr-newmod/python/build_utils.py @@ -0,0 +1,226 @@ +# +# Copyright 2004,2009,2012 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 GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. +# + +"""Misc utilities used at build time +""" + +import re, os, os.path +from build_utils_codes import * + + +# set srcdir to the directory that contains Makefile.am +try: + srcdir = os.environ['srcdir'] +except KeyError, e: + srcdir = "." +srcdir = srcdir + '/' + +# set do_makefile to either true or false dependeing on the environment +try: + if os.environ['do_makefile'] == '0': + do_makefile = False + else: + do_makefile = True +except KeyError, e: + do_makefile = False + +# set do_sources to either true or false dependeing on the environment +try: + if os.environ['do_sources'] == '0': + do_sources = False + else: + do_sources = True +except KeyError, e: + do_sources = True + +name_dict = {} + +def log_output_name (name): + (base, ext) = os.path.splitext (name) + ext = ext[1:] # drop the leading '.' + + entry = name_dict.setdefault (ext, []) + entry.append (name) + +def open_and_log_name (name, dir): + global do_sources + if do_sources: + f = open (name, dir) + else: + f = None + log_output_name (name) + return f + +def expand_template (d, template_filename, extra = ""): + '''Given a dictionary D and a TEMPLATE_FILENAME, expand template into output file + ''' + global do_sources + output_extension = extract_extension (template_filename) + template = open_src (template_filename, 'r') + output_name = d['NAME'] + extra + '.' + output_extension + log_output_name (output_name) + if do_sources: + output = open (output_name, 'w') + do_substitution (d, template, output) + output.close () + template.close () + +def output_glue (dirname): + output_makefile_fragment () + output_ifile_include (dirname) + +def output_makefile_fragment (): + global do_makefile + if not do_makefile: + return +# overwrite the source, which must be writable; this should have been +# checked for beforehand in the top-level Makefile.gen.gen . + f = open (os.path.join (os.environ.get('gendir', os.environ.get('srcdir', '.')), 'Makefile.gen'), 'w') + f.write ('#\n# This file is machine generated. All edits will be overwritten\n#\n') + output_subfrag (f, 'h') + output_subfrag (f, 'i') + output_subfrag (f, 'cc') + f.close () + +def output_ifile_include (dirname): + global do_sources + if do_sources: + f = open ('%s_generated.i' % (dirname,), 'w') + f.write ('//\n// This file is machine generated. All edits will be overwritten\n//\n') + files = name_dict.setdefault ('i', []) + files.sort () + f.write ('%{\n') + for file in files: + f.write ('#include <%s>\n' % (file[0:-1] + 'h',)) + f.write ('%}\n\n') + for file in files: + f.write ('%%include <%s>\n' % (file,)) + +def output_subfrag (f, ext): + files = name_dict.setdefault (ext, []) + files.sort () + f.write ("GENERATED_%s =" % (ext.upper ())) + for file in files: + f.write (" \\\n\t%s" % (file,)) + f.write ("\n\n") + +def extract_extension (template_name): + # template name is something like: GrFIRfilterXXX.h.t + # we return everything between the penultimate . and .t + mo = re.search (r'\.([a-z]+)\.t$', template_name) + if not mo: + raise ValueError, "Incorrectly formed template_name '%s'" % (template_name,) + return mo.group (1) + +def open_src (name, mode): + global srcdir + return open (os.path.join (srcdir, name), mode) + +def do_substitution (d, in_file, out_file): + def repl (match_obj): + key = match_obj.group (1) + # print key + return d[key] + + inp = in_file.read () + out = re.sub (r"@([a-zA-Z0-9_]+)@", repl, inp) + out_file.write (out) + + + +copyright = '''/* -*- c++ -*- */ +/* + * Copyright 2003,2004 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 GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ +''' + +def is_complex (code3): + if i_code (code3) == 'c' or o_code (code3) == 'c': + return '1' + else: + return '0' + + +def standard_dict (name, code3, package='gr'): + d = {} + d['NAME'] = name + d['NAME_IMPL'] = name+'_impl' + d['GUARD_NAME'] = 'INCLUDED_%s_%s_H' % (package.upper(), name.upper()) + d['GUARD_NAME_IMPL'] = 'INCLUDED_%s_%s_IMPL_H' % (package.upper(), name.upper()) + d['BASE_NAME'] = re.sub ('^' + package + '_', '', name) + d['SPTR_NAME'] = '%s_sptr' % name + d['WARNING'] = 'WARNING: this file is machine generated. Edits will be overwritten' + d['COPYRIGHT'] = copyright + d['TYPE'] = i_type (code3) + d['I_TYPE'] = i_type (code3) + d['O_TYPE'] = o_type (code3) + d['TAP_TYPE'] = tap_type (code3) + d['IS_COMPLEX'] = is_complex (code3) + return d + + +def standard_dict2 (name, code3, package): + d = {} + d['NAME'] = name + d['BASE_NAME'] = name + d['GUARD_NAME'] = 'INCLUDED_%s_%s_H' % (package.upper(), name.upper()) + d['WARNING'] = 'WARNING: this file is machine generated. Edits will be overwritten' + d['COPYRIGHT'] = copyright + d['TYPE'] = i_type (code3) + d['I_TYPE'] = i_type (code3) + d['O_TYPE'] = o_type (code3) + d['TAP_TYPE'] = tap_type (code3) + d['IS_COMPLEX'] = is_complex (code3) + return d + +def standard_impl_dict2 (name, code3, package): + d = {} + d['NAME'] = name + d['IMPL_NAME'] = name + d['BASE_NAME'] = name.rstrip("impl").rstrip("_") + d['GUARD_NAME'] = 'INCLUDED_%s_%s_H' % (package.upper(), name.upper()) + d['WARNING'] = 'WARNING: this file is machine generated. Edits will be overwritten' + d['COPYRIGHT'] = copyright + d['FIR_TYPE'] = "fir_filter_" + code3 + d['CFIR_TYPE'] = "fir_filter_" + code3[0:2] + 'c' + d['TYPE'] = i_type (code3) + d['I_TYPE'] = i_type (code3) + d['O_TYPE'] = o_type (code3) + d['TAP_TYPE'] = tap_type (code3) + d['IS_COMPLEX'] = is_complex (code3) + return d diff --git a/gr-utils/python/modtool/gr-newmod/python/build_utils_codes.py b/gr-utils/python/modtool/gr-newmod/python/build_utils_codes.py new file mode 100644 index 0000000000..9ea96baae4 --- /dev/null +++ b/gr-utils/python/modtool/gr-newmod/python/build_utils_codes.py @@ -0,0 +1,52 @@ +# +# Copyright 2004 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 GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. +# + +def i_code (code3): + return code3[0] + +def o_code (code3): + if len (code3) >= 2: + return code3[1] + else: + return code3[0] + +def tap_code (code3): + if len (code3) >= 3: + return code3[2] + else: + return code3[0] + +def i_type (code3): + return char_to_type[i_code (code3)] + +def o_type (code3): + return char_to_type[o_code (code3)] + +def tap_type (code3): + return char_to_type[tap_code (code3)] + + +char_to_type = {} +char_to_type['s'] = 'short' +char_to_type['i'] = 'int' +char_to_type['f'] = 'float' +char_to_type['c'] = 'gr_complex' +char_to_type['b'] = 'unsigned char' |