Statistics
| Branch: | Tag: | Revision:

root / gr-filter / lib / CMakeLists.txt @ 5365daf7

History | View | Annotate | Download (5.7 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
87
88
########################################################################
89
# Setup the include and linker paths
90
########################################################################
91
include_directories(
92
    ${GR_FILTER_INCLUDE_DIRS}
93
    ${CMAKE_CURRENT_SOURCE_DIR}
94
    ${CMAKE_CURRENT_BINARY_DIR}
95
    ${VOLK_INCLUDE_DIRS}
96
    ${GNURADIO_CORE_INCLUDE_DIRS}
97
    ${GR_FFT_INCLUDE_DIRS}
98
    ${Boost_INCLUDE_DIRS}
99
    ${FFTW3F_INCLUDE_DIRS}
100
)
101
102
link_directories(${FFT_LIBRARY_DIRS})
103
link_directories(${Boost_LIBRARY_DIRS})
104
link_directories(${FFTW3F_LIBRARY_DIRS})
105
106
########################################################################
107
# Setup library
108
########################################################################
109
list(APPEND filter_sources
110
  fir_filter.cc
111
  fir_filter_with_buffer.cc
112
  fft_filter.cc
113
  firdes.cc
114
  mmse_fir_interpolator_cc.cc
115
  mmse_fir_interpolator_ff.cc
116
  pm_remez.cc
117
  polyphase_filterbank.cc
118
  ${generated_sources}
119
  adaptive_fir_ccc_impl.cc
120
  adaptive_fir_ccf_impl.cc
121
  dc_blocker_cc_impl.cc
122
  dc_blocker_ff_impl.cc
123
  filter_delay_fc_impl.cc
124
  fft_filter_ccc_impl.cc
125
  fft_filter_fff_impl.cc
126
  fractional_interpolator_cc_impl.cc
127
  fractional_interpolator_ff_impl.cc
128
  hilbert_fc_impl.cc
129
  iir_filter_ffd_impl.cc
130
  pfb_channelizer_ccf_impl.cc
131
  pfb_decimator_ccf_impl.cc
132
  pfb_interpolator_ccf_impl.cc
133
  single_pole_iir_filter_cc_impl.cc
134
  single_pole_iir_filter_ff_impl.cc
135
)
136
137
list(APPEND filter_libs
138
    gnuradio-core
139
    gnuradio-fft
140
    ${Boost_LIBRARIES}
141
    ${FFTW3F_LIBRARIES}
142
    ${VOLK_LIBRARIES}
143
)
144
145
add_library(gnuradio-filter SHARED ${filter_sources})
146
target_link_libraries(gnuradio-filter ${filter_libs})
147
GR_LIBRARY_FOO(gnuradio-filter RUNTIME_COMPONENT "filter_runtime" DEVEL_COMPONENT "filter_devel")
148
add_dependencies(gnuradio-filter gnuradio-fft filter_generated_includes filter_generated_swigs)
149
150
151
########################################################################
152
# QA C++ Code for gr-filter
153
########################################################################
154
list(APPEND test_gr_filter_sources
155
    ${CMAKE_CURRENT_SOURCE_DIR}/test_gr_filter.cc
156
    ${CMAKE_CURRENT_SOURCE_DIR}/qa_filter.cc
157
    ${CMAKE_CURRENT_SOURCE_DIR}/qa_firdes.cc
158
    ${CMAKE_CURRENT_SOURCE_DIR}/qa_fir_filter_with_buffer.cc
159
    ${CMAKE_CURRENT_SOURCE_DIR}/qa_mmse_fir_interpolator_cc.cc
160
    ${CMAKE_CURRENT_SOURCE_DIR}/qa_mmse_fir_interpolator_ff.cc
161
)
162
163
add_executable(test-gr-filter ${test_gr_filter_sources})
164
target_link_libraries(
165
  test-gr-filter
166
  gnuradio-core
167
  gnuradio-filter 
168
  ${CPPUNIT_LIBRARIES}
169
  ${Boost_LIBRARIES}
170
)
171
172
GR_ADD_TEST(test_gr_filter test-gr-filter)