cmake: update from gnuradio master

- Update the GrXXX modules from the GNURadio master
- Force 3.7.3 since previous FindGnuradio was broken
This commit is contained in:
Dimitri Stolnikov 2014-08-26 00:09:15 +02:00
parent ab582493dd
commit 16cd02de84
8 changed files with 184 additions and 21 deletions

View File

@ -148,7 +148,7 @@ set(GRC_BLOCKS_DIR ${GR_PKG_DATA_DIR}/grc/blocks)
# Find build dependencies
########################################################################
set(GR_REQUIRED_COMPONENTS RUNTIME PMT BLOCKS)
find_package(Gnuradio "3.7.0")
find_package(Gnuradio 3.7.3 REQUIRED)
find_package(GnuradioIQBalance)
find_package(UHD)
find_package(GnuradioUHD)
@ -173,16 +173,12 @@ include_directories(
${CMAKE_SOURCE_DIR}/include
${CMAKE_SOURCE_DIR}/lib
${Boost_INCLUDE_DIRS}
${GNURADIO_RUNTIME_INCLUDE_DIRS}
${GNURADIO_PMT_INCLUDE_DIRS}
${GNURADIO_BLOCKS_INCLUDE_DIRS}
${GNURADIO_ALL_INCLUDE_DIRS}
)
link_directories(
${Boost_LIBRARY_DIRS}
${GNURADIO_RUNTIME_LIBRARY_DIRS}
${GNURADIO_PMT_LIBRARY_DIRS}
${GNURADIO_BLOCKS_LIBRARY_DIRS}
${GNURADIO_ALL_LIBRARY_DIRS}
)
# Set component parameters

View File

@ -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)

View File

@ -192,7 +192,7 @@ function(GR_PYTHON_INSTALL)
file(TO_NATIVE_PATH ${PYTHON_EXECUTABLE} pyexe_native)
if (CMAKE_CROSSCOMPILING)
set(pyexe_native /usr/bin/env python)
set(pyexe_native "/usr/bin/env python")
endif()
foreach(pyfile ${GR_PYTHON_INSTALL_PROGRAMS})
@ -207,8 +207,9 @@ function(GR_PYTHON_INSTALL)
add_custom_command(
OUTPUT ${pyexefile} DEPENDS ${pyfile}
COMMAND ${PYTHON_EXECUTABLE} -c
\"open('${pyexefile}', 'w').write('\#!${pyexe_native}\\n'+open('${pyfile}').read())\"
"open('${pyexefile}','w').write('\#!${pyexe_native}\\n'+open('${pyfile}').read())"
COMMENT "Shebangin ${pyfile_name}"
VERBATIM
)
#on windows, python files need an extension to execute

View File

@ -66,7 +66,7 @@ function(GR_ADD_TEST test_name)
file(TO_NATIVE_PATH "${GR_TEST_LIBRARY_DIRS}" libpath) #ok to use on dir list?
file(TO_NATIVE_PATH "${GR_TEST_PYTHON_DIRS}" pypath) #ok to use on dir list?
set(environs "GR_DONT_LOAD_PREFS=1" "srcdir=${srcdir}")
set(environs "VOLK_GENERIC=1" "GR_DONT_LOAD_PREFS=1" "srcdir=${srcdir}")
list(APPEND environs ${GR_TEST_ENVIRONS})
#http://www.cmake.org/pipermail/cmake/2009-May/029464.html

View File

@ -44,9 +44,7 @@ GR_OSMOSDR_APPEND_SRCS(
GR_OSMOSDR_APPEND_LIBS(
${Boost_LIBRARIES}
${GNURADIO_RUNTIME_LIBRARIES}
${GNURADIO_PMT_LIBRARIES}
${GNURADIO_BLOCKS_LIBRARIES}
${GNURADIO_ALL_LIBRARIES}
)
########################################################################

View File

@ -33,5 +33,5 @@ set(file_srcs
# Append gnuradio-osmosdr library sources
########################################################################
list(APPEND gr_osmosdr_srcs ${file_srcs})
list(APPEND gr_osmosdr_libs ${GNURADIO_BLOCKS_LIBRARIES})
#list(APPEND gr_osmosdr_libs ${GNURADIO_BLOCKS_LIBRARIES})

View File

@ -34,5 +34,5 @@ set(rtl_tcp_srcs
# Append gnuradio-osmosdr library sources
########################################################################
list(APPEND gr_osmosdr_srcs ${rtl_tcp_srcs})
list(APPEND gr_osmosdr_libs ${GNURADIO_BLOCKS_LIBRARIES})
#list(APPEND gr_osmosdr_libs ${GNURADIO_BLOCKS_LIBRARIES})

View File

@ -31,11 +31,7 @@ include(GrPython)
########################################################################
# Setup swig generation
########################################################################
foreach(incdir ${GNURADIO_RUNTIME_INCLUDE_DIRS})
list(APPEND GR_SWIG_INCLUDE_DIRS ${incdir}/swig)
endforeach(incdir)
foreach(incdir ${GNURADIO_RUNTIME_INCLUDE_DIRS})
foreach(incdir ${GNURADIO_ALL_INCLUDE_DIRS})
list(APPEND GR_SWIG_INCLUDE_DIRS ${incdir}/gnuradio/swig)
endforeach(incdir)