aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDimitri Stolnikov <horiz0n@gmx.net>2014-08-26 00:09:15 +0200
committerDimitri Stolnikov <horiz0n@gmx.net>2014-08-26 00:09:15 +0200
commit16cd02de84ca1c0c294c90049b78be2bad182feb (patch)
tree866cddb3ad5721d9be4a245f84aba6425e72ed3d
parentab582493dd41943bd3db81dee12f85600139d1a8 (diff)
cmake: update from gnuradio master
- Update the GrXXX modules from the GNURadio master - Force 3.7.3 since previous FindGnuradio was broken
-rw-r--r--CMakeLists.txt10
-rw-r--r--cmake/Modules/GrMiscUtils.cmake174
-rw-r--r--cmake/Modules/GrPython.cmake5
-rw-r--r--cmake/Modules/GrTest.cmake2
-rw-r--r--lib/CMakeLists.txt4
-rw-r--r--lib/file/CMakeLists.txt2
-rw-r--r--lib/rtl_tcp/CMakeLists.txt2
-rw-r--r--swig/CMakeLists.txt6
8 files changed, 184 insertions, 21 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index edf87ab..87b51d2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -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
diff --git a/cmake/Modules/GrMiscUtils.cmake b/cmake/Modules/GrMiscUtils.cmake
index 3d9a5f5..747eb1a 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/cmake/Modules/GrPython.cmake b/cmake/Modules/GrPython.cmake
index d0d7886..395faff 100644
--- a/cmake/Modules/GrPython.cmake
+++ b/cmake/Modules/GrPython.cmake
@@ -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
diff --git a/cmake/Modules/GrTest.cmake b/cmake/Modules/GrTest.cmake
index 7b64204..62caab4 100644
--- a/cmake/Modules/GrTest.cmake
+++ b/cmake/Modules/GrTest.cmake
@@ -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
diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt
index cee66bf..00906f3 100644
--- a/lib/CMakeLists.txt
+++ b/lib/CMakeLists.txt
@@ -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}
)
########################################################################
diff --git a/lib/file/CMakeLists.txt b/lib/file/CMakeLists.txt
index 917b423..68ba004 100644
--- a/lib/file/CMakeLists.txt
+++ b/lib/file/CMakeLists.txt
@@ -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})
diff --git a/lib/rtl_tcp/CMakeLists.txt b/lib/rtl_tcp/CMakeLists.txt
index 54eed08..18400fd 100644
--- a/lib/rtl_tcp/CMakeLists.txt
+++ b/lib/rtl_tcp/CMakeLists.txt
@@ -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})
diff --git a/swig/CMakeLists.txt b/swig/CMakeLists.txt
index c520ff2..3949322 100644
--- a/swig/CMakeLists.txt
+++ b/swig/CMakeLists.txt
@@ -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)