diff options
-rw-r--r-- | cmake/Modules/GrMiscUtils.cmake | 174 | ||||
-rw-r--r-- | gr-analog/include/gnuradio/analog/CMakeLists.txt | 55 | ||||
-rw-r--r-- | gr-analog/lib/CMakeLists.txt | 72 | ||||
-rw-r--r-- | gr-blocks/include/gnuradio/blocks/CMakeLists.txt | 109 | ||||
-rw-r--r-- | gr-blocks/lib/CMakeLists.txt | 126 | ||||
-rw-r--r-- | gr-digital/include/gnuradio/digital/CMakeLists.txt | 51 | ||||
-rw-r--r-- | gr-digital/lib/CMakeLists.txt | 67 | ||||
-rw-r--r-- | gr-fec/include/gnuradio/fec/CMakeLists.txt | 54 | ||||
-rw-r--r-- | gr-filter/include/gnuradio/filter/CMakeLists.txt | 57 | ||||
-rw-r--r-- | gr-filter/lib/CMakeLists.txt | 74 | ||||
-rw-r--r-- | gr-trellis/include/gnuradio/trellis/CMakeLists.txt | 69 | ||||
-rw-r--r-- | gr-trellis/lib/CMakeLists.txt | 85 |
12 files changed, 296 insertions, 697 deletions
diff --git a/cmake/Modules/GrMiscUtils.cmake b/cmake/Modules/GrMiscUtils.cmake index 3d9a5f519b..747eb1a3d1 100644 --- a/cmake/Modules/GrMiscUtils.cmake +++ b/cmake/Modules/GrMiscUtils.cmake @@ -1,4 +1,4 @@ -# Copyright 2010-2011 Free Software Foundation, Inc. +# Copyright 2010-2011,2014 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -345,3 +345,175 @@ set(CMAKE_REQUIRED_LIBRARIES -lpthread) GR_ADD_COND_DEF(HAVE_SCHED_SETSCHEDULER) endmacro(GR_CHECK_LINUX_SCHED_AVAIL) +######################################################################## +# Macros to generate source and header files from template +######################################################################## +macro(GR_EXPAND_X_H component root) + + 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, '${component}') + build_utils.expand_template(d, inp) +") + + #make a list of all the generated headers + 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) + unset(name) + + #create a command to generate the headers + 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 headers + list(APPEND generated_includes ${expanded_files_h}) + +endmacro(GR_EXPAND_X_H) + +macro(GR_EXPAND_X_CC_H component root) + + 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_impl_dict2(name, sig, '${component}') + build_utils.expand_template(d, inp) +") + + #make a list of all the generated files + unset(expanded_files_cc) + unset(expanded_files_h) + foreach(sig ${ARGN}) + string(REGEX REPLACE "X+" ${sig} name ${root}) + list(APPEND expanded_files_cc ${CMAKE_CURRENT_BINARY_DIR}/${name}.cc) + list(APPEND expanded_files_h ${CMAKE_CURRENT_BINARY_DIR}/${name}.h) + endforeach(sig) + unset(name) + + #create a command to generate the source files + add_custom_command( + OUTPUT ${expanded_files_cc} + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${root}.cc.t + COMMAND ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B} + ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py + ${root} ${root}.cc.t ${ARGN} + ) + + #create a command to generate the header 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} + ) + + #make source files depends on headers to force generation + set_source_files_properties(${expanded_files_cc} + PROPERTIES OBJECT_DEPENDS "${expanded_files_h}" + ) + + #install rules for the generated files + list(APPEND generated_sources ${expanded_files_cc}) + list(APPEND generated_headers ${expanded_files_h}) + +endmacro(GR_EXPAND_X_CC_H) + +macro(GR_EXPAND_X_CC_H_IMPL component root) + + 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_dict(name, sig, '${component}') + build_utils.expand_template(d, inp, '_impl') +") + + #make a list of all the generated files + unset(expanded_files_cc_impl) + unset(expanded_files_h_impl) + unset(expanded_files_h) + foreach(sig ${ARGN}) + string(REGEX REPLACE "X+" ${sig} name ${root}) + list(APPEND expanded_files_cc_impl ${CMAKE_CURRENT_BINARY_DIR}/${name}_impl.cc) + list(APPEND expanded_files_h_impl ${CMAKE_CURRENT_BINARY_DIR}/${name}_impl.h) + list(APPEND expanded_files_h ${CMAKE_CURRENT_BINARY_DIR}/../include/gnuradio/${component}/${name}.h) + endforeach(sig) + unset(name) + + #create a command to generate the _impl.cc files + add_custom_command( + OUTPUT ${expanded_files_cc_impl} + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${root}_impl.cc.t + COMMAND ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B} + ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py + ${root} ${root}_impl.cc.t ${ARGN} + ) + + #create a command to generate the _impl.h files + add_custom_command( + OUTPUT ${expanded_files_h_impl} + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${root}_impl.h.t + COMMAND ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B} + ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py + ${root} ${root}_impl.h.t ${ARGN} + ) + + #make _impl.cc source files depend on _impl.h to force generation + set_source_files_properties(${expanded_files_cc_impl} + PROPERTIES OBJECT_DEPENDS "${expanded_files_h_impl}" + ) + + #make _impl.h source files depend on headers to force generation + set_source_files_properties(${expanded_files_h_impl} + PROPERTIES OBJECT_DEPENDS "${expanded_files_h}" + ) + + #install rules for the generated files + list(APPEND generated_sources ${expanded_files_cc_impl}) + list(APPEND generated_headers ${expanded_files_h_impl}) + +endmacro(GR_EXPAND_X_CC_H_IMPL) diff --git a/gr-analog/include/gnuradio/analog/CMakeLists.txt b/gr-analog/include/gnuradio/analog/CMakeLists.txt index 01c0518f0b..5812cb28ad 100644 --- a/gr-analog/include/gnuradio/analog/CMakeLists.txt +++ b/gr-analog/include/gnuradio/analog/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright 2012 Free Software Foundation, Inc. +# Copyright 2012,2014 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -18,55 +18,12 @@ # Boston, MA 02110-1301, USA. ######################################################################## -# generate helper scripts to expand templated files +# Invoke macro to generate various headers ######################################################################## -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, 'analog') - 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 -####################################################################### -expand_h(noise_source_X s i f c) -expand_h(fastnoise_source_X s i f c) -expand_h(sig_source_X s i f c) +include(GrMiscUtils) +GR_EXPAND_X_H(analog noise_source_X s i f c) +GR_EXPAND_X_H(analog fastnoise_source_X s i f c) +GR_EXPAND_X_H(analog sig_source_X s i f c) add_custom_target(analog_generated_includes DEPENDS ${generated_includes} diff --git a/gr-analog/lib/CMakeLists.txt b/gr-analog/lib/CMakeLists.txt index 451233174b..6aa2299792 100644 --- a/gr-analog/lib/CMakeLists.txt +++ b/gr-analog/lib/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright 2012-2013 Free Software Foundation, Inc. +# Copyright 2012-2014 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -41,72 +41,12 @@ if(ENABLE_GR_CTRLPORT) endif(ENABLE_GR_CTRLPORT) ######################################################################## -# generate helper scripts to expand templated files +# Invoke macro to generate various sources and headers ######################################################################## -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_impl_dict2(name, sig, 'analog') - build_utils.expand_template(d, inp) -") - -macro(expand_cc root) - #make a list of all the generated files - unset(expanded_files_cc) - unset(expanded_files_h) - foreach(sig ${ARGN}) - string(REGEX REPLACE "X+" ${sig} name ${root}) - list(APPEND expanded_files_cc ${CMAKE_CURRENT_BINARY_DIR}/${name}.cc) - list(APPEND expanded_files_h ${CMAKE_CURRENT_BINARY_DIR}/${name}.h) - endforeach(sig) - - #create a command to generate the source files - add_custom_command( - OUTPUT ${expanded_files_cc} - DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${root}.cc.t - COMMAND ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B} - ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py - ${root} ${root}.cc.t ${ARGN} - ) - - #create a command to generate the header file - 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} - ) - - #make source files depends on headers to force generation - set_source_files_properties(${expanded_files_cc} - PROPERTIES OBJECT_DEPENDS "${expanded_files_h}" - ) - - #install rules for the generated cc files - list(APPEND generated_sources ${expanded_files_cc}) - list(APPEND generated_headers ${expanded_files_h}) -endmacro(expand_cc) - - -######################################################################## -# Invoke macro to generate various sources -######################################################################## -expand_cc(noise_source_X_impl s i f c) -expand_cc(fastnoise_source_X_impl s i f c) -expand_cc(sig_source_X_impl s i f c) +include(GrMiscUtils) +GR_EXPAND_X_CC_H(analog noise_source_X_impl s i f c) +GR_EXPAND_X_CC_H(analog fastnoise_source_X_impl s i f c) +GR_EXPAND_X_CC_H(analog sig_source_X_impl s i f c) ######################################################################## # Setup library diff --git a/gr-blocks/include/gnuradio/blocks/CMakeLists.txt b/gr-blocks/include/gnuradio/blocks/CMakeLists.txt index bf0c1e8e4f..96e86078f3 100644 --- a/gr-blocks/include/gnuradio/blocks/CMakeLists.txt +++ b/gr-blocks/include/gnuradio/blocks/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright 2013 Free Software Foundation, Inc. +# Copyright 2013-2014 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -18,82 +18,39 @@ # Boston, MA 02110-1301, USA. ######################################################################## -# generate helper scripts to expand templated files +# Invoke macro to generate various headers ######################################################################## -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_dict(name, sig, 'blocks') - 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 -######################################################################## -expand_h(abs_XX ss ii ff) -expand_h(add_XX ss ii cc) -expand_h(add_const_XX bb ss ii ff cc) -expand_h(add_const_vXX bb ss ii ff cc) -expand_h(and_XX bb ss ii) -expand_h(and_const_XX bb ss ii) -expand_h(argmax_XX fs is ss) -expand_h(divide_XX ss ii ff cc) -expand_h(integrate_XX ss ii ff cc) -expand_h(max_XX ff ii ss) -expand_h(moving_average_XX ss ii ff cc) -expand_h(multiply_XX ss ii) -expand_h(multiply_const_XX ss ii) -expand_h(multiply_const_vXX ss ii ff cc) -expand_h(multiply_matrix_XX ff cc) -expand_h(mute_XX ss ii ff cc) -expand_h(not_XX bb ss ii) -expand_h(or_XX bb ss ii) -expand_h(peak_detector_XX fb ib sb) -expand_h(probe_signal_X b s i f c) -expand_h(probe_signal_vX b s i f c) -expand_h(sample_and_hold_XX bb ss ii ff) -expand_h(sub_XX ss ii ff cc) -expand_h(tsb_vector_sink_X b s i f c) -expand_h(xor_XX bb ss ii) -expand_h(packed_to_unpacked_XX bb ss ii) -expand_h(unpacked_to_packed_XX bb ss ii) -expand_h(vector_insert_X b s i f c) -expand_h(vector_sink_X b s i f c) -expand_h(vector_source_X b s i f c) +include(GrMiscUtils) +GR_EXPAND_X_H(blocks abs_XX ss ii ff) +GR_EXPAND_X_H(blocks add_XX ss ii cc) +GR_EXPAND_X_H(blocks add_const_XX bb ss ii ff cc) +GR_EXPAND_X_H(blocks add_const_vXX bb ss ii ff cc) +GR_EXPAND_X_H(blocks and_XX bb ss ii) +GR_EXPAND_X_H(blocks and_const_XX bb ss ii) +GR_EXPAND_X_H(blocks argmax_XX fs is ss) +GR_EXPAND_X_H(blocks divide_XX ss ii ff cc) +GR_EXPAND_X_H(blocks integrate_XX ss ii ff cc) +GR_EXPAND_X_H(blocks max_XX ff ii ss) +GR_EXPAND_X_H(blocks moving_average_XX ss ii ff cc) +GR_EXPAND_X_H(blocks multiply_XX ss ii) +GR_EXPAND_X_H(blocks multiply_const_XX ss ii) +GR_EXPAND_X_H(blocks multiply_const_vXX ss ii ff cc) +GR_EXPAND_X_H(blocks multiply_matrix_XX ff cc) +GR_EXPAND_X_H(blocks mute_XX ss ii ff cc) +GR_EXPAND_X_H(blocks not_XX bb ss ii) +GR_EXPAND_X_H(blocks or_XX bb ss ii) +GR_EXPAND_X_H(blocks peak_detector_XX fb ib sb) +GR_EXPAND_X_H(blocks probe_signal_X b s i f c) +GR_EXPAND_X_H(blocks probe_signal_vX b s i f c) +GR_EXPAND_X_H(blocks sample_and_hold_XX bb ss ii ff) +GR_EXPAND_X_H(blocks sub_XX ss ii ff cc) +GR_EXPAND_X_H(blocks tsb_vector_sink_X b s i f c) +GR_EXPAND_X_H(blocks xor_XX bb ss ii) +GR_EXPAND_X_H(blocks packed_to_unpacked_XX bb ss ii) +GR_EXPAND_X_H(blocks unpacked_to_packed_XX bb ss ii) +GR_EXPAND_X_H(blocks vector_insert_X b s i f c) +GR_EXPAND_X_H(blocks vector_sink_X b s i f c) +GR_EXPAND_X_H(blocks vector_source_X b s i f c) add_custom_target(blocks_generated_includes DEPENDS ${generated_includes} diff --git a/gr-blocks/lib/CMakeLists.txt b/gr-blocks/lib/CMakeLists.txt index 03b7573bc5..b3892ce64e 100644 --- a/gr-blocks/lib/CMakeLists.txt +++ b/gr-blocks/lib/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright 2012-2013 Free Software Foundation, Inc. +# Copyright 2012-2014 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -23,102 +23,38 @@ include(${CMAKE_CURRENT_SOURCE_DIR}/ConfigChecks.cmake) ######################################################################## -# 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_dict(name, sig, 'blocks') - build_utils.expand_template(d, inp, '_impl') -") - -macro(expand_cc_h_impl root) - #make a list of all the generated files - unset(expanded_files_cc_impl) - unset(expanded_files_h_impl) - foreach(sig ${ARGN}) - string(REGEX REPLACE "X+" ${sig} name ${root}) - list(APPEND expanded_files_cc_impl ${CMAKE_CURRENT_BINARY_DIR}/${name}_impl.cc) - list(APPEND expanded_files_h_impl ${CMAKE_CURRENT_BINARY_DIR}/${name}_impl.h) - list(APPEND expanded_files_h ${CMAKE_CURRENT_BINARY_DIR}/../include/${name}.h) - endforeach(sig) - - #create a command to generate the _impl.cc files - add_custom_command( - OUTPUT ${expanded_files_cc_impl} - DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${root}_impl.cc.t - COMMAND ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B} - ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py - ${root} ${root}_impl.cc.t ${ARGN} - ) - - #create a command to generate the _impl.h files - add_custom_command( - OUTPUT ${expanded_files_h_impl} - DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${root}_impl.h.t - COMMAND ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B} - ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py - ${root} ${root}_impl.h.t ${ARGN} - ) - - #make _impl.cc source files depend on headers to force generation - set_source_files_properties(${expanded_files_cc_impl} - PROPERTIES OBJECT_DEPENDS "${expanded_files_h_impl}" - ) - - #make _impl.h source files depend on headers to force generation - set_source_files_properties(${expanded_files_h_impl} - PROPERTIES OBJECT_DEPENDS "${expanded_files_h}" - ) - - #install rules for the generated cc files - list(APPEND generated_sources ${expanded_files_cc_impl}) -endmacro(expand_cc_h_impl) - -######################################################################## # Invoke macro to generate various sources ######################################################################## -expand_cc_h_impl(abs_XX ss ii ff) -expand_cc_h_impl(add_XX ss ii cc) -expand_cc_h_impl(add_const_XX bb ss ii ff cc) -expand_cc_h_impl(add_const_vXX bb ss ii ff cc) -expand_cc_h_impl(and_XX bb ss ii) -expand_cc_h_impl(and_const_XX bb ss ii) -expand_cc_h_impl(argmax_XX fs is ss) -expand_cc_h_impl(divide_XX ss ii ff cc) -expand_cc_h_impl(integrate_XX ss ii ff cc) -expand_cc_h_impl(max_XX ff ii ss) -expand_cc_h_impl(moving_average_XX ss ii ff cc) -expand_cc_h_impl(multiply_XX ss ii) -expand_cc_h_impl(multiply_const_XX ss ii) -expand_cc_h_impl(multiply_const_vXX ss ii ff cc) -expand_cc_h_impl(mute_XX ss ii ff cc) -expand_cc_h_impl(not_XX bb ss ii) -expand_cc_h_impl(or_XX bb ss ii) -expand_cc_h_impl(peak_detector_XX fb ib sb) -expand_cc_h_impl(probe_signal_X b s i f c) -expand_cc_h_impl(probe_signal_vX b s i f c) -expand_cc_h_impl(sample_and_hold_XX bb ss ii ff) -expand_cc_h_impl(tsb_vector_sink_X b s i f c) -expand_cc_h_impl(sub_XX ss ii ff cc) -expand_cc_h_impl(xor_XX bb ss ii) -expand_cc_h_impl(packed_to_unpacked_XX bb ss ii) -expand_cc_h_impl(unpacked_to_packed_XX bb ss ii) -expand_cc_h_impl(vector_insert_X b s i f c) -expand_cc_h_impl(vector_sink_X b s i f c) -expand_cc_h_impl(vector_source_X b s i f c) +include(GrMiscUtils) +GR_EXPAND_X_CC_H_IMPL(blocks abs_XX ss ii ff) +GR_EXPAND_X_CC_H_IMPL(blocks add_XX ss ii cc) +GR_EXPAND_X_CC_H_IMPL(blocks add_const_XX bb ss ii ff cc) +GR_EXPAND_X_CC_H_IMPL(blocks add_const_vXX bb ss ii ff cc) +GR_EXPAND_X_CC_H_IMPL(blocks and_XX bb ss ii) +GR_EXPAND_X_CC_H_IMPL(blocks and_const_XX bb ss ii) +GR_EXPAND_X_CC_H_IMPL(blocks argmax_XX fs is ss) +GR_EXPAND_X_CC_H_IMPL(blocks divide_XX ss ii ff cc) +GR_EXPAND_X_CC_H_IMPL(blocks integrate_XX ss ii ff cc) +GR_EXPAND_X_CC_H_IMPL(blocks max_XX ff ii ss) +GR_EXPAND_X_CC_H_IMPL(blocks moving_average_XX ss ii ff cc) +GR_EXPAND_X_CC_H_IMPL(blocks multiply_XX ss ii) +GR_EXPAND_X_CC_H_IMPL(blocks multiply_const_XX ss ii) +GR_EXPAND_X_CC_H_IMPL(blocks multiply_const_vXX ss ii ff cc) +GR_EXPAND_X_CC_H_IMPL(blocks mute_XX ss ii ff cc) +GR_EXPAND_X_CC_H_IMPL(blocks not_XX bb ss ii) +GR_EXPAND_X_CC_H_IMPL(blocks or_XX bb ss ii) +GR_EXPAND_X_CC_H_IMPL(blocks peak_detector_XX fb ib sb) +GR_EXPAND_X_CC_H_IMPL(blocks probe_signal_X b s i f c) +GR_EXPAND_X_CC_H_IMPL(blocks probe_signal_vX b s i f c) +GR_EXPAND_X_CC_H_IMPL(blocks sample_and_hold_XX bb ss ii ff) +GR_EXPAND_X_CC_H_IMPL(blocks sub_XX ss ii ff cc) +GR_EXPAND_X_CC_H_IMPL(blocks tsb_vector_sink_X b s i f c) +GR_EXPAND_X_CC_H_IMPL(blocks xor_XX bb ss ii) +GR_EXPAND_X_CC_H_IMPL(blocks packed_to_unpacked_XX bb ss ii) +GR_EXPAND_X_CC_H_IMPL(blocks unpacked_to_packed_XX bb ss ii) +GR_EXPAND_X_CC_H_IMPL(blocks vector_insert_X b s i f c) +GR_EXPAND_X_CC_H_IMPL(blocks vector_sink_X b s i f c) +GR_EXPAND_X_CC_H_IMPL(blocks vector_source_X b s i f c) ######################################################################## # Setup the include and linker paths diff --git a/gr-digital/include/gnuradio/digital/CMakeLists.txt b/gr-digital/include/gnuradio/digital/CMakeLists.txt index 0d958e867f..c39b12bed2 100644 --- a/gr-digital/include/gnuradio/digital/CMakeLists.txt +++ b/gr-digital/include/gnuradio/digital/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright 2011-2013 Free Software Foundation, Inc. +# Copyright 2011-2014 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -18,53 +18,10 @@ # 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, 'digital') - 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(chunks_to_symbols_XX bf bc sf sc if ic) +include(GrMiscUtils) +GR_EXPAND_X_H(digital chunks_to_symbols_XX bf bc sf sc if ic) add_custom_target(digital_generated_includes DEPENDS ${generated_includes} diff --git a/gr-digital/lib/CMakeLists.txt b/gr-digital/lib/CMakeLists.txt index a59120e48a..f9830fbbf2 100644 --- a/gr-digital/lib/CMakeLists.txt +++ b/gr-digital/lib/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright 2011-2013 Free Software Foundation, Inc. +# Copyright 2011-2014 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -42,70 +42,10 @@ if(ENABLE_GR_CTRLPORT) endif(ENABLE_GR_CTRLPORT) ######################################################################## -# 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_impl_dict2(name, sig, 'digital') - build_utils.expand_template(d, inp) -") - -macro(expand_cc root) - #make a list of all the generated files - unset(expanded_files_cc) - unset(expanded_files_h) - foreach(sig ${ARGN}) - string(REGEX REPLACE "X+" ${sig} name ${root}) - list(APPEND expanded_files_cc ${CMAKE_CURRENT_BINARY_DIR}/${name}.cc) - list(APPEND expanded_files_h ${CMAKE_CURRENT_BINARY_DIR}/${name}.h) - endforeach(sig) - - #create a command to generate the source files - add_custom_command( - OUTPUT ${expanded_files_cc} - DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${root}.cc.t - COMMAND ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B} - ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py - ${root} ${root}.cc.t ${ARGN} - ) - - #create a command to generate the header file - 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} - ) - - #make source files depends on headers to force generation - set_source_files_properties(${expanded_files_cc} - PROPERTIES OBJECT_DEPENDS "${expanded_files_h}" - ) - - #install rules for the generated cc files - list(APPEND generated_sources ${expanded_files_cc}) - list(APPEND generated_headers ${expanded_files_h}) -endmacro(expand_cc) - - -######################################################################## # Invoke macro to generate various sources ######################################################################## -expand_cc(chunks_to_symbols_XX_impl bf bc sf sc if ic) +include(GrMiscUtils) +GR_EXPAND_X_CC_H(digital chunks_to_symbols_XX_impl bf bc sf sc if ic) ######################################################################## # Setup library @@ -202,7 +142,6 @@ list(APPEND digital_libs ${LOG4CPP_LIBRARIES} ) - add_library(gnuradio-digital SHARED ${digital_sources}) target_link_libraries(gnuradio-digital ${digital_libs}) GR_LIBRARY_FOO(gnuradio-digital RUNTIME_COMPONENT "digital_runtime" DEVEL_COMPONENT "digital_devel") diff --git a/gr-fec/include/gnuradio/fec/CMakeLists.txt b/gr-fec/include/gnuradio/fec/CMakeLists.txt index a91a68a996..63bc32ced9 100644 --- a/gr-fec/include/gnuradio/fec/CMakeLists.txt +++ b/gr-fec/include/gnuradio/fec/CMakeLists.txt @@ -18,63 +18,9 @@ # 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_dict(name, sig, 'fec') - 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 -######################################################################## -#expand_h(foo_XX ss ii cc) - -add_custom_target(fec_generated_includes DEPENDS - ${generated_includes} -) - -######################################################################## # Install header files ######################################################################## install(FILES - ${generated_includes} api.h generic_decoder.h generic_encoder.h diff --git a/gr-filter/include/gnuradio/filter/CMakeLists.txt b/gr-filter/include/gnuradio/filter/CMakeLists.txt index b5cc432c6a..e75f02b7a2 100644 --- a/gr-filter/include/gnuradio/filter/CMakeLists.txt +++ b/gr-filter/include/gnuradio/filter/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright 2012 Free Software Foundation, Inc. +# Copyright 2012,2014 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -18,56 +18,13 @@ # 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, 'filter') - 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(fir_filter_XXX ccc ccf fcc fff fsf scc) -expand_h(freq_xlating_fir_filter_XXX ccc ccf fcc fcf scf scc) -expand_h(interp_fir_filter_XXX ccc ccf fcc fff fsf scc) -expand_h(rational_resampler_base_XXX ccc ccf fcc fff fsf scc) +include(GrMiscUtils) +GR_EXPAND_X_H(filter fir_filter_XXX ccc ccf fcc fff fsf scc) +GR_EXPAND_X_H(filter freq_xlating_fir_filter_XXX ccc ccf fcc fcf scf scc) +GR_EXPAND_X_H(filter interp_fir_filter_XXX ccc ccf fcc fff fsf scc) +GR_EXPAND_X_H(filter rational_resampler_base_XXX ccc ccf fcc fff fsf scc) add_custom_target(filter_generated_includes DEPENDS ${generated_includes} diff --git a/gr-filter/lib/CMakeLists.txt b/gr-filter/lib/CMakeLists.txt index 75e403267b..5505f514a5 100644 --- a/gr-filter/lib/CMakeLists.txt +++ b/gr-filter/lib/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright 2012-2013 Free Software Foundation, Inc. +# Copyright 2012-2014 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -18,73 +18,13 @@ # Boston, MA 02110-1301, USA. ######################################################################## -# generate helper scripts to expand templated files +# Invoke macro to generate various sources and headers ######################################################################## -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_impl_dict2(name, sig, 'filter') - build_utils.expand_template(d, inp) -") - -macro(expand_cc root) - #make a list of all the generated files - unset(expanded_files_cc) - unset(expanded_files_h) - foreach(sig ${ARGN}) - string(REGEX REPLACE "X+" ${sig} name ${root}) - list(APPEND expanded_files_cc ${CMAKE_CURRENT_BINARY_DIR}/${name}.cc) - list(APPEND expanded_files_h ${CMAKE_CURRENT_BINARY_DIR}/${name}.h) - endforeach(sig) - - #create a command to generate the source files - add_custom_command( - OUTPUT ${expanded_files_cc} - DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${root}.cc.t - COMMAND ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B} - ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py - ${root} ${root}.cc.t ${ARGN} - ) - - #create a command to generate the header file - 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} - ) - - #make source files depends on headers to force generation - set_source_files_properties(${expanded_files_cc} - PROPERTIES OBJECT_DEPENDS "${expanded_files_h}" - ) - - #install rules for the generated cc files - list(APPEND generated_sources ${expanded_files_cc}) - list(APPEND generated_headers ${expanded_files_h}) -endmacro(expand_cc) - -######################################################################## -# Invoke macro to generate various sources -######################################################################## -expand_cc(fir_filter_XXX_impl ccc ccf fcc fff fsf scc) -expand_cc(freq_xlating_fir_filter_XXX_impl ccc ccf fcc fcf scf scc) -expand_cc(interp_fir_filter_XXX_impl ccc ccf fcc fff fsf scc) -expand_cc(rational_resampler_base_XXX_impl ccc ccf fcc fff fsf scc) - +include(GrMiscUtils) +GR_EXPAND_X_CC_H(filter fir_filter_XXX_impl ccc ccf fcc fff fsf scc) +GR_EXPAND_X_CC_H(filter freq_xlating_fir_filter_XXX_impl ccc ccf fcc fcf scf scc) +GR_EXPAND_X_CC_H(filter interp_fir_filter_XXX_impl ccc ccf fcc fff fsf scc) +GR_EXPAND_X_CC_H(filter rational_resampler_base_XXX_impl ccc ccf fcc fff fsf scc) ######################################################################## # Setup the include and linker paths diff --git a/gr-trellis/include/gnuradio/trellis/CMakeLists.txt b/gr-trellis/include/gnuradio/trellis/CMakeLists.txt index 5f30cc8e4e..ef60ce7370 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,2014 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 +# Invoke macro to generate various headers ######################################################################## -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 -####################################################################### -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} diff --git a/gr-trellis/lib/CMakeLists.txt b/gr-trellis/lib/CMakeLists.txt index 0bb400b40c..2dfc7019dc 100644 --- a/gr-trellis/lib/CMakeLists.txt +++ b/gr-trellis/lib/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright 2012 Free Software Foundation, Inc. +# Copyright 2012,2014 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -38,78 +38,19 @@ if(ENABLE_GR_CTRLPORT) endif(ENABLE_GR_CTRLPORT) ####################################################################### -# generate the python helper script which calls into the build utils +# Invoke macro to generate various sources and headers ######################################################################## -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_impl_dict2(name, sig, 'trellis') - build_utils.expand_template(d, inp) -") - -macro(expand_cc root) - #make a list of all the generated files - unset(expanded_files_cc) - unset(expanded_files_h) - foreach(sig ${ARGN}) - string(REGEX REPLACE "X+" ${sig} name ${root}) - list(APPEND expanded_files_cc ${CMAKE_CURRENT_BINARY_DIR}/${name}.cc) - list(APPEND expanded_files_h ${CMAKE_CURRENT_BINARY_DIR}/${name}.h) - endforeach(sig) - - #create a command to generate the source files - add_custom_command( - OUTPUT ${expanded_files_cc} - DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${root}.cc.t - COMMAND ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B} - ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py - ${root} ${root}.cc.t ${ARGN} - ) - - #create a command to generate the header file - 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} - ) - - #make source files depends on headers to force generation - set_source_files_properties(${expanded_files_cc} - PROPERTIES OBJECT_DEPENDS "${expanded_files_h}" - ) - - #install rules for the generated cc files - list(APPEND generated_sources ${expanded_files_cc}) - list(APPEND generated_headers ${expanded_files_h}) -endmacro(expand_cc) - -######################################################################## -# Invoke macro to generate various sources -######################################################################## -expand_cc(encoder_XX_impl bb bs bi ss si ii) -expand_cc(sccc_encoder_XX_impl bb bs bi ss si ii) -expand_cc(pccc_encoder_XX_impl bb bs bi ss si ii) -expand_cc(metrics_X_impl s i f c) -expand_cc(viterbi_X_impl b s i) -expand_cc(viterbi_combined_XX_impl sb ss si ib is ii fb fs fi cb cs ci) -expand_cc(sccc_decoder_X_impl b s i) -expand_cc(sccc_decoder_combined_XX_impl fb fs fi cb cs ci) -expand_cc(pccc_decoder_X_impl b s i) -expand_cc(pccc_decoder_combined_XX_impl fb fs fi cb cs ci) +include(GrMiscUtils) +GR_EXPAND_X_CC_H(trellis encoder_XX_impl bb bs bi ss si ii) +GR_EXPAND_X_CC_H(trellis sccc_encoder_XX_impl bb bs bi ss si ii) +GR_EXPAND_X_CC_H(trellis pccc_encoder_XX_impl bb bs bi ss si ii) +GR_EXPAND_X_CC_H(trellis metrics_X_impl s i f c) +GR_EXPAND_X_CC_H(trellis viterbi_X_impl b s i) +GR_EXPAND_X_CC_H(trellis viterbi_combined_XX_impl sb ss si ib is ii fb fs fi cb cs ci) +GR_EXPAND_X_CC_H(trellis sccc_decoder_X_impl b s i) +GR_EXPAND_X_CC_H(trellis sccc_decoder_combined_XX_impl fb fs fi cb cs ci) +GR_EXPAND_X_CC_H(trellis pccc_decoder_X_impl b s i) +GR_EXPAND_X_CC_H(trellis pccc_decoder_combined_XX_impl fb fs fi cb cs ci) ######################################################################## # Setup library |