diff options
author | Michael Dickens <mlk@alum.mit.edu> | 2013-12-14 11:08:02 -0500 |
---|---|---|
committer | Michael Dickens <mlk@alum.mit.edu> | 2013-12-14 11:08:02 -0500 |
commit | 6fc200fcba65cc4d18d7b10381da72769c0183c4 (patch) | |
tree | 6d65f5bc4f85eb988464e33960037b2788e18925 /gr-trellis/include | |
parent | 2f455c4a8bab60ff485182e9f19aef80a2695b2d (diff) |
GNU Radio EXPAND macros for template files:
+ move the 3 EXPAND macros to a common place (GrMiscUtils);
+ use them, or remove the unnecessary code when not actually using;
+ modify EXPAND macros to do the expansion at configure time, build time, and any time a dependency has been modified.
Diffstat (limited to 'gr-trellis/include')
-rw-r--r-- | gr-trellis/include/gnuradio/trellis/CMakeLists.txt | 69 |
1 files changed, 13 insertions, 56 deletions
diff --git a/gr-trellis/include/gnuradio/trellis/CMakeLists.txt b/gr-trellis/include/gnuradio/trellis/CMakeLists.txt index b7ceea179e..00937a928e 100644 --- a/gr-trellis/include/gnuradio/trellis/CMakeLists.txt +++ b/gr-trellis/include/gnuradio/trellis/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright 2012 Free Software Foundation, Inc. +# Copyright 2012-2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -18,62 +18,19 @@ # Boston, MA 02110-1301, USA. ######################################################################## -# generate helper scripts to expand templated files -######################################################################## -include(GrPython) - -file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py " -#!${PYTHON_EXECUTABLE} - -import sys, os, re -sys.path.append('${GR_RUNTIME_PYTHONPATH}') -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_dict2(name, sig, 'trellis') - build_utils.expand_template(d, inp) - -") - -macro(expand_h root) - #make a list of all the generated files - unset(expanded_files_h) - foreach(sig ${ARGN}) - string(REGEX REPLACE "X+" ${sig} name ${root}) - list(APPEND expanded_files_h ${CMAKE_CURRENT_BINARY_DIR}/${name}.h) - endforeach(sig) - - #create a command to generate the files - add_custom_command( - OUTPUT ${expanded_files_h} - DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${root}.h.t - COMMAND ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B} - ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py - ${root} ${root}.h.t ${ARGN} - ) - - #install rules for the generated h files - list(APPEND generated_includes ${expanded_files_h}) -endmacro(expand_h) - -######################################################################## -# Invoke macro to generate various sources +# Invoke macro to generate various headers ####################################################################### -expand_h(encoder_XX bb bs bi ss si ii) -expand_h(sccc_encoder_XX bb bs bi ss si ii) -expand_h(pccc_encoder_XX bb bs bi ss si ii) -expand_h(metrics_X s i f c) -expand_h(viterbi_X b s i) -expand_h(viterbi_combined_XX sb ss si ib is ii fb fs fi cb cs ci) -expand_h(sccc_decoder_X b s i) -expand_h(sccc_decoder_combined_XX fb fs fi cb cs ci) -expand_h(pccc_decoder_X b s i) -expand_h(pccc_decoder_combined_XX fb fs fi cb cs ci) +include(GrMiscUtils) +GR_EXPAND_X_H(trellis encoder_XX bb bs bi ss si ii) +GR_EXPAND_X_H(trellis sccc_encoder_XX bb bs bi ss si ii) +GR_EXPAND_X_H(trellis pccc_encoder_XX bb bs bi ss si ii) +GR_EXPAND_X_H(trellis metrics_X s i f c) +GR_EXPAND_X_H(trellis viterbi_X b s i) +GR_EXPAND_X_H(trellis viterbi_combined_XX sb ss si ib is ii fb fs fi cb cs ci) +GR_EXPAND_X_H(trellis sccc_decoder_X b s i) +GR_EXPAND_X_H(trellis sccc_decoder_combined_XX fb fs fi cb cs ci) +GR_EXPAND_X_H(trellis pccc_decoder_X b s i) +GR_EXPAND_X_H(trellis pccc_decoder_combined_XX fb fs fi cb cs ci) add_custom_target(trellis_generated_includes DEPENDS ${generated_includes} |