discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Discuss-gnuradio] OOT Module Template Expansion Issues


From: Jacob Gilbert
Subject: Re: [Discuss-gnuradio] OOT Module Template Expansion Issues
Date: Thu, 24 Mar 2016 18:24:10 -0600

Thanks Martin,

I added something like this to the CMakeLists.txt files in lib and include/testmod:

file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py
"#!${PYTHON_EXECUTABLE}
import sys, os, re
sys.path.append('${GR_RUNTIME_PYTHONPATH}')
sys.path.append('${CMAKE_CURRENT_SOURCE_DIR}/../python')
os.environ['srcdir'] = '${CMAKE_CURRENT_SOURCE_DIR}'
os.chdir('${CMAKE_CURRENT_BINARY_DIR}')
if __name__ == '__main__':
  import build_utils
  root, inp = sys.argv[1:3]
  for sig in sys.argv[3:]:
      name = re.sub ('X+', sig, root)
      d = build_utils.standard_impl_dict2(name, sig, '${component}')
      build_utils.expand_template(d, inp)
")

Is that what you mean? Or can I tell CMake to use the module in tesmod/cmake/Modules/GrPlatform.cmake?

I'd like to know the recommended way, and we can get this added into the modtool templates.

Jacob

On Thu, Mar 24, 2016 at 6:05 PM, Martin Braun <address@hidden> wrote:
The short answer is, the templated in-tree stuff has access to some
modules we don't actually export to OOTs. You'll need to copy the
template infrastructure into your OOT.

Cheers,
Martin

On 03/24/2016 11:25 AM, Jacob Gilbert wrote:
> I am attempting to add several templatized blocks to an OOT module and
> am having trouble with getting things to build correctly.
>
> After using modtool to add the new block, adding the .t extensions to
> the impl.cc/imp.h/.h <http://impl.cc/imp.h/.h> files, and adding test
> code, I added the following to ../lib/CMakeLists.txt:
>
>
>     include(GrMiscUtils)
>     GR_EXPAND_X_CC_H(testmod testblock_X_impl              c f i s b)
>
>     ...
>
>     list(APPEND testmod_sources
>         ${generated_sources}
>         <other block sources...>
>
>
> and the following to ../include/testmod/CMakeLists.txt:
>
>
>     include(GrMiscUtils)
>     GR_EXPAND_X_H(testmod testblock_X              c f i s b)
>
>     add_custom_target(testmod_generated_includes DEPENDS
>         ${generated_includes}
>     )
>
>     ...
>
>     install(FILES
>         ${generated_includes}
>
>         <other header files...>
>
>
>
> These were borrowed from in-tree templates like fir_filter_XXX; I was
> unable to find an OOT module using templates. I also added appropriate
> #include, %include, and GR_SWIG_BLOCK_MAGIC2 to swig/testmod_swig.i for
> each of the generated blocks. However, when I attempt to build I get the
> following error:
>
>       File
>     "/home/jacob/gr-testmod/build/include/testmod/generate_helper.py",
>     line 9, in <module>
>         import build_utils
>     ImportError: No module named build_utils
>
>
>
> This obviously does not happen to in-tree modules. I attempted to modify
> the gr-testmod/cmake/Modules/GrMiscUtils.cmake file where the
> GR_EXPAND_.X..() macros are defined to explicitly include the
> appropriate path, however it appears that by default the include
> statement I am using actually uses the GrMiscUtils.cmake installed with
> gnuradio (into /usr/local/lib/cmake/gnuradio/ in my case). If I modify
> the used GR_EXPAND_X... macros and manually add the correct path
> (sys.path.append('${CMAKE_CURRENT_SOURCE_DIR}/../python') or
> '../../python' in the case of the include macro), expansion works
> correctly, however this makes the code very un-portable.
>
> Given my elementary understand of CMake, I have no idea what I am doing
> incorrectly, or what changes if any should be made to modtool, but I was
> unable to find any other documents on how to go about doing this.
>
> Thanks,
> Jacob
>
>
> _______________________________________________
> Discuss-gnuradio mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
>


_______________________________________________
Discuss-gnuradio mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio


reply via email to

[Prev in Thread] Current Thread [Next in Thread]