Statistics
| Branch: | Tag: | Revision:

root / gr-filter / lib / CMakeLists.txt @ 056d3006

History | View | Annotate | Download (5.8 kB)

1
# Copyright 2012 Free Software Foundation, Inc.
2
#
3
# This file is part of GNU Radio
4
#
5
# GNU Radio is free software; you can redistribute it and/or modify
6
# it under the terms of the GNU General Public License as published by
7
# the Free Software Foundation; either version 3, or (at your option)
8
# any later version.
9
#
10
# GNU Radio is distributed in the hope that it will be useful,
11
# but WITHOUT ANY WARRANTY; without even the implied warranty of
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
# GNU General Public License for more details.
14
#
15
# You should have received a copy of the GNU General Public License
16
# along with GNU Radio; see the file COPYING.  If not, write to
17
# the Free Software Foundation, Inc., 51 Franklin Street,
18
# Boston, MA 02110-1301, USA.
19
20
########################################################################
21
# generate helper scripts to expand templated files
22
########################################################################
23
include(GrPython)
24
25
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py "
26
#!${PYTHON_EXECUTABLE}
27
28
import sys, os, re
29
sys.path.append('${GR_CORE_PYTHONPATH}')
30
os.environ['srcdir'] = '${CMAKE_CURRENT_SOURCE_DIR}'
31
os.chdir('${CMAKE_CURRENT_BINARY_DIR}')
32
33
if __name__ == '__main__':
34
    import build_utils
35
    root, inp = sys.argv[1:3]
36
    for sig in sys.argv[3:]:
37
        name = re.sub ('X+', sig, root)
38
        d = build_utils.standard_impl_dict2(name, sig, 'filter')
39
        build_utils.expand_template(d, inp)
40
")
41
42
macro(expand_cc root)
43
  #make a list of all the generated files
44
  unset(expanded_files_cc)
45
  unset(expanded_files_h)
46
  foreach(sig ${ARGN})
47
    string(REGEX REPLACE "X+" ${sig} name ${root})
48
    list(APPEND expanded_files_cc ${CMAKE_CURRENT_BINARY_DIR}/${name}.cc)
49
    list(APPEND expanded_files_h  ${CMAKE_CURRENT_BINARY_DIR}/${name}.h)
50
  endforeach(sig)
51
  
52
  #create a command to generate the source files
53
  add_custom_command(
54
    OUTPUT ${expanded_files_cc}
55
    DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${root}.cc.t
56
    COMMAND ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B}
57
    ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py
58
    ${root} ${root}.cc.t ${ARGN}
59
  )
60
61
  #create a command to generate the header file
62
  add_custom_command(
63
    OUTPUT ${expanded_files_h}
64
    DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${root}.h.t
65
    COMMAND ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B}
66
    ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py
67
    ${root} ${root}.h.t ${ARGN}
68
  )
69
  
70
  #make source files depends on headers to force generation
71
  set_source_files_properties(${expanded_files_cc}
72
    PROPERTIES OBJECT_DEPENDS "${expanded_files_h}"
73
  )
74
  
75
  #install rules for the generated cc files
76
  list(APPEND generated_sources ${expanded_files_cc})  
77
  list(APPEND generated_headers ${expanded_files_h})  
