Skip to content

Commit

Permalink
update cmake modules
Browse files Browse the repository at this point in the history
  • Loading branch information
bastibl committed Oct 6, 2016
1 parent 40fd809 commit 2f5e196
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 69 deletions.
2 changes: 0 additions & 2 deletions CMakeLists.txt
Expand Up @@ -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
########################################################################
Expand Down
58 changes: 7 additions & 51 deletions cmake/Modules/GrMiscUtils.cmake
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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.
#
Expand Down Expand Up @@ -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}')
Expand Down Expand Up @@ -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}')
Expand Down Expand Up @@ -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}')
Expand Down
4 changes: 1 addition & 3 deletions cmake/Modules/GrPython.cmake
Expand Up @@ -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)
Expand Down Expand Up @@ -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}
)

####################################################################
Expand Down Expand Up @@ -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)

Expand Down
5 changes: 1 addition & 4 deletions cmake/Modules/GrSwig.cmake
Expand Up @@ -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(
Expand Down
12 changes: 3 additions & 9 deletions python/CMakeLists.txt
Expand Up @@ -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)

0 comments on commit 2f5e196

Please sign in to comment.