build: CMake updates
- Update the GrXXX modules from the GNURadio counter parts - Remove the included FindGnuradio and rely on the installed one (force 3.7.3 since previous ones are broken) Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
This commit is contained in:
parent
4cdda60189
commit
44ab02f671
|
@ -124,14 +124,14 @@ include_directories(
|
||||||
${Boost_INCLUDE_DIRS}
|
${Boost_INCLUDE_DIRS}
|
||||||
${FFTW3F_INCLUDE_DIRS}
|
${FFTW3F_INCLUDE_DIRS}
|
||||||
${LIBOSMODSP_INCLUDE_DIRS}
|
${LIBOSMODSP_INCLUDE_DIRS}
|
||||||
${GNURADIO_RUNTIME_INCLUDE_DIRS}
|
${GNURADIO_ALL_INCLUDE_DIRS}
|
||||||
)
|
)
|
||||||
|
|
||||||
link_directories(
|
link_directories(
|
||||||
${Boost_LIBRARY_DIRS}
|
${Boost_LIBRARY_DIRS}
|
||||||
${FFTW3F_LIBRARY_DIRS}
|
${FFTW3F_LIBRARY_DIRS}
|
||||||
${LIBOSMODSP_LIBRARY_DIRS}
|
${LIBOSMODSP_LIBRARY_DIRS}
|
||||||
${GNURADIO_RUNTIME_LIBRARY_DIRS}
|
${GNURADIO_ALL_LIBRARY_DIRS}
|
||||||
)
|
)
|
||||||
|
|
||||||
# Set component parameters
|
# Set component parameters
|
||||||
|
|
|
@ -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
|
# This file is part of GNU Radio
|
||||||
#
|
#
|
||||||
|
@ -345,3 +345,175 @@ set(CMAKE_REQUIRED_LIBRARIES -lpthread)
|
||||||
GR_ADD_COND_DEF(HAVE_SCHED_SETSCHEDULER)
|
GR_ADD_COND_DEF(HAVE_SCHED_SETSCHEDULER)
|
||||||
endmacro(GR_CHECK_LINUX_SCHED_AVAIL)
|
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)
|
||||||
|
|
|
@ -40,7 +40,7 @@ else(PYTHON_EXECUTABLE)
|
||||||
|
|
||||||
#and if that fails use the find program routine
|
#and if that fails use the find program routine
|
||||||
if(NOT PYTHONINTERP_FOUND)
|
if(NOT PYTHONINTERP_FOUND)
|
||||||
find_program(PYTHON_EXECUTABLE NAMES python python2.7 python2.6 python2.5)
|
find_program(PYTHON_EXECUTABLE NAMES python python2 python2.7 python2.6 python2.5)
|
||||||
if(PYTHON_EXECUTABLE)
|
if(PYTHON_EXECUTABLE)
|
||||||
set(PYTHONINTERP_FOUND TRUE)
|
set(PYTHONINTERP_FOUND TRUE)
|
||||||
endif(PYTHON_EXECUTABLE)
|
endif(PYTHON_EXECUTABLE)
|
||||||
|
@ -48,8 +48,15 @@ else(PYTHON_EXECUTABLE)
|
||||||
|
|
||||||
endif(PYTHON_EXECUTABLE)
|
endif(PYTHON_EXECUTABLE)
|
||||||
|
|
||||||
|
if (CMAKE_CROSSCOMPILING)
|
||||||
|
set(QA_PYTHON_EXECUTABLE "/usr/bin/python")
|
||||||
|
else (CMAKE_CROSSCOMPILING)
|
||||||
|
set(QA_PYTHON_EXECUTABLE ${PYTHON_EXECUTABLE})
|
||||||
|
endif(CMAKE_CROSSCOMPILING)
|
||||||
|
|
||||||
#make the path to the executable appear in the cmake gui
|
#make the path to the executable appear in the cmake gui
|
||||||
set(PYTHON_EXECUTABLE ${PYTHON_EXECUTABLE} CACHE FILEPATH "python interpreter")
|
set(PYTHON_EXECUTABLE ${PYTHON_EXECUTABLE} CACHE FILEPATH "python interpreter")
|
||||||
|
set(QA_PYTHON_EXECUTABLE ${QA_PYTHON_EXECUTABLE} CACHE FILEPATH "python interpreter for QA tests")
|
||||||
|
|
||||||
#make sure we can use -B with python (introduced in 2.6)
|
#make sure we can use -B with python (introduced in 2.6)
|
||||||
if(PYTHON_EXECUTABLE)
|
if(PYTHON_EXECUTABLE)
|
||||||
|
@ -185,7 +192,7 @@ function(GR_PYTHON_INSTALL)
|
||||||
file(TO_NATIVE_PATH ${PYTHON_EXECUTABLE} pyexe_native)
|
file(TO_NATIVE_PATH ${PYTHON_EXECUTABLE} pyexe_native)
|
||||||
|
|
||||||
if (CMAKE_CROSSCOMPILING)
|
if (CMAKE_CROSSCOMPILING)
|
||||||
set(pyexe_native /usr/bin/env python)
|
set(pyexe_native "/usr/bin/env python")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
foreach(pyfile ${GR_PYTHON_INSTALL_PROGRAMS})
|
foreach(pyfile ${GR_PYTHON_INSTALL_PROGRAMS})
|
||||||
|
@ -200,8 +207,9 @@ function(GR_PYTHON_INSTALL)
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
OUTPUT ${pyexefile} DEPENDS ${pyfile}
|
OUTPUT ${pyexefile} DEPENDS ${pyfile}
|
||||||
COMMAND ${PYTHON_EXECUTABLE} -c
|
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}"
|
COMMENT "Shebangin ${pyfile_name}"
|
||||||
|
VERBATIM
|
||||||
)
|
)
|
||||||
|
|
||||||
#on windows, python files need an extension to execute
|
#on windows, python files need an extension to execute
|
||||||
|
|
|
@ -30,6 +30,7 @@ set(__INCLUDED_GR_TEST_CMAKE TRUE)
|
||||||
# GR_TEST_TARGET_DEPS - built targets for the library path
|
# GR_TEST_TARGET_DEPS - built targets for the library path
|
||||||
# GR_TEST_LIBRARY_DIRS - directories for the library path
|
# GR_TEST_LIBRARY_DIRS - directories for the library path
|
||||||
# GR_TEST_PYTHON_DIRS - directories for the python path
|
# GR_TEST_PYTHON_DIRS - directories for the python path
|
||||||
|
# GR_TEST_ENVIRONS - other environment key/value pairs
|
||||||
########################################################################
|
########################################################################
|
||||||
function(GR_ADD_TEST test_name)
|
function(GR_ADD_TEST test_name)
|
||||||
|
|
||||||
|
@ -65,7 +66,8 @@ 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_LIBRARY_DIRS}" libpath) #ok to use on dir list?
|
||||||
file(TO_NATIVE_PATH "${GR_TEST_PYTHON_DIRS}" pypath) #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
|
#http://www.cmake.org/pipermail/cmake/2009-May/029464.html
|
||||||
#Replaced this add test + set environs code with the shell script generation.
|
#Replaced this add test + set environs code with the shell script generation.
|
||||||
|
@ -89,7 +91,11 @@ function(GR_ADD_TEST test_name)
|
||||||
list(APPEND environs "PATH=${binpath}" "${LD_PATH_VAR}=${libpath}" "PYTHONPATH=${pypath}")
|
list(APPEND environs "PATH=${binpath}" "${LD_PATH_VAR}=${libpath}" "PYTHONPATH=${pypath}")
|
||||||
|
|
||||||
#generate a bat file that sets the environment and runs the test
|
#generate a bat file that sets the environment and runs the test
|
||||||
find_program(SHELL sh)
|
if (CMAKE_CROSSCOMPILING)
|
||||||
|
set(SHELL "/bin/sh")
|
||||||
|
else(CMAKE_CROSSCOMPILING)
|
||||||
|
find_program(SHELL sh)
|
||||||
|
endif(CMAKE_CROSSCOMPILING)
|
||||||
set(sh_file ${CMAKE_CURRENT_BINARY_DIR}/${test_name}_test.sh)
|
set(sh_file ${CMAKE_CURRENT_BINARY_DIR}/${test_name}_test.sh)
|
||||||
file(WRITE ${sh_file} "#!${SHELL}\n")
|
file(WRITE ${sh_file} "#!${SHELL}\n")
|
||||||
#each line sets an environment variable
|
#each line sets an environment variable
|
||||||
|
|
|
@ -29,7 +29,7 @@ list(APPEND iqbalance_sources
|
||||||
)
|
)
|
||||||
|
|
||||||
add_library(gnuradio-iqbalance SHARED ${iqbalance_sources} ${LIBOSMODSP_SOURCES})
|
add_library(gnuradio-iqbalance SHARED ${iqbalance_sources} ${LIBOSMODSP_SOURCES})
|
||||||
target_link_libraries(gnuradio-iqbalance ${Boost_LIBRARIES} ${GNURADIO_RUNTIME_LIBRARIES} ${LIBOSMODSP_LIBRARIES})
|
target_link_libraries(gnuradio-iqbalance ${Boost_LIBRARIES} ${GNURADIO_ALL_LIBRARIES} ${LIBOSMODSP_LIBRARIES})
|
||||||
set_target_properties(gnuradio-iqbalance PROPERTIES DEFINE_SYMBOL "gnuradio_iqbalance_EXPORTS")
|
set_target_properties(gnuradio-iqbalance PROPERTIES DEFINE_SYMBOL "gnuradio_iqbalance_EXPORTS")
|
||||||
|
|
||||||
########################################################################
|
########################################################################
|
||||||
|
|
Loading…
Reference in New Issue