78
endmacro(expand_cc)
79
80
########################################################################
81
# Invoke macro to generate various sources
82
########################################################################
83
expand_cc(fir_filter_XXX_impl              ccc ccf fcc fff fsf scc)
84
expand_cc(freq_xlating_fir_filter_XXX_impl ccc ccf fcc fcf scf scc)
85
expand_cc(interp_fir_filter_XXX_impl       ccc ccf fcc fff fsf scc)
86
expand_cc(rational_resampler_base_XXX_impl ccc ccf fcc fff fsf scc)
87
88
89
########################################################################
90
# Setup the include and linker paths
91
########################################################################
92
include_directories(
93
    ${GR_FILTER_INCLUDE_DIRS}
94
    ${CMAKE_CURRENT_SOURCE_DIR}
95
    ${CMAKE_CURRENT_BINARY_DIR}
96
    ${VOLK_INCLUDE_DIRS}
97
    ${GNURADIO_CORE_INCLUDE_DIRS}
98
    ${GR_FFT_INCLUDE_DIRS}
99
    ${Boost_INCLUDE_DIRS}
100
    ${FFTW3F_INCLUDE_DIRS}
101
    ${CPPUNIT_INCLUDE_DIRS}
102
)
103
104
link_directories(${FFT_LIBRARY_DIRS})
105
link_directories(${Boost_LIBRARY_DIRS})
106
link_directories(${FFTW3F_LIBRARY_DIRS})
107
108
########################################################################
109
# Setup library
110
########################################################################
111
list(APPEND filter_sources
112
  fir_filter.cc
113
  fir_filter_with_buffer.cc
114
  fft_filter.cc
115
  firdes.cc
116
  mmse_fir_interpolator_cc.cc
117
  mmse_fir_interpolator_ff.cc
118
  pm_remez.cc
119
  polyphase_filterbank.cc
120
  ${generated_sources}
121
  adaptive_fir_ccc_impl.cc
122
  adaptive_fir_ccf_impl.cc
123
  dc_blocker_cc_impl.cc
124
  dc_blocker_ff_impl.cc
125
  filter_delay_fc_impl.cc
126
  fft_filter_ccc_impl.cc
127
  fft_filter_fff_impl.cc
128
  fractional_interpolator_cc_impl.cc
129
  fractional_interpolator_ff_impl.cc
130
  hilbert_fc_impl.cc
131
  iir_filter_ffd_impl.cc
132
  pfb_arb_resampler_ccf_impl.cc
133
  pfb_arb_resampler_fff_impl.cc
134
  pfb_channelizer_ccf_impl.cc
135
  pfb_decimator_ccf_impl.cc
136
  pfb_interpolator_ccf_impl.cc
137
  pfb_synthesizer_ccf_impl.cc
138
  single_pole_iir_filter_cc_impl.cc
139
  single_pole_iir_filter_ff_impl.cc
140
  channel_model_impl.cc
141
)
142
143
list(APPEND filter_libs
144
    gnuradio-core
145
    gnuradio-fft
146
    volk
147
    ${Boost_LIBRARIES}
148
    ${FFTW3F_LIBRARIES}
149
)
150
151
add_library(gnuradio-filter SHARED ${filter_sources})
152
target_link_libraries(gnuradio-filter ${filter_libs})
153
GR_LIBRARY_FOO(gnuradio-filter RUNTIME_COMPONENT "filter_runtime" DEVEL_COMPONENT "filter_devel")
154
add_dependencies(gnuradio-filter gnuradio-fft filter_generated_includes filter_generated_swigs)
155
156
157
########################################################################
158
# QA C++ Code for gr-filter
159
########################################################################
160
list(APPEND test_gr_filter_sources
161
    ${CMAKE_CURRENT_SOURCE_DIR}/test_gr_filter.cc
162
    ${CMAKE_CURRENT_SOURCE_DIR}/qa_filter.cc
163
    ${CMAKE_CURRENT_SOURCE_DIR}/qa_firdes.cc
164
    ${CMAKE_CURRENT_SOURCE_DIR}/qa_fir_filter_with_buffer.cc
165
    ${CMAKE_CURRENT_SOURCE_DIR}/qa_mmse_fir_interpolator_cc.cc
166
    ${CMAKE_CURRENT_SOURCE_DIR}/qa_mmse_fir_interpolator_ff.cc
167
)
168
169
add_executable(test-gr-filter ${test_gr_filter_sources})
170
target_link_libraries(
171
  test-gr-filter
172
  gnuradio-core
173
  gnuradio-filter 
174
  ${CPPUNIT_LIBRARIES}
175
  ${Boost_LIBRARIES}
176
)
177
178
GR_ADD_TEST(test_gr_filter test-gr-filter)