From 2f5e196081f17c89f32bfe2b49754717c5c1142a Mon Sep 17 00:00:00 2001 From: Bastian Bloessl Date: Thu, 6 Oct 2016 10:45:44 -0400 Subject: [PATCH] update cmake modules --- CMakeLists.txt | 2 -- cmake/Modules/GrMiscUtils.cmake | 58 ++++----------------------------- cmake/Modules/GrPython.cmake | 4 +-- cmake/Modules/GrSwig.cmake | 5 +-- python/CMakeLists.txt | 12 ++----- 5 files changed, 12 insertions(+), 69 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d3f47b9..ab12531 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -103,8 +103,6 @@ if(NOT VOLK_FOUND) message(FATAL_ERROR "Volk required to compile ieee802_15_4") endif() -include(GrMiscUtils) - ######################################################################## # On Apple only, set install name and use rpath correctly, if not already set ######################################################################## diff --git a/cmake/Modules/GrMiscUtils.cmake b/cmake/Modules/GrMiscUtils.cmake index 188c404..319581c 100644 --- a/cmake/Modules/GrMiscUtils.cmake +++ b/cmake/Modules/GrMiscUtils.cmake @@ -135,18 +135,14 @@ endfunction(GR_LIBTOOL) # Also handle gnuradio custom naming conventions w/ extras mode. ######################################################################## function(GR_LIBRARY_FOO target) - #parse the arguments for component names - include(CMakeParseArgumentsCopy) - CMAKE_PARSE_ARGUMENTS(GR_LIBRARY "" "RUNTIME_COMPONENT;DEVEL_COMPONENT" "" ${ARGN}) - #set additional target properties set_target_properties(${target} PROPERTIES SOVERSION ${LIBVER}) #install the generated files like so... install(TARGETS ${target} - LIBRARY DESTINATION ${GR_LIBRARY_DIR} COMPONENT ${GR_LIBRARY_RUNTIME_COMPONENT} # .so/.dylib file - ARCHIVE DESTINATION ${GR_LIBRARY_DIR} COMPONENT ${GR_LIBRARY_DEVEL_COMPONENT} # .lib file - RUNTIME DESTINATION ${GR_RUNTIME_DIR} COMPONENT ${GR_LIBRARY_RUNTIME_COMPONENT} # .dll file + LIBRARY DESTINATION ${GR_LIBRARY_DIR} # .so/.dylib file + ARCHIVE DESTINATION ${GR_LIBRARY_DIR} # .lib file + RUNTIME DESTINATION ${GR_RUNTIME_DIR} # .dll file ) #extras mode enabled automatically on linux @@ -178,7 +174,7 @@ function(GR_LIBRARY_FOO target) FILES ${CMAKE_CURRENT_BINARY_DIR}/lib${target}.so ${CMAKE_CURRENT_BINARY_DIR}/lib${target}-${LIBVER}.so.0 - DESTINATION ${GR_LIBRARY_DIR} COMPONENT ${GR_LIBRARY_RUNTIME_COMPONENT} + DESTINATION ${GR_LIBRARY_DIR} ) endif(LIBRARY_EXTRAS) @@ -215,49 +211,6 @@ function(GR_GEN_TARGET_DEPS name var) endif() endfunction(GR_GEN_TARGET_DEPS) -######################################################################## -# Control use of gr_logger -# Usage: -# GR_LOGGING() -# -# Will set ENABLE_GR_LOG to 1 by default. -# Can manually set with -DENABLE_GR_LOG=0|1 -######################################################################## -function(GR_LOGGING) - find_package(Log4cpp) - - OPTION(ENABLE_GR_LOG "Use gr_logger" ON) - if(ENABLE_GR_LOG) - # If gr_logger is enabled, make it usable - add_definitions( -DENABLE_GR_LOG ) - - # also test LOG4CPP; if we have it, use this version of the logger - # otherwise, default to the stdout/stderr model. - if(LOG4CPP_FOUND) - SET(HAVE_LOG4CPP True CACHE INTERNAL "" FORCE) - add_definitions( -DHAVE_LOG4CPP ) - else(not LOG4CPP_FOUND) - SET(HAVE_LOG4CPP False CACHE INTERNAL "" FORCE) - SET(LOG4CPP_INCLUDE_DIRS "" CACHE INTERNAL "" FORCE) - SET(LOG4CPP_LIBRARY_DIRS "" CACHE INTERNAL "" FORCE) - SET(LOG4CPP_LIBRARIES "" CACHE INTERNAL "" FORCE) - endif(LOG4CPP_FOUND) - - SET(ENABLE_GR_LOG ${ENABLE_GR_LOG} CACHE INTERNAL "" FORCE) - - else(ENABLE_GR_LOG) - SET(HAVE_LOG4CPP False CACHE INTERNAL "" FORCE) - SET(LOG4CPP_INCLUDE_DIRS "" CACHE INTERNAL "" FORCE) - SET(LOG4CPP_LIBRARY_DIRS "" CACHE INTERNAL "" FORCE) - SET(LOG4CPP_LIBRARIES "" CACHE INTERNAL "" FORCE) - endif(ENABLE_GR_LOG) - - message(STATUS "ENABLE_GR_LOG set to ${ENABLE_GR_LOG}.") - message(STATUS "HAVE_LOG4CPP set to ${HAVE_LOG4CPP}.") - message(STATUS "LOG4CPP_LIBRARIES set to ${LOG4CPP_LIBRARIES}.") - -endfunction(GR_LOGGING) - ######################################################################## # Run GRCC to compile .grc files into .py files. # @@ -363,6 +316,7 @@ macro(GR_EXPAND_X_H component root) import sys, os, re sys.path.append('${GR_RUNTIME_PYTHONPATH}') +sys.path.append('${CMAKE_SOURCE_DIR}/python') os.environ['srcdir'] = '${CMAKE_CURRENT_SOURCE_DIR}' os.chdir('${CMAKE_CURRENT_BINARY_DIR}') @@ -406,6 +360,7 @@ macro(GR_EXPAND_X_CC_H component root) import sys, os, re sys.path.append('${GR_RUNTIME_PYTHONPATH}') +sys.path.append('${CMAKE_SOURCE_DIR}/python') os.environ['srcdir'] = '${CMAKE_CURRENT_SOURCE_DIR}' os.chdir('${CMAKE_CURRENT_BINARY_DIR}') @@ -466,6 +421,7 @@ macro(GR_EXPAND_X_CC_H_IMPL component root) import sys, os, re sys.path.append('${GR_RUNTIME_PYTHONPATH}') +sys.path.append('${CMAKE_SOURCE_DIR}/python') os.environ['srcdir'] = '${CMAKE_CURRENT_SOURCE_DIR}' os.chdir('${CMAKE_CURRENT_BINARY_DIR}') diff --git a/cmake/Modules/GrPython.cmake b/cmake/Modules/GrPython.cmake index 06e061e..0bfa92d 100644 --- a/cmake/Modules/GrPython.cmake +++ b/cmake/Modules/GrPython.cmake @@ -130,7 +130,7 @@ endfunction(GR_UNIQUE_TARGET) ######################################################################## function(GR_PYTHON_INSTALL) include(CMakeParseArgumentsCopy) - CMAKE_PARSE_ARGUMENTS(GR_PYTHON_INSTALL "" "DESTINATION;COMPONENT" "FILES;PROGRAMS" ${ARGN}) + CMAKE_PARSE_ARGUMENTS(GR_PYTHON_INSTALL "" "DESTINATION" "FILES;PROGRAMS" ${ARGN}) #################################################################### if(GR_PYTHON_INSTALL_FILES) @@ -182,7 +182,6 @@ function(GR_PYTHON_INSTALL) set(python_install_gen_targets ${pycfiles} ${pyofiles}) install(FILES ${python_install_gen_targets} DESTINATION ${GR_PYTHON_INSTALL_DESTINATION} - COMPONENT ${GR_PYTHON_INSTALL_COMPONENT} ) #################################################################### @@ -219,7 +218,6 @@ function(GR_PYTHON_INSTALL) install(PROGRAMS ${pyexefile} RENAME ${pyfile_name} DESTINATION ${GR_PYTHON_INSTALL_DESTINATION} - COMPONENT ${GR_PYTHON_INSTALL_COMPONENT} ) endforeach(pyfile) diff --git a/cmake/Modules/GrSwig.cmake b/cmake/Modules/GrSwig.cmake index abf4dc4..ab8926b 100644 --- a/cmake/Modules/GrSwig.cmake +++ b/cmake/Modules/GrSwig.cmake @@ -183,24 +183,21 @@ endmacro(GR_SWIG_MAKE) # GR_SWIG_INSTALL( # TARGETS target target target... # [DESTINATION destination] -# [COMPONENT component] # ) ######################################################################## macro(GR_SWIG_INSTALL) include(CMakeParseArgumentsCopy) - CMAKE_PARSE_ARGUMENTS(GR_SWIG_INSTALL "" "DESTINATION;COMPONENT" "TARGETS" ${ARGN}) + CMAKE_PARSE_ARGUMENTS(GR_SWIG_INSTALL "" "DESTINATION" "TARGETS" ${ARGN}) foreach(name ${GR_SWIG_INSTALL_TARGETS}) install(TARGETS ${SWIG_MODULE_${name}_REAL_NAME} DESTINATION ${GR_SWIG_INSTALL_DESTINATION} - COMPONENT ${GR_SWIG_INSTALL_COMPONENT} ) include(GrPython) GR_PYTHON_INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${name}.py DESTINATION ${GR_SWIG_INSTALL_DESTINATION} - COMPONENT ${GR_SWIG_INSTALL_COMPONENT} ) GR_LIBTOOL( diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index bf6425b..3cd600d 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -38,13 +38,7 @@ GR_PYTHON_INSTALL( ##################################################################### # Handle the unit tests ##################################################################### -set(GR_TEST_LIBRARY_DIRS "") -set(GR_TEST_TARGET_DEPS gnuradio-ieee802_15_4) -set(GR_TEST_PYTHON_DIRS ${CMAKE_BINARY_DIR}/swig) - include(GrTest) -file(GLOB py_qa_test_files "qa_*.py") -foreach(py_qa_test_file ${py_qa_test_files}) - get_filename_component(py_qa_test_name ${py_qa_test_file} NAME_WE) - GR_ADD_TEST(${py_qa_test_name} ${QA_PYTHON_EXECUTABLE} ${PYTHON_DASH_B} ${py_qa_test_file}) -endforeach(py_qa_test_file) + +set(GR_TEST_TARGET_DEPS gnuradio-ieee802-15-4) +set(GR_TEST_PYTHON_DIRS ${CMAKE_BINARY_DIR}/swig)