summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcus Müller <marcus.mueller@ettus.com>2019-03-06 22:44:51 +0100
committerMarcus Müller <marcus.mueller@ettus.com>2019-03-06 22:44:51 +0100
commit61ebd24c4a86566e2c4cd44e8559dfd7097d4479 (patch)
tree40234d692f86faa91ebdbbd07f60091817d755ab
parentcb8c665db649619e8afbeaf4ac67a6352331eee1 (diff)
parent8a2453e61f4ba198431feaeeb9c46dd270507389 (diff)
Modern CMake
This merges Andrej Rodes efforts of porting GNU Radio to a CMake infrastructure that is more than of historical interest. It moves towards component::target syntax, cleans up dependency handling, restructures interdependencies in a few places. It addresses gr-newmod.
-rw-r--r--CMakeLists.txt62
-rw-r--r--cmake/Modules/CMakeMacroLibtoolFile.cmake61
-rw-r--r--cmake/Modules/FindALSA.cmake7
-rw-r--r--cmake/Modules/FindCodec2.cmake8
-rw-r--r--cmake/Modules/FindFFTW3f.cmake35
-rw-r--r--cmake/Modules/FindGSL.cmake20
-rw-r--r--cmake/Modules/FindGSM.cmake8
-rw-r--r--cmake/Modules/FindJACK.cmake (renamed from cmake/Modules/FindJack.cmake)11
-rw-r--r--cmake/Modules/FindLOG4CPP.cmake (renamed from cmake/Modules/FindLog4cpp.cmake)9
-rw-r--r--cmake/Modules/FindMPLIB.cmake8
-rw-r--r--cmake/Modules/FindOSS.cmake10
-rw-r--r--cmake/Modules/FindPORTAUDIO.cmake (renamed from cmake/Modules/FindPortaudio.cmake)8
-rw-r--r--cmake/Modules/FindQwt.cmake7
-rw-r--r--cmake/Modules/FindTHRIFT.cmake (renamed from cmake/Modules/FindThrift.cmake)8
-rw-r--r--cmake/Modules/FindUHD.cmake8
-rw-r--r--cmake/Modules/FindZeroMQ.cmake8
-rw-r--r--cmake/Modules/GnuradioConfig.cmake.in156
-rw-r--r--cmake/Modules/GrMiscUtils.cmake93
-rw-r--r--cmake/Modules/GrPython.cmake28
-rw-r--r--cmake/Modules/GrSwig.cmake103
-rw-r--r--cmake/Modules/GrTest.cmake1
-rw-r--r--cmake/Modules/UseSWIG.cmake815
-rw-r--r--cmake/Modules/targetConfig.cmake.in (renamed from gr-fec/apps/CMakeLists.txt)30
-rw-r--r--gnuradio-runtime/CMakeLists.txt17
-rw-r--r--gnuradio-runtime/apps/CMakeLists.txt14
-rw-r--r--gnuradio-runtime/lib/CMakeLists.txt263
-rw-r--r--gnuradio-runtime/lib/controlport/CMakeLists.txt104
-rw-r--r--gnuradio-runtime/lib/controlport/thrift/thrift.conf.example3
-rw-r--r--gnuradio-runtime/lib/math/CMakeLists.txt29
-rw-r--r--gnuradio-runtime/lib/messages/CMakeLists.txt29
-rw-r--r--gnuradio-runtime/lib/pmt/CMakeLists.txt49
-rw-r--r--gnuradio-runtime/swig/CMakeLists.txt49
-rwxr-xr-xgnuradio-runtime/swig/gen-swig-bug-fix111
-rw-r--r--gnuradio-runtime/swig/gnuradio.i6
-rw-r--r--gnuradio-runtime/swig/gnuradio_swig_bug_workaround.h44
-rw-r--r--gnuradio-runtime/swig/gr_logger.i4
-rw-r--r--gnuradio-runtime/swig/runtime_swig.i2
-rw-r--r--gr-analog/CMakeLists.txt11
-rw-r--r--gr-analog/lib/CMakeLists.txt75
-rw-r--r--gr-analog/swig/CMakeLists.txt16
-rw-r--r--gr-audio/CMakeLists.txt4
-rw-r--r--gr-audio/examples/c++/CMakeLists.txt9
-rw-r--r--gr-audio/lib/CMakeLists.txt173
-rw-r--r--gr-audio/swig/CMakeLists.txt13
-rw-r--r--gr-blocks/CMakeLists.txt8
-rw-r--r--gr-blocks/lib/CMakeLists.txt98
-rw-r--r--gr-blocks/swig/CMakeLists.txt22
-rw-r--r--gr-blocks/tests/CMakeLists.txt15
-rw-r--r--gr-channels/CMakeLists.txt5
-rw-r--r--gr-channels/lib/CMakeLists.txt87
-rw-r--r--gr-channels/swig/CMakeLists.txt14
-rw-r--r--gr-comedi/CMakeLists.txt11
-rw-r--r--gr-comedi/lib/CMakeLists.txt60
-rw-r--r--gr-comedi/swig/CMakeLists.txt14
-rw-r--r--gr-digital/CMakeLists.txt11
-rw-r--r--gr-digital/lib/CMakeLists.txt102
-rw-r--r--gr-digital/swig/CMakeLists.txt18
-rw-r--r--gr-dtv/CMakeLists.txt6
-rw-r--r--gr-dtv/lib/CMakeLists.txt44
-rw-r--r--gr-dtv/lib/dvb/dvb_ldpc_bb_impl.h12
-rw-r--r--gr-dtv/lib/dvbs2/dvbs2_interleaver_bb_impl.h12
-rw-r--r--gr-dtv/lib/dvbs2/dvbs2_modulator_bc_impl.h12
-rw-r--r--gr-dtv/lib/dvbs2/dvbs2_physical_cc_impl.h12
-rw-r--r--gr-dtv/lib/dvbt2/dvbt2_cellinterleaver_cc_impl.h12
-rw-r--r--gr-dtv/lib/dvbt2/dvbt2_framemapper_cc_impl.h12
-rw-r--r--gr-dtv/lib/dvbt2/dvbt2_freqinterleaver_cc_impl.h12
-rw-r--r--gr-dtv/lib/dvbt2/dvbt2_interleaver_bb_impl.h8
-rw-r--r--gr-dtv/lib/dvbt2/dvbt2_miso_cc_impl.h12
-rw-r--r--gr-dtv/lib/dvbt2/dvbt2_modulator_bc_impl.h12
-rw-r--r--gr-dtv/lib/dvbt2/dvbt2_p1insertion_cc_impl.h12
-rw-r--r--gr-dtv/lib/dvbt2/dvbt2_paprtr_cc_impl.h12
-rw-r--r--gr-dtv/lib/dvbt2/dvbt2_pilotgenerator_cc_impl.h12
-rw-r--r--gr-dtv/swig/CMakeLists.txt13
-rw-r--r--gr-fec/CMakeLists.txt8
-rw-r--r--gr-fec/lib/CMakeLists.txt87
-rw-r--r--gr-fec/lib/reed-solomon/CMakeLists.txt31
-rw-r--r--gr-fec/lib/viterbi/CMakeLists.txt50
-rw-r--r--gr-fec/lib/viterbi/metrics.cc (renamed from gr-fec/lib/viterbi/metrics.c)0
-rw-r--r--gr-fec/lib/viterbi/tab.cc (renamed from gr-fec/lib/viterbi/tab.c)0
-rw-r--r--gr-fec/lib/viterbi/viterbi.cc (renamed from gr-fec/lib/viterbi/viterbi.c)0
-rw-r--r--gr-fec/swig/CMakeLists.txt14
-rw-r--r--gr-fft/CMakeLists.txt7
-rw-r--r--gr-fft/lib/CMakeLists.txt77
-rw-r--r--gr-fft/swig/CMakeLists.txt14
-rw-r--r--gr-filter/CMakeLists.txt8
-rw-r--r--gr-filter/lib/CMakeLists.txt87
-rw-r--r--gr-filter/swig/CMakeLists.txt15
-rw-r--r--gr-qtgui/CMakeLists.txt8
-rw-r--r--gr-qtgui/lib/CMakeLists.txt184
-rw-r--r--gr-qtgui/swig/CMakeLists.txt17
-rw-r--r--gr-trellis/CMakeLists.txt13
-rw-r--r--gr-trellis/lib/CMakeLists.txt68
-rw-r--r--gr-trellis/swig/CMakeLists.txt14
-rw-r--r--gr-uhd/CMakeLists.txt4
-rw-r--r--gr-uhd/examples/c++/CMakeLists.txt18
-rw-r--r--gr-uhd/lib/CMakeLists.txt72
-rw-r--r--gr-uhd/swig/CMakeLists.txt14
-rw-r--r--gr-utils/python/modtool/templates/gr-newmod/CMakeLists.txt82
-rw-r--r--gr-utils/python/modtool/templates/gr-newmod/cmake/Modules/FindCppUnit.cmake39
-rw-r--r--gr-utils/python/modtool/templates/gr-newmod/cmake/Modules/FindGnuradioRuntime.cmake36
-rw-r--r--gr-utils/python/modtool/templates/gr-newmod/cmake/Modules/GrMiscUtils.cmake306
-rw-r--r--gr-utils/python/modtool/templates/gr-newmod/cmake/Modules/GrPlatform.cmake63
-rw-r--r--gr-utils/python/modtool/templates/gr-newmod/cmake/Modules/GrPython.cmake241
-rw-r--r--gr-utils/python/modtool/templates/gr-newmod/cmake/Modules/GrSwig.cmake247
-rw-r--r--gr-utils/python/modtool/templates/gr-newmod/cmake/Modules/GrTest.cmake163
-rw-r--r--gr-utils/python/modtool/templates/gr-newmod/cmake/Modules/UseSWIG.cmake305
-rw-r--r--gr-utils/python/modtool/templates/gr-newmod/cmake/Modules/howtoConfig.cmake5
-rw-r--r--gr-utils/python/modtool/templates/gr-newmod/cmake/Modules/targetConfig.cmake.in (renamed from gnuradio-runtime/lib/thread/CMakeLists.txt)16
-rw-r--r--gr-utils/python/modtool/templates/gr-newmod/docs/doxygen/swig_doc.py20
-rw-r--r--gr-utils/python/modtool/templates/gr-newmod/lib/CMakeLists.txt12
-rw-r--r--gr-utils/python/modtool/templates/gr-newmod/swig/CMakeLists.txt8
-rw-r--r--gr-utils/python/modtool/tools/grc_yaml_generator.py5
-rw-r--r--gr-video-sdl/CMakeLists.txt5
-rw-r--r--gr-video-sdl/lib/CMakeLists.txt64
-rw-r--r--gr-video-sdl/swig/CMakeLists.txt13
-rw-r--r--gr-vocoder/CMakeLists.txt7
-rw-r--r--gr-vocoder/lib/CMakeLists.txt81
-rw-r--r--gr-vocoder/lib/g7xx/CMakeLists.txt30
-rw-r--r--gr-vocoder/swig/CMakeLists.txt13
-rw-r--r--gr-wavelet/CMakeLists.txt7
-rw-r--r--gr-wavelet/lib/CMakeLists.txt74
-rw-r--r--gr-wavelet/swig/CMakeLists.txt15
-rw-r--r--gr-zeromq/CMakeLists.txt5
-rw-r--r--gr-zeromq/lib/CMakeLists.txt67
-rw-r--r--gr-zeromq/swig/CMakeLists.txt14
m---------volk0
126 files changed, 1709 insertions, 4253 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index bd1166b4e7..5b361d0144 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -27,9 +27,10 @@ endif(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
########################################################################
# Make sure this version matches ${GR_CMAKE_MIN_VERSION} (a variable can't be
# used here).
-cmake_minimum_required(VERSION 3.5.1)
+cmake_minimum_required(VERSION 3.8)
project(gnuradio CXX C)
enable_testing()
+option(BUILD_SHARED_LIBS "Build shared libraries" ON)
# Make sure our local CMake Modules path comes first
list(INSERT CMAKE_MODULE_PATH 0 ${CMAKE_SOURCE_DIR}/cmake/Modules)
@@ -73,13 +74,13 @@ if(POLICY CMP0026)
cmake_policy(SET CMP0026 NEW)
endif()
if(POLICY CMP0043)
- cmake_policy(SET CMP0043 OLD)
+ cmake_policy(SET CMP0043 NEW)
endif()
if(POLICY CMP0045)
- cmake_policy(SET CMP0045 OLD)
+ cmake_policy(SET CMP0045 NEW)
endif()
if(POLICY CMP0046)
- cmake_policy(SET CMP0046 OLD)
+ cmake_policy(SET CMP0046 NEW)
endif()
########################################################################
@@ -254,9 +255,19 @@ string(REPLACE "\n" " \\n" COMPILER_INFO ${COMPILER_INFO})
# Install directories
########################################################################
include(GrPlatform) #define LIB_SUFFIX
+
+# Install our Cmake modules into $prefix/lib/cmake/gnuradio
+# See "Package Configuration Files" on page:
+# http://www.cmake.org/Wiki/CMake/Tutorials/Packaging
+
+if(NOT CMAKE_MODULES_DIR)
+ SET(CMAKE_MODULES_DIR lib${LIB_SUFFIX}/cmake)
+endif(NOT CMAKE_MODULES_DIR)
+
SET(GR_RUNTIME_DIR bin CACHE PATH "Path to install all binaries")
SET(GR_LIBRARY_DIR lib${LIB_SUFFIX} CACHE PATH "Path to install libraries")
SET(GR_INCLUDE_DIR include CACHE PATH "Path to install header files")
+SET(GR_CMAKE_DIR ${CMAKE_MODULES_DIR}/gnuradio)
SET(GR_DATA_DIR share CACHE PATH "Base location for data")
SET(GR_PKG_DATA_DIR ${GR_DATA_DIR}/${CMAKE_PROJECT_NAME} CACHE PATH "Path to install package data")
SET(GR_DOC_DIR ${GR_DATA_DIR}/doc CACHE PATH "Path to install documentation")
@@ -289,9 +300,6 @@ else(ENABLE_PERFORMANCE_COUNTERS)
message(STATUS "NO PERF COUNTERS")
endif(ENABLE_PERFORMANCE_COUNTERS)
-OPTION(ENABLE_STATIC_LIBS "Enable building of static libraries" OFF)
-message(STATUS "Building Static Libraries: ${ENABLE_STATIC_LIBS}")
-
########################################################################
# Variables replaced when configuring the package config files
########################################################################
@@ -380,14 +388,15 @@ message(STATUS "")
message(STATUS "Configuring VOLK support...")
OPTION(ENABLE_INTERNAL_VOLK "Enable internal VOLK only" ON)
-unSET(VOLK_FOUND)
+UNSET(Volk_FOUND)
if(NOT ENABLE_INTERNAL_VOLK)
find_package(Volk)
- if(NOT VOLK_FOUND)
+ set(GR_VOLK_LIB "Volk::volk")
+ if(NOT Volk_FOUND)
message(STATUS " External VOLK not found; checking internal.")
endif()
endif()
-if(NOT VOLK_FOUND)
+if(NOT Volk_FOUND)
find_file(INTREE_VOLK_FOUND
volk/volk_common.h
PATHS ${CMAKE_CURRENT_SOURCE_DIR}/volk/include
@@ -419,7 +428,7 @@ if(NOT VOLK_FOUND)
${CMAKE_CURRENT_BINARY_DIR}/volk/include
)
- SET(VOLK_LIBRARIES volk)
+ set(GR_VOLK_LIB "volk")
SET(VOLK_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_PREFIX}/lib)
SET(VOLK_INSTALL_INCLUDE_DIR ${CMAKE_INSTALL_PREFIX}/include)
@@ -429,12 +438,12 @@ else()
get_filename_component(VOLK_INSTALL_LIBRARY_DIR "${VOLK_LIBRARIES}" DIRECTORY)
SET(VOLK_INSTALL_INCLUDE_DIR ${VOLK_INCLUDE_DIRS})
-endif(NOT VOLK_FOUND)
+endif(NOT Volk_FOUND)
message(STATUS " Override with -DENABLE_INTERNAL_VOLK=ON/OFF")
# Handle logging
-find_package(Log4cpp REQUIRED)
+find_package(LOG4CPP REQUIRED)
########################################################################
# Distribute the README file
@@ -447,13 +456,14 @@ install(
########################################################################
# The following dependency libraries are needed by all gr modules:
########################################################################
-list(APPEND GR_TEST_TARGET_DEPS volk gnuradio-runtime)
list(APPEND GR_TEST_PYTHON_DIRS
${CMAKE_BINARY_DIR}/gnuradio-runtime/python
${CMAKE_SOURCE_DIR}/gnuradio-runtime/python
${CMAKE_BINARY_DIR}/gnuradio-runtime/swig
)
+
+
# Note that above we put the binary gnuradio-runtime/python directory
# before the source directory. This is due to a quirk with ControlPort
# and how slice generates files and names. We want the QA and
@@ -504,14 +514,19 @@ if(ENABLE_GR_CTRLPORT)
endif(CTRLPORT_BACKENDS GREATER 0)
endif(ENABLE_GR_CTRLPORT)
-# Install our Cmake modules into $prefix/lib/cmake/gnuradio
-# See "Package Configuration Files" on page:
-# http://www.cmake.org/Wiki/CMake/Tutorials/Packaging
-configure_file(
+# Install all other cmake files into same directory
+file(GLOB cmake_others "cmake/Modules/*.cmake")
+list(REMOVE_ITEM cmake_others
+ "${CMAKE_SOURCE_DIR}/cmake/Modules/FindGnuradio.cmake"
+)
+
+include(CMakePackageConfigHelpers)
+configure_package_config_file(
${CMAKE_SOURCE_DIR}/cmake/Modules/GnuradioConfig.cmake.in
${CMAKE_BINARY_DIR}/cmake/Modules/GnuradioConfig.cmake
-@ONLY)
+ INSTALL_DESTINATION ${CMAKE_MODULES_DIR}/gnuradio
+ )
configure_file(
${CMAKE_SOURCE_DIR}/cmake/Modules/GnuradioConfigVersion.cmake.in
@@ -523,15 +538,6 @@ SET(cmake_configs
${CMAKE_BINARY_DIR}/cmake/Modules/GnuradioConfigVersion.cmake
)
-if(NOT CMAKE_MODULES_DIR)
- SET(CMAKE_MODULES_DIR lib${LIB_SUFFIX}/cmake)
-endif(NOT CMAKE_MODULES_DIR)
-
-# Install all other cmake files into same directory
-file(GLOB cmake_others "cmake/Modules/*.cmake")
-list(REMOVE_ITEM cmake_others
- "${CMAKE_SOURCE_DIR}/cmake/Modules/FindGnuradio.cmake"
-)
install(
FILES ${cmake_configs} ${cmake_others}
diff --git a/cmake/Modules/CMakeMacroLibtoolFile.cmake b/cmake/Modules/CMakeMacroLibtoolFile.cmake
deleted file mode 100644
index 5e0841716b..0000000000
--- a/cmake/Modules/CMakeMacroLibtoolFile.cmake
+++ /dev/null
@@ -1,61 +0,0 @@
-#http://www.vtk.org/Wiki/CMakeMacroLibtoolFile
-#This macro creates a libtool .la file for shared libraries or plugins. The first parameter is the target name of the library, the second parameter is the directory where it will be installed to. E.g. for a KDE 3.x module named "kfoo" the usage would be as follows:
-
-#The macro GET_TARGET_PROPERTY_WITH_DEFAULT is helpful to handle properties with default values.
-
-#ADD_LIBRARY(foo SHARED kfoo1.cpp kfoo2.cpp)
-#CREATE_LIBTOOL_FILE(foo /lib/kde3)
-
-if(DEFINED __INCLUDED_CREATE_LIBTOOL_FILE)
- return()
-endif()
-set(__INCLUDED_CREATE_LIBTOOL_FILE TRUE)
-
- MACRO(GET_TARGET_PROPERTY_WITH_DEFAULT _variable _target _property _default_value)
- GET_TARGET_PROPERTY (${_variable} ${_target} ${_property})
- IF (${_variable} MATCHES NOTFOUND)
- SET (${_variable} ${_default_value})
- ENDIF (${_variable} MATCHES NOTFOUND)
- ENDMACRO (GET_TARGET_PROPERTY_WITH_DEFAULT)
-
- MACRO(CREATE_LIBTOOL_FILE _target _install_DIR)
- GET_TARGET_PROPERTY_WITH_DEFAULT(_target_static_lib ${_target} STATIC_LIB "")
- GET_TARGET_PROPERTY_WITH_DEFAULT(_target_dependency_libs ${_target} LT_DEPENDENCY_LIBS "")
- GET_TARGET_PROPERTY_WITH_DEFAULT(_target_current ${_target} LT_VERSION_CURRENT 0)
- GET_TARGET_PROPERTY_WITH_DEFAULT(_target_age ${_target} LT_VERSION_AGE 0)
- GET_TARGET_PROPERTY_WITH_DEFAULT(_target_revision ${_target} LT_VERSION_REVISION 0)
- GET_TARGET_PROPERTY_WITH_DEFAULT(_target_installed ${_target} LT_INSTALLED yes)
- GET_TARGET_PROPERTY_WITH_DEFAULT(_target_shouldnotlink ${_target} LT_SHOULDNOTLINK yes)
- GET_TARGET_PROPERTY_WITH_DEFAULT(_target_dlopen ${_target} LT_DLOPEN "")
- GET_TARGET_PROPERTY_WITH_DEFAULT(_target_dlpreopen ${_target} LT_DLPREOPEN "")
- GET_FILENAME_COMPONENT(_laname $<TARGET_FILE:$_target> NAME_WE)
- GET_FILENAME_COMPONENT(_soname $<TARGET_FILE:$_target> NAME)
- SET(_laname ${CMAKE_CURRENT_BINARY_DIR}/${_laname}.la)
- FILE(WRITE ${_laname} "# ${_laname} - a libtool library file\n")
- FILE(WRITE ${_laname} "# Generated by CMake ${CMAKE_VERSION} (like GNU libtool)\n")
- FILE(WRITE ${_laname} "\n# Please DO NOT delete this file!\n# It is necessary for linking the library with libtool.\n\n" )
- FILE(APPEND ${_laname} "# The name that we can dlopen(3).\n")
- FILE(APPEND ${_laname} "dlname='${_soname}'\n\n")
- FILE(APPEND ${_laname} "# Names of this library.\n")
- FILE(APPEND ${_laname} "library_names='${_soname}.${_target_current}.${_target_age}.${_target_revision} ${_soname}.${_target_current} ${_soname}'\n\n")
- FILE(APPEND ${_laname} "# The name of the static archive.\n")
- FILE(APPEND ${_laname} "old_library='${_target_static_lib}'\n\n")
- FILE(APPEND ${_laname} "# Libraries that this one depends upon.\n")
- FILE(APPEND ${_laname} "dependency_libs='${_target_dependency_libs}'\n\n")
- FILE(APPEND ${_laname} "# Names of additional weak libraries provided by this library\n")
- FILE(APPEND ${_laname} "weak_library_names=\n\n")
- FILE(APPEND ${_laname} "# Version information for ${_laname}.\n")
- FILE(APPEND ${_laname} "current=${_target_current}\n")
- FILE(APPEND ${_laname} "age=${_target_age}\n")
- FILE(APPEND ${_laname} "revision=${_target_revision}\n\n")
- FILE(APPEND ${_laname} "# Is this an already installed library?\n")
- FILE(APPEND ${_laname} "installed=${_target_installed}\n\n")
- FILE(APPEND ${_laname} "# Should we warn about portability when linking against -modules?\n")
- FILE(APPEND ${_laname} "shouldnotlink=${_target_shouldnotlink}\n\n")
- FILE(APPEND ${_laname} "# Files to dlopen/dlpreopen\n")
- FILE(APPEND ${_laname} "dlopen='${_target_dlopen}'\n")
- FILE(APPEND ${_laname} "dlpreopen='${_target_dlpreopen}'\n\n")
- FILE(APPEND ${_laname} "# Directory that this library needs to be installed in:\n")
- FILE(APPEND ${_laname} "libdir='${CMAKE_INSTALL_PREFIX}${_install_DIR}'\n")
- INSTALL( FILES ${_laname} DESTINATION ${CMAKE_INSTALL_PREFIX}${_install_DIR})
- ENDMACRO(CREATE_LIBTOOL_FILE)
diff --git a/cmake/Modules/FindALSA.cmake b/cmake/Modules/FindALSA.cmake
index e3e6624ff0..13fc974e61 100644
--- a/cmake/Modules/FindALSA.cmake
+++ b/cmake/Modules/FindALSA.cmake
@@ -34,3 +34,10 @@ set(ALSA_PROCESS_INCLUDES ALSA_INCLUDE_DIR)
set(ALSA_PROCESS_LIBS ALSA_LIBRARY)
libfind_process(ALSA)
+if (ALSA_FOUND AND NOT TARGET ALSA::ALSA)
+ add_library(ALSA::ALSA INTERFACE IMPORTED)
+ set_target_properties(ALSA::ALSA PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "${ALSA_INCLUDE_DIRS}"
+ INTERFACE_LINK_LIBRARIES "${ALSA_LIBRARY}"
+ )
+endif()
diff --git a/cmake/Modules/FindCodec2.cmake b/cmake/Modules/FindCodec2.cmake
index 1c917fed5b..0c94ad0a0a 100644
--- a/cmake/Modules/FindCodec2.cmake
+++ b/cmake/Modules/FindCodec2.cmake
@@ -65,3 +65,11 @@ endif(LIBCODEC2_INCLUDE_DIR AND LIBCODEC2_LIBRARIES)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LIBCODEC2 DEFAULT_MSG LIBCODEC2_LIBRARIES LIBCODEC2_INCLUDE_DIRS)
mark_as_advanced(LIBCODEC2_INCLUDE_DIR LIBCODEC2_LIBRARIES)
+
+if (LIBCODEC2_FOUND AND NOT TARGET CODEC2::CODEC2)
+ add_library(CODEC2::CODEC2 INTERFACE IMPORTED)
+ set_target_properties(CODEC2::CODEC2 PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "${LIBCODEC2_INCLUDE_DIRS}"
+ INTERFACE_LINK_LIBRARIES "${LIBCODEC2_LIBRARIES}"
+ )
+endif()
diff --git a/cmake/Modules/FindFFTW3f.cmake b/cmake/Modules/FindFFTW3f.cmake
index 0ee7e46fe4..c375c18823 100644
--- a/cmake/Modules/FindFFTW3f.cmake
+++ b/cmake/Modules/FindFFTW3f.cmake
@@ -4,38 +4,55 @@
# Find single-precision (float) version of FFTW3
INCLUDE(FindPkgConfig)
-PKG_CHECK_MODULES(PC_FFTW3F "fftw3f >= 3.0")
+PKG_CHECK_MODULES(PC_FFTW3f "fftw3f >= 3.0")
FIND_PATH(
- FFTW3F_INCLUDE_DIRS
+ FFTW3f_INCLUDE_DIRS
NAMES fftw3.h
HINTS $ENV{FFTW3_DIR}/include
- ${PC_FFTW3F_INCLUDE_DIR}
+ ${PC_FFTW3f_INCLUDE_DIR}
PATHS /usr/local/include
/usr/include
)
FIND_LIBRARY(
- FFTW3F_LIBRARIES
+ FFTW3f_LIBRARIES
NAMES fftw3f libfftw3f
HINTS $ENV{FFTW3_DIR}/lib
- ${PC_FFTW3F_LIBDIR}
+ ${PC_FFTW3f_LIBDIR}
PATHS /usr/local/lib
/usr/lib
/usr/lib64
)
FIND_LIBRARY(
- FFTW3F_THREADS_LIBRARIES
+ FFTW3f_THREADS_LIBRARIES
NAMES fftw3f_threads libfftw3f_threads
HINTS $ENV{FFTW3_DIR}/lib
- ${PC_FFTW3F_LIBDIR}
+ ${PC_FFTW3f_LIBDIR}
PATHS /usr/local/lib
/usr/lib
/usr/lib64
)
+
INCLUDE(FindPackageHandleStandardArgs)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(FFTW3F DEFAULT_MSG FFTW3F_LIBRARIES FFTW3F_INCLUDE_DIRS)
-MARK_AS_ADVANCED(FFTW3F_LIBRARIES FFTW3F_INCLUDE_DIRS FFTW3F_THREADS_LIBRARIES) \ No newline at end of file
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(FFTW3f DEFAULT_MSG FFTW3f_LIBRARIES FFTW3f_INCLUDE_DIRS)
+MARK_AS_ADVANCED(FFTW3f_LIBRARIES FFTW3f_INCLUDE_DIRS FFTW3f_THREADS_LIBRARIES)
+
+if (FFTW3f_FOUND AND NOT TARGET fftw3f::fftw3f)
+ add_library(fftw3f::fftw3f INTERFACE IMPORTED)
+ set_target_properties(fftw3f::fftw3f PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "${FFTW3f_INCLUDE_DIRS}"
+ INTERFACE_LINK_LIBRARIES "${FFTW3f_LIBRARIES}"
+ )
+ if (FFTW3f_THREADS_LIBRARIES)
+ set_property(TARGET fftw3f::fftw3f APPEND PROPERTY INTERFACE_LINK_LIBRARIES
+ "${FFTW3f_THREADS_LIBRARIES}"
+ )
+ set_target_properties(fftw3f::fftw3f PROPERTIES
+ INTERFACE_COMPILE_DEFINITIONS "FFTW3F_THREADS"
+ )
+ endif()
+endif()
diff --git a/cmake/Modules/FindGSL.cmake b/cmake/Modules/FindGSL.cmake
index d1736d7e2f..116ea9f9e6 100644
--- a/cmake/Modules/FindGSL.cmake
+++ b/cmake/Modules/FindGSL.cmake
@@ -21,6 +21,14 @@ PKG_CHECK_MODULES(GSL "gsl >= 1.10")
IF(GSL_FOUND)
set(GSL_LIBRARY_DIRS ${GSL_LIBDIR})
set(GSL_INCLUDE_DIRS ${GSL_INCLUDEDIR})
+ if( NOT TARGET gsl::gsl)
+ add_library(gsl::gsl INTERFACE IMPORTED)
+ set_target_properties(gsl::gsl PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "${GSL_INCLUDE_DIRS}"
+ INTERFACE_LINK_LIBRARIES "${GSL_LIBRARIES}"
+ INTERFACE_COMPILE_DEFINITIONS "${GSL_DEFINITIONS}"
+ )
+ endif( NOT TARGET gsl::gsl)
ELSE(GSL_FOUND)
set( GSL_FOUND OFF )
set( GSL_CBLAS_FOUND OFF )
@@ -130,19 +138,27 @@ else( WIN32 AND NOT CYGWIN AND NOT MSYS )
endif( GSL_CONFIG_EXECUTABLE )
endif( UNIX OR MSYS )
endif( WIN32 AND NOT CYGWIN AND NOT MSYS )
+#needed for gsl windows port but safe to always define
+LIST(APPEND GSL_DEFINITIONS "-DGSL_DLL")
if( GSL_FOUND )
if( NOT GSL_FIND_QUIETLY )
message( STATUS "FindGSL: Found both GSL headers and library" )
endif( NOT GSL_FIND_QUIETLY )
+ if( NOT TARGET gsl::gsl)
+ add_library(gsl::gsl INTERFACE IMPORTED)
+ set_target_properties(gsl::gsl PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "${GSL_INCLUDE_DIRS}"
+ INTERFACE_LINK_LIBRARIES "${GSL_LIBRARIES}"
+ INTERFACE_COMPILE_DEFINITIONS "${GSL_DEFINITIONS}"
+ )
+ endif( NOT TARGET gsl::gsl)
else( GSL_FOUND )
if( GSL_FIND_REQUIRED )
message( FATAL_ERROR "FindGSL: Could not find GSL headers or library" )
endif( GSL_FIND_REQUIRED )
endif( GSL_FOUND )
-#needed for gsl windows port but safe to always define
-LIST(APPEND GSL_DEFINITIONS "-DGSL_DLL")
ENDIF(GSL_FOUND)
diff --git a/cmake/Modules/FindGSM.cmake b/cmake/Modules/FindGSM.cmake
index 7db2adae18..242b4f4a09 100644
--- a/cmake/Modules/FindGSM.cmake
+++ b/cmake/Modules/FindGSM.cmake
@@ -50,3 +50,11 @@ endif(LIBGSM_INCLUDE_DIR AND LIBGSM_LIBRARIES)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LIBGSM DEFAULT_MSG LIBGSM_LIBRARIES LIBGSM_INCLUDE_DIRS)
mark_as_advanced(LIBGSM_INCLUDE_DIR LIBGSM_LIBRARIES)
+
+if (LIBGSM_FOUND AND NOT TARGET GSM::GSM)
+ add_library(GSM::GSM INTERFACE IMPORTED)
+ set_target_properties(GSM::GSM PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "${LIBGSM_INCLUDE_DIRS}"
+ INTERFACE_LINK_LIBRARIES "${LIBGSM_LIBRARIES}"
+ )
+endif()
diff --git a/cmake/Modules/FindJack.cmake b/cmake/Modules/FindJACK.cmake
index 4bdfe0a7e7..e0c3f3505e 100644
--- a/cmake/Modules/FindJack.cmake
+++ b/cmake/Modules/FindJACK.cmake
@@ -4,7 +4,6 @@
# JACK_FOUND - system has jack
# JACK_INCLUDE_DIRS - the jack include directory
# JACK_LIBRARIES - Link these to use jack
-# JACK_DEFINITIONS - Compiler switches required for using jack
#
# Copyright (c) 2008 Andreas Schneider <mail@cynapses.org>
# Modified for other libraries by Lasse Kärkkäinen <tronic>
@@ -78,5 +77,13 @@ else (JACK_LIBRARIES AND JACK_INCLUDE_DIRS)
# show the JACK_INCLUDE_DIRS and JACK_LIBRARIES variables only in the advanced view
mark_as_advanced(JACK_INCLUDE_DIRS JACK_LIBRARIES)
-endif (JACK_LIBRARIES AND JACK_INCLUDE_DIRS)
+ if (JACK_FOUND AND NOT TARGET JACK::JACK)
+ add_library(JACK::JACK INTERFACE IMPORTED)
+ set_target_properties(JACK::JACK PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "${JACK_INCLUDE_DIRS}"
+ INTERFACE_LINK_LIBRARIES "${JACK_LIBRARIES}"
+ )
+ endif()
+
+endif (JACK_LIBRARIES AND JACK_INCLUDE_DIRS)
diff --git a/cmake/Modules/FindLog4cpp.cmake b/cmake/Modules/FindLOG4CPP.cmake
index fc314c61a5..fb722ebff5 100644
--- a/cmake/Modules/FindLog4cpp.cmake
+++ b/cmake/Modules/FindLOG4CPP.cmake
@@ -47,6 +47,15 @@ else ()
endif ()
endif ()
+
+if (LOG4CPP_FOUND AND NOT TARGET log4cpp::log4cpp)
+ add_library(Log4Cpp::log4cpp INTERFACE IMPORTED)
+ set_target_properties(Log4Cpp::log4cpp PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "${LOG4CPP_INCLUDE_DIRS}"
+ INTERFACE_LINK_LIBRARIES "${LOG4CPP_LIBRARIES}"
+ )
+endif()
+
mark_as_advanced(
LOG4CPP_LIBRARIES
LOG4CPP_INCLUDE_DIRS
diff --git a/cmake/Modules/FindMPLIB.cmake b/cmake/Modules/FindMPLIB.cmake
index 2f4ec8c689..37673b136b 100644
--- a/cmake/Modules/FindMPLIB.cmake
+++ b/cmake/Modules/FindMPLIB.cmake
@@ -25,3 +25,11 @@ set(MPLIB_LIBRARIES ${MPLIBXX_LIBRARY} ${MPLIB_LIBRARY})
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(MPLIB DEFAULT_MSG MPLIBXX_LIBRARY MPLIB_LIBRARY MPLIB_INCLUDE_DIR)
mark_as_advanced(MPLIBXX_LIBRARY MPLIB_LIBRARY MPLIB_INCLUDE_DIR)
+
+if (MPLIB_LIBRARIES AND NOT TARGET MPLib::mplib)
+ add_library(MPLib::mplib INTERFACE IMPORTED)
+ set_target_properties(MPLib::mplib PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "${MPLIB_INCLUDE_DIRS}"
+ INTERFACE_LINK_LIBRARIES "${MPLIB_LIBRARIES}"
+ )
+endif()
diff --git a/cmake/Modules/FindOSS.cmake b/cmake/Modules/FindOSS.cmake
index 7470e7d622..a4d6d03313 100644
--- a/cmake/Modules/FindOSS.cmake
+++ b/cmake/Modules/FindOSS.cmake
@@ -48,4 +48,12 @@ MARK_AS_ADVANCED (
LINUX_OSS_INCLUDE_DIR
SYS_OSS_INCLUDE_DIR
MACHINE_OSS_INCLUDE_DIR
-)
+ )
+
+
+if (OSS_FOUND AND NOT TARGET OSS::OSS)
+ add_library(OSS::OSS INTERFACE IMPORTED)
+ set_target_properties(OSS::OSS PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "${OSS_INCLUDE_DIRS}"
+ )
+endif()
diff --git a/cmake/Modules/FindPortaudio.cmake b/cmake/Modules/FindPORTAUDIO.cmake
index 8aa17d4448..ab18c6c1df 100644
--- a/cmake/Modules/FindPortaudio.cmake
+++ b/cmake/Modules/FindPORTAUDIO.cmake
@@ -31,6 +31,7 @@ find_library(PORTAUDIO_LIBRARIES
mark_as_advanced(PORTAUDIO_INCLUDE_DIRS PORTAUDIO_LIBRARIES)
+
# Found PORTAUDIO, but it may be version 18 which is not acceptable.
if(EXISTS ${PORTAUDIO_INCLUDE_DIRS}/portaudio.h)
include(CheckCXXSourceCompiles)
@@ -44,6 +45,13 @@ if(EXISTS ${PORTAUDIO_INCLUDE_DIRS}/portaudio.h)
if(PORTAUDIO2_FOUND)
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(PORTAUDIO DEFAULT_MSG PORTAUDIO_INCLUDE_DIRS PORTAUDIO_LIBRARIES)
+ if (PORTAUDIO_FOUND AND NOT TARGET Portaudio::Portaudio)
+ add_library(Portaudio::Portaudio INTERFACE IMPORTED)
+ set_target_properties(Portaudio::Portaudio PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "${PORTAUDIO_INCLUDE_DIRS}"
+ INTERFACE_LINK_LIBRARIES "${PORTAUDIO_LIBRARIES}"
+ )
+ endif()
else(PORTAUDIO2_FOUND)
message(STATUS
" portaudio.h not compatible (requires API 2.0)")
diff --git a/cmake/Modules/FindQwt.cmake b/cmake/Modules/FindQwt.cmake
index d0694c942c..234f160c75 100644
--- a/cmake/Modules/FindQwt.cmake
+++ b/cmake/Modules/FindQwt.cmake
@@ -68,4 +68,11 @@ if(QWT_FOUND)
include ( FindPackageHandleStandardArgs )
find_package_handle_standard_args( Qwt DEFAULT_MSG QWT_LIBRARIES QWT_INCLUDE_DIRS )
MARK_AS_ADVANCED(QWT_LIBRARIES QWT_INCLUDE_DIRS)
+ if (Qwt_FOUND AND NOT TARGET qwt::qwt)
+ add_library(qwt::qwt INTERFACE IMPORTED)
+ set_target_properties(qwt::qwt PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "${QWT_INCLUDE_DIRS}"
+ INTERFACE_LINK_LIBRARIES "${QWT_LIBRARIES}"
+ )
+ endif()
endif(QWT_FOUND)
diff --git a/cmake/Modules/FindThrift.cmake b/cmake/Modules/FindTHRIFT.cmake
index e5a8df1304..3aa2bf2ce7 100644
--- a/cmake/Modules/FindThrift.cmake
+++ b/cmake/Modules/FindTHRIFT.cmake
@@ -84,3 +84,11 @@ MARK_AS_ADVANCED(
THRIFT_LIBRARIES THRIFT_INCLUDE_DIRS
THRIFT_BIN PYTHON_THRIFT_FOUND THRIFT_FOUND
)
+
+if (THRIFT_FOUND AND NOT TARGET Thrift::thrift)
+ add_library(Thrift::thrift INTERFACE IMPORTED)
+ set_target_properties(Thrift::thrift PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "${THRIFT_INCLUDE_DIRS}"
+ INTERFACE_LINK_LIBRARIES "${THRIFT_LIBRARIES}"
+ )
+endif()
diff --git a/cmake/Modules/FindUHD.cmake b/cmake/Modules/FindUHD.cmake
index cf4efe909c..28b47d6c90 100644
--- a/cmake/Modules/FindUHD.cmake
+++ b/cmake/Modules/FindUHD.cmake
@@ -84,6 +84,14 @@ if(UHD_LIBRARIES AND UHD_INCLUDE_DIRS)
find_package_handle_standard_args(UHD DEFAULT_MSG UHD_LIBRARIES UHD_INCLUDE_DIRS)
mark_as_advanced(UHD_LIBRARIES UHD_INCLUDE_DIRS)
+ if (UHD_FOUND AND NOT TARGET UHD::UHD)
+ add_library(UHD::UHD INTERFACE IMPORTED)
+ set_target_properties(UHD::UHD PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "${UHD_INCLUDE_DIRS}"
+ INTERFACE_LINK_LIBRARIES "${UHD_LIBRARIES}"
+ )
+ endif()
+
elseif(UHD_FIND_REQUIRED)
if($ENV{UHD_CONFIG_VERSION_USED} AND NOT $ENV{UHD_CONFIG_USED})
message(FATAL_ERROR "The found UHD version ($ENV{UHD_PACKAGE_VERSION}) is not compatible with the version required (${UHD_FIND_VERSION}).")
diff --git a/cmake/Modules/FindZeroMQ.cmake b/cmake/Modules/FindZeroMQ.cmake
index 62a1c6b969..524e42a459 100644
--- a/cmake/Modules/FindZeroMQ.cmake
+++ b/cmake/Modules/FindZeroMQ.cmake
@@ -24,3 +24,11 @@ FIND_LIBRARY(ZEROMQ_LIBRARIES
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(ZEROMQ DEFAULT_MSG ZEROMQ_LIBRARIES ZEROMQ_INCLUDE_DIRS)
MARK_AS_ADVANCED(ZEROMQ_LIBRARIES ZEROMQ_INCLUDE_DIRS)
+
+if (ZEROMQ_FOUND AND NOT TARGET ZEROMQ::ZEROMQ)
+ add_library(ZeroMQ::ZeroMQ INTERFACE IMPORTED)
+ set_target_properties(ZeroMQ::ZeroMQ PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "${ZEROMQ_INCLUDE_DIRS}"
+ INTERFACE_LINK_LIBRARIES "${ZEROMQ_LIBRARIES}"
+ )
+endif()
diff --git a/cmake/Modules/GnuradioConfig.cmake.in b/cmake/Modules/GnuradioConfig.cmake.in
index 328e7769cc..bfed6fb0b0 100644
--- a/cmake/Modules/GnuradioConfig.cmake.in
+++ b/cmake/Modules/GnuradioConfig.cmake.in
@@ -17,13 +17,7 @@
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.
-INCLUDE(FindPkgConfig)
-INCLUDE(FindPackageHandleStandardArgs)
-
-# if GR_REQUIRED_COMPONENTS is not defined, it will be set to the following list (all of them)
-if(NOT GR_REQUIRED_COMPONENTS)
- set(GR_REQUIRED_COMPONENTS RUNTIME ANALOG BLOCKS DIGITAL FFT FILTER PMT)
-endif()
+include(CMakeFindDependencyMacro)
# Allows us to use all .cmake files in this directory
list(INSERT CMAKE_MODULE_PATH 0 "${CMAKE_CURRENT_LIST_DIR}")
@@ -32,109 +26,49 @@ list(INSERT CMAKE_MODULE_PATH 0 "${CMAKE_CURRENT_LIST_DIR}")
set(GNURADIO_ALL_LIBRARIES "")
set(GNURADIO_ALL_INCLUDE_DIRS "")
-MACRO(LIST_CONTAINS var value)
- SET(${var})
- FOREACH(value2 ${ARGN})
- IF (${value} STREQUAL ${value2})
- SET(${var} TRUE)
- ENDIF(${value} STREQUAL ${value2})
- ENDFOREACH(value2)
-ENDMACRO(LIST_CONTAINS)
-
-function(GR_MODULE EXTVAR PCNAME INCFILE LIBFILE)
-
- LIST_CONTAINS(REQUIRED_MODULE ${EXTVAR} ${GR_REQUIRED_COMPONENTS})
- if(NOT REQUIRED_MODULE)
- #message("Ignoring GNU Radio Module ${EXTVAR}")
- return()
- endif()
-
- message("Checking for GNU Radio Module: ${EXTVAR}")
-
- # check for .pc hints
- PKG_CHECK_MODULES(PC_GNURADIO_${EXTVAR} ${PCNAME})
-
- if(NOT PC_GNURADIO_${EXTVAR}_FOUND)
- set(PC_GNURADIO_${EXTVAR}_LIBRARIES ${LIBFILE})
- endif()
-
- set(INCVAR_NAME "GNURADIO_${EXTVAR}_INCLUDE_DIRS")
- set(LIBVAR_NAME "GNURADIO_${EXTVAR}_LIBRARIES")
- set(PC_INCDIR ${PC_GNURADIO_${EXTVAR}_INCLUDEDIR})
- set(PC_LIBDIR ${PC_GNURADIO_${EXTVAR}_LIBDIR})
-
- # look for include files
- FIND_PATH(
- ${INCVAR_NAME}
- NAMES ${INCFILE}
- HINTS $ENV{GNURADIO_RUNTIME_DIR}/include
- ${PC_INCDIR}
- ${CMAKE_INSTALL_PREFIX}/include
- PATHS /usr/local/include
- /usr/include
- "@CMAKE_INSTALL_PREFIX@/include"
- "@VOLK_INSTALL_INCLUDE_DIR@"
+find_dependency(LOG4CPP)
+find_dependency(MPLIB)
+find_dependency(Boost "@Boost_MAJOR_VERSION@.@Boost_MINOR_VERSION@.@Boost_SUBMINOR_VERSION@" COMPONENTS
+ date_time
+ program_options
+ filesystem
+ system
+ regex
+ thread
+ unit_test_framework
)
+find_dependency(Volk)
+
+include("${CMAKE_CURRENT_LIST_DIR}/gnuradio-pmtTargets.cmake")
+include("${CMAKE_CURRENT_LIST_DIR}/gnuradio-runtimeTargets.cmake")
+cmake_policy(SET CMP0012 NEW)
+cmake_policy(SET CMP0057 NEW)
+if(@ENABLE_PYTHON@)
+include("${CMAKE_CURRENT_LIST_DIR}/runtime_swigTargets.cmake")
+endif()
- # look for libs
- foreach(libname ${PC_GNURADIO_${EXTVAR}_LIBRARIES})
- FIND_LIBRARY(
- ${LIBVAR_NAME}_${libname}
- NAMES ${libname}
- HINTS $ENV{GNURADIO_RUNTIME_DIR}/lib
- ${PC_LIBDIR}
- ${CMAKE_INSTALL_PREFIX}/lib/
- ${CMAKE_INSTALL_PREFIX}/lib64/
- PATHS /usr/local/lib
- /usr/local/lib64
- /usr/lib
- /usr/lib64
- "@CMAKE_INSTALL_PREFIX@/lib"
- "@VOLK_INSTALL_LIBRARY_DIR@"
- )
- list(APPEND ${LIBVAR_NAME} ${${LIBVAR_NAME}_${libname}})
- endforeach(libname)
-
- set(${LIBVAR_NAME} ${${LIBVAR_NAME}} PARENT_SCOPE)
-
- # show results
- message(" * INCLUDES=${GNURADIO_${EXTVAR}_INCLUDE_DIRS}")
- message(" * LIBS=${GNURADIO_${EXTVAR}_LIBRARIES}")
-
- # append to all includes and libs list
- set(GNURADIO_ALL_INCLUDE_DIRS ${GNURADIO_ALL_INCLUDE_DIRS} ${GNURADIO_${EXTVAR}_INCLUDE_DIRS} PARENT_SCOPE)
- set(GNURADIO_ALL_LIBRARIES ${GNURADIO_ALL_LIBRARIES} ${GNURADIO_${EXTVAR}_LIBRARIES} PARENT_SCOPE)
-
- FIND_PACKAGE_HANDLE_STANDARD_ARGS(GNURADIO_${EXTVAR} DEFAULT_MSG GNURADIO_${EXTVAR}_LIBRARIES GNURADIO_${EXTVAR}_INCLUDE_DIRS)
- message("GNURADIO_${EXTVAR}_FOUND = ${GNURADIO_${EXTVAR}_FOUND}")
- set(GNURADIO_${EXTVAR}_FOUND ${GNURADIO_${EXTVAR}_FOUND} PARENT_SCOPE)
-
- # generate an error if the module is missing
- if(NOT GNURADIO_${EXTVAR}_FOUND)
- message(FATAL_ERROR "Required GNU Radio Component: ${EXTVAR} missing!")
- endif()
-
- MARK_AS_ADVANCED(GNURADIO_${EXTVAR}_LIBRARIES GNURADIO_${EXTVAR}_INCLUDE_DIRS)
-
-endfunction()
-
-GR_MODULE(RUNTIME gnuradio-runtime gnuradio/top_block.h gnuradio-runtime)
-GR_MODULE(ANALOG gnuradio-analog gnuradio/analog/api.h gnuradio-analog)
-GR_MODULE(AUDIO gnuradio-audio gnuradio/audio/api.h gnuradio-audio)
-GR_MODULE(BLOCKS gnuradio-blocks gnuradio/blocks/api.h gnuradio-blocks)
-GR_MODULE(CHANNELS gnuradio-channels gnuradio/channels/api.h gnuradio-channels)
-GR_MODULE(DIGITAL gnuradio-digital gnuradio/digital/api.h gnuradio-digital)
-GR_MODULE(FEC gnuradio-fec gnuradio/fec/api.h gnuradio-fec)
-GR_MODULE(FFT gnuradio-fft gnuradio/fft/api.h gnuradio-fft)
-GR_MODULE(FILTER gnuradio-filter gnuradio/filter/api.h gnuradio-filter)
-GR_MODULE(QTGUI gnuradio-qtgui gnuradio/qtgui/api.h gnuradio-qtgui)
-GR_MODULE(TRELLIS gnuradio-trellis gnuradio/trellis/api.h gnuradio-trellis)
-GR_MODULE(UHD gnuradio-uhd gnuradio/uhd/api.h gnuradio-uhd)
-GR_MODULE(VOCODER gnuradio-vocoder gnuradio/vocoder/api.h gnuradio-vocoder)
-GR_MODULE(WAVELET gnuradio-wavelet gnuradio/wavelet/api.h gnuradio-wavelet)
-GR_MODULE(ZEROMQ gnuradio-zeromq gnuradio/zeromq/api.h gnuradio-zeromq)
-GR_MODULE(PMT gnuradio-runtime pmt/pmt.h gnuradio-pmt)
-GR_MODULE(VOLK volk volk/volk.h volk)
-
-list(REMOVE_DUPLICATES GNURADIO_ALL_INCLUDE_DIRS)
-list(REMOVE_DUPLICATES GNURADIO_ALL_LIBRARIES)
+set(GR_COMPONENTS
+ blocks
+ fec
+ fft
+ filter
+ analog
+ digital
+ dtv
+ audio
+ comedi
+ channels
+ qtgui
+ trellis
+ uhd
+ video-sdl
+ vocoder
+ wavelet
+ zeromq
+ )
+
+foreach(target ${GR_COMPONENTS})
+ if (${target} IN_LIST Gnuradio_FIND_COMPONENTS)
+ include("${CMAKE_CURRENT_LIST_DIR}/gnuradio-${target}Config.cmake")
+ endif()
+endforeach(target)
diff --git a/cmake/Modules/GrMiscUtils.cmake b/cmake/Modules/GrMiscUtils.cmake
index 920e8adbee..32681ac392 100644
--- a/cmake/Modules/GrMiscUtils.cmake
+++ b/cmake/Modules/GrMiscUtils.cmake
@@ -1,4 +1,4 @@
-# Copyright 2010-2011,2014 Free Software Foundation, Inc.
+# Copyright 2010-2011,2014,2019 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -22,14 +22,6 @@ if(DEFINED __INCLUDED_GR_MISC_UTILS_CMAKE)
endif()
set(__INCLUDED_GR_MISC_UTILS_CMAKE TRUE)
-########################################################################
-# Set global variable macro.
-# Used for subdirectories to export settings.
-# Example: include and library paths.
-########################################################################
-function(GR_SET_GLOBAL var)
- set(${var} ${ARGN} CACHE INTERNAL "" FORCE)
-endfunction(GR_SET_GLOBAL)
########################################################################
# Set the pre-processor definition if the condition is true.
@@ -53,39 +45,6 @@ function(GR_CHECK_HDR_N_DEF hdr def)
endfunction(GR_CHECK_HDR_N_DEF)
########################################################################
-# Include subdirectory macro.
-# Sets the CMake directory variables,
-# includes the subdirectory CMakeLists.txt,
-# resets the CMake directory variables.
-#
-# This macro includes subdirectories rather than adding them
-# so that the subdirectory can affect variables in the level above.
-# This provides a work-around for the lack of convenience libraries.
-# This way a subdirectory can append to the list of library sources.
-########################################################################
-macro(GR_INCLUDE_SUBDIRECTORY subdir)
- #insert the current directories on the front of the list
- list(INSERT _cmake_source_dirs 0 ${CMAKE_CURRENT_SOURCE_DIR})
- list(INSERT _cmake_binary_dirs 0 ${CMAKE_CURRENT_BINARY_DIR})
-
- #set the current directories to the names of the subdirs
- set(CMAKE_CURRENT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/${subdir})
- set(CMAKE_CURRENT_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/${subdir})
-
- #include the subdirectory CMakeLists to run it
- file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
- include(${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt)
-
- #reset the value of the current directories
- list(GET _cmake_source_dirs 0 CMAKE_CURRENT_SOURCE_DIR)
- list(GET _cmake_binary_dirs 0 CMAKE_CURRENT_BINARY_DIR)
-
- #pop the subdir names of the front of the list
- list(REMOVE_AT _cmake_source_dirs 0)
- list(REMOVE_AT _cmake_binary_dirs 0)
-endmacro(GR_INCLUDE_SUBDIRECTORY)
-
-########################################################################
# Check if a compiler flag works and conditionally set a compile define.
# - flag the compiler flag to check for
# - have the variable to set with result
@@ -105,29 +64,6 @@ macro(GR_ADD_CXX_COMPILER_FLAG_IF_AVAILABLE flag have)
endmacro(GR_ADD_CXX_COMPILER_FLAG_IF_AVAILABLE)
########################################################################
-# Generates the .la libtool file
-# This appears to generate libtool files that cannot be used by auto*.
-# Usage GR_LIBTOOL(TARGET [target] DESTINATION [dest])
-########################################################################
-function(GR_LIBTOOL)
- if(NOT DEFINED GENERATE_LIBTOOL)
- set(GENERATE_LIBTOOL OFF) #disabled by default
- endif()
-
- if(GENERATE_LIBTOOL)
- include(CMakeParseArgumentsCopy)
- CMAKE_PARSE_ARGUMENTS(GR_LIBTOOL "" "TARGET;DESTINATION" "" ${ARGN})
-
- find_program(LIBTOOL libtool)
- if(LIBTOOL)
- include(CMakeMacroLibtoolFile)
- CREATE_LIBTOOL_FILE(${GR_LIBTOOL_TARGET} /${GR_LIBTOOL_DESTINATION})
- endif(LIBTOOL)
- endif(GENERATE_LIBTOOL)
-
-endfunction(GR_LIBTOOL)
-
-########################################################################
# Do standard things to the library target
# - set target properties
# - make install rules
@@ -139,10 +75,32 @@ function(GR_LIBRARY_FOO target)
#install the generated files like so...
install(TARGETS ${target}
+ EXPORT ${target}-export
LIBRARY DESTINATION ${GR_LIBRARY_DIR} # .so/.dylib file
ARCHIVE DESTINATION ${GR_LIBRARY_DIR} # .lib file
RUNTIME DESTINATION ${GR_RUNTIME_DIR} # .dll file
- )
+ )
+
+ #install the exported target files
+ install(EXPORT ${target}-export
+ FILE ${target}Targets.cmake
+ NAMESPACE gnuradio::
+ DESTINATION ${GR_CMAKE_DIR}
+ )
+
+ include(CMakePackageConfigHelpers)
+ set(TARGET ${target})
+ set(TARGET_DEPENDENCIES ${ARGN})
+
+ configure_package_config_file(
+ ${PROJECT_SOURCE_DIR}/cmake/Modules/targetConfig.cmake.in
+ ${CMAKE_CURRENT_BINARY_DIR}/cmake/Modules/${target}Config.cmake
+ INSTALL_DESTINATION ${GR_CMAKE_DIR}
+ )
+ install(
+ FILES ${CMAKE_CURRENT_BINARY_DIR}/cmake/Modules/${target}Config.cmake
+ DESTINATION ${GR_CMAKE_DIR}
+ )
#extras mode enabled automatically on linux
if(NOT DEFINED LIBRARY_EXTRAS)
@@ -152,9 +110,6 @@ function(GR_LIBRARY_FOO target)
#special extras mode to enable alternative naming conventions
if(LIBRARY_EXTRAS)
- #create .la file before changing props
- GR_LIBTOOL(TARGET ${target} DESTINATION ${GR_LIBRARY_DIR})
-
#give the library a special name with ultra-zero soversion
set_target_properties(${target} PROPERTIES OUTPUT_NAME ${target}-${LIBVER} SOVERSION "0.0.0")
set(target_name lib${target}-${LIBVER}.so.0.0.0)
diff --git a/cmake/Modules/GrPython.cmake b/cmake/Modules/GrPython.cmake
index 49a351d3a7..b023be2619 100644
--- a/cmake/Modules/GrPython.cmake
+++ b/cmake/Modules/GrPython.cmake
@@ -1,4 +1,4 @@
-# Copyright 2010-2016 Free Software Foundation, Inc.
+# Copyright 2010-2016,2019 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -53,6 +53,12 @@ endif(CMAKE_CROSSCOMPILING)
set(PYTHON_EXECUTABLE ${PYTHON_EXECUTABLE} CACHE FILEPATH "python interpreter")
set(QA_PYTHON_EXECUTABLE ${QA_PYTHON_EXECUTABLE} CACHE FILEPATH "python interpreter for QA tests")
+add_library(Python::Python INTERFACE IMPORTED)
+set_target_properties(Python::Python PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "${PYTHON_INCLUDE_DIRS}"
+ INTERFACE_LINK_LIBRARIES "${PYTHON_LIBRARIES}"
+ )
+
########################################################################
# Check for the existence of a python module:
# - desc a string description of the check
@@ -122,12 +128,15 @@ endfunction(GR_UNIQUE_TARGET)
########################################################################
function(GR_PYTHON_INSTALL)
include(CMakeParseArgumentsCopy)
- CMAKE_PARSE_ARGUMENTS(GR_PYTHON_INSTALL "" "DESTINATION" "FILES;PROGRAMS;DIRECTORY" ${ARGN})
+ CMAKE_PARSE_ARGUMENTS(GR_PYTHON_INSTALL "" "DESTINATION" "FILES;PROGRAMS;DIRECTORY;DEPENDS" ${ARGN})
####################################################################
if(GR_PYTHON_INSTALL_FILES)
####################################################################
- install(${ARGN}) #installs regular python files
+ install(
+ FILES ${GR_PYTHON_INSTALL_FILES}
+ DESTINATION ${GR_PYTHON_INSTALL_DESTINATION}
+ )
#create a list of all generated files
unset(pysrcfiles)
@@ -158,9 +167,14 @@ function(GR_PYTHON_INSTALL)
endforeach(pyfile)
+ if(NOT GR_PYTHON_INSTALL_DEPENDS)
+ set(GR_PYTHON_INSTALL_DEPENDS ${pysrcfiles})
+ endif()
+
+
#the command to generate the pyc files
add_custom_command(
- DEPENDS ${pysrcfiles} OUTPUT ${pycfiles}
+ DEPENDS ${GR_PYTHON_INSTALL_DEPENDS} OUTPUT ${pycfiles}
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_BINARY_DIR}/python_compile_helper.py ${pysrcfiles} ${pycfiles}
)
@@ -179,7 +193,11 @@ function(GR_PYTHON_INSTALL)
####################################################################
elseif(GR_PYTHON_INSTALL_DIRECTORY)
####################################################################
- install(${ARGN}) #installs regular python files
+ install(
+ DIRECTORY ${GR_PYTHON_INSTALL_DIRECTORY}
+ DESTINATION ${GR_PYTHON_INSTALL_DESTINATION}
+ )
+
# collect all python files in given directories
# #############################################
diff --git a/cmake/Modules/GrSwig.cmake b/cmake/Modules/GrSwig.cmake
index b71443d633..39585ac4be 100644
--- a/cmake/Modules/GrSwig.cmake
+++ b/cmake/Modules/GrSwig.cmake
@@ -1,4 +1,4 @@
-# Copyright 2010-2011 Free Software Foundation, Inc.
+# Copyright 2010-2011,2019 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -111,40 +111,12 @@ macro(GR_SWIG_MAKE name)
list(APPEND GR_SWIG_DOCS_TARGET_DEPS ${GR_SWIG_TARGET_DEPS})
GR_SWIG_MAKE_DOCS(${GR_SWIG_DOC_FILE} ${GR_SWIG_DOC_DIRS})
add_custom_target(${name}_swig_doc DEPENDS ${GR_SWIG_DOC_FILE})
- list(APPEND GR_SWIG_TARGET_DEPS ${name}_swig_doc ${GR_RUNTIME_SWIG_DOC_FILE})
+ list(APPEND GR_SWIG_TARGET_DEPS ${name}_swig_doc)
endif()
- #append additional include directories
- list(APPEND GR_SWIG_INCLUDE_DIRS ${PYTHON_INCLUDE_PATH}) #deprecated name (now dirs)
- list(APPEND GR_SWIG_INCLUDE_DIRS ${PYTHON_INCLUDE_DIRS})
-
#prepend local swig directories
- list(INSERT GR_SWIG_INCLUDE_DIRS 0 ${CMAKE_CURRENT_SOURCE_DIR})
- list(INSERT GR_SWIG_INCLUDE_DIRS 0 ${CMAKE_CURRENT_BINARY_DIR})
-
- #determine include dependencies for swig file
- execute_process(
- COMMAND ${PYTHON_EXECUTABLE}
- ${CMAKE_BINARY_DIR}/get_swig_deps.py
- "${ifiles}" "${GR_SWIG_INCLUDE_DIRS}"
- OUTPUT_STRIP_TRAILING_WHITESPACE
- OUTPUT_VARIABLE SWIG_MODULE_${name}_EXTRA_DEPS
- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
- )
-
- #Create a dummy custom command that depends on other targets
- include(GrMiscUtils)
- GR_GEN_TARGET_DEPS(_${name}_swig_tag tag_deps ${GR_SWIG_TARGET_DEPS})
- set(tag_file ${CMAKE_CURRENT_BINARY_DIR}/${name}.tag)
- add_custom_command(
- OUTPUT ${tag_file}
- DEPENDS ${GR_SWIG_SOURCE_DEPS} ${tag_deps}
- COMMAND ${CMAKE_COMMAND} -E touch ${tag_file}
- )
-
- #append the specified include directories
- include_directories(${GR_SWIG_INCLUDE_DIRS})
- list(APPEND SWIG_MODULE_${name}_EXTRA_DEPS ${tag_file})
+ list(INSERT GR_SWIG_INCLUDE_DIRS 0 "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>")
+ list(INSERT GR_SWIG_INCLUDE_DIRS 0 "$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>")
if (PYTHON3)
set(py3 "-py3")
@@ -158,17 +130,16 @@ macro(GR_SWIG_MAKE name)
#setup the actual swig library target to be built
include(UseSWIG)
- SWIG_ADD_MODULE(${name} python ${ifiles})
- if(APPLE)
- set(PYTHON_LINK_OPTIONS "-undefined dynamic_lookup")
- else()
- set(PYTHON_LINK_OPTIONS ${PYTHON_LIBRARIES})
- endif(APPLE)
- SWIG_LINK_LIBRARIES(${name} ${PYTHON_LINK_OPTIONS} ${GR_SWIG_LIBRARIES})
+ swig_add_library(${name} LANGUAGE python SOURCES ${ifiles})
if(${name} STREQUAL "runtime_swig")
- SET_TARGET_PROPERTIES(${SWIG_MODULE_runtime_swig_REAL_NAME} PROPERTIES DEFINE_SYMBOL "gnuradio_runtime_EXPORTS")
+ set_target_properties(runtime_swig PROPERTIES DEFINE_SYMBOL "gnuradio_runtime_EXPORTS")
endif(${name} STREQUAL "runtime_swig")
-
+ set_target_properties(${name} PROPERTIES
+ SWIG_USE_TARGET_INCLUDE_DIRECTORIES TRUE
+ )
+ target_include_directories(${name} PUBLIC ${GR_SWIG_INCLUDE_DIRS})
+ set_property(TARGET ${name} PROPERTY SWIG_DEPENDS ${GR_SWIG_TARGET_DEPS})
+ target_link_libraries(${name} Python::Python ${GR_SWIG_LIBRARIES})
endmacro(GR_SWIG_MAKE)
########################################################################
@@ -184,58 +155,16 @@ macro(GR_SWIG_INSTALL)
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}
+ install(TARGETS ${name}
+ DESTINATION ${GR_SWIG_INSTALL_DESTINATION}
)
include(GrPython)
GR_PYTHON_INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${name}.py
- DESTINATION ${GR_SWIG_INSTALL_DESTINATION}
- )
-
- GR_LIBTOOL(
- TARGET ${SWIG_MODULE_${name}_REAL_NAME}
- DESTINATION ${GR_SWIG_INSTALL_DESTINATION}
+ DESTINATION ${GR_SWIG_INSTALL_DESTINATION}
+ DEPENDS ${name}
)
endforeach(name)
endmacro(GR_SWIG_INSTALL)
-
-########################################################################
-# Generate a python file that can determine swig dependencies.
-# Used by the make macro above to determine extra dependencies.
-# When you build C++, CMake figures out the header dependencies.
-# This code essentially performs that logic for swig includes.
-########################################################################
-file(WRITE ${CMAKE_BINARY_DIR}/get_swig_deps.py "
-
-import os, sys, re, io
-
-i_include_matcher = re.compile(r'%(include|import)\\s*[<|\"](.*)[>|\"]')
-h_include_matcher = re.compile(r'#(include)\\s*[<|\"](.*)[>|\"]')
-include_dirs = sys.argv[2].split(';')
-
-def get_swig_incs(file_path):
- if file_path.endswith('.i'): matcher = i_include_matcher
- else: matcher = h_include_matcher
- file_contents = io.open(file_path, 'r', encoding='utf-8').read()
- return matcher.findall(file_contents, re.MULTILINE)
-
-def get_swig_deps(file_path, level):
- deps = [file_path]
- if level == 0: return deps
- for keyword, inc_file in get_swig_incs(file_path):
- for inc_dir in include_dirs:
- inc_path = os.path.join(inc_dir, inc_file)
- if not os.path.exists(inc_path): continue
- deps.extend(get_swig_deps(inc_path, level-1))
- break #found, we don't search in lower prio inc dirs
- return deps
-
-if __name__ == '__main__':
- ifiles = sys.argv[1].split(';')
- deps = sum([get_swig_deps(ifile, 3) for ifile in ifiles], [])
- #sys.stderr.write(';'.join(set(deps)) + '\\n\\n')
- print(';'.join(set(deps)))
-")
diff --git a/cmake/Modules/GrTest.cmake b/cmake/Modules/GrTest.cmake
index 3ab88b61e0..5de7476f3f 100644
--- a/cmake/Modules/GrTest.cmake
+++ b/cmake/Modules/GrTest.cmake
@@ -154,6 +154,7 @@ function(GR_ADD_CPP_TEST test_name test_source)
target_link_libraries(
${test_name}
${GR_TEST_TARGET_DEPS}
+ Boost::unit_test_framework
)
set_target_properties(${test_name}
PROPERTIES COMPILE_DEFINITIONS "BOOST_TEST_DYN_LINK;BOOST_TEST_MAIN"
diff --git a/cmake/Modules/UseSWIG.cmake b/cmake/Modules/UseSWIG.cmake
index a37cc41ae4..302e8f370e 100644
--- a/cmake/Modules/UseSWIG.cmake
+++ b/cmake/Modules/UseSWIG.cmake
@@ -1,62 +1,230 @@
-# - SWIG module for CMake
-# Defines the following macros:
-# SWIG_ADD_MODULE(name language [ files ])
-# - Define swig module with given name and specified language
-# SWIG_LINK_LIBRARIES(name [ libraries ])
-# - Link libraries to swig module
-# All other macros are for internal use only.
-# To get the actual name of the swig module,
-# use: ${SWIG_MODULE_${name}_REAL_NAME}.
-# Set Source files properties such as CPLUSPLUS and SWIG_FLAGS to specify
-# special behavior of SWIG. Also global CMAKE_SWIG_FLAGS can be used to add
-# special flags to all swig calls.
-# Another special variable is CMAKE_SWIG_OUTDIR, it allows one to specify
-# where to write all the swig generated module (swig -outdir option)
-# The name-specific variable SWIG_MODULE_<name>_EXTRA_DEPS may be used
-# to specify extra dependencies for the generated modules.
-# If the source file generated by swig need some special flag you can use
-# set_source_files_properties( ${swig_generated_file_fullname}
-# PROPERTIES COMPILE_FLAGS "-bla")
-
-
-#=============================================================================
-# Copyright 2004-2009 Kitware, Inc.
-# Copyright 2009 Mathieu Malaterre <mathieu.malaterre@gmail.com>
-#
-# Distributed under the OSI-approved BSD License (the "License");
-# see accompanying file Copyright.txt for details.
-#
-# This software is distributed WITHOUT ANY WARRANTY; without even the
-# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-# See the License for more information.
-#=============================================================================
-# (To distribute this file outside of CMake, substitute the full
-# License text for the above reference.)
+# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+# file Copyright.txt or https://cmake.org/licensing for details.
+
+#[=======================================================================[.rst:
+UseSWIG
+-------
+
+This file provides support for ``SWIG``. It is assumed that :module:`FindSWIG`
+module has already been loaded.
+
+Defines the following command for use with ``SWIG``:
+
+.. command:: swig_add_library
+
+ Define swig module with given name and specified language::
+
+ swig_add_library(<name>
+ [TYPE <SHARED|MODULE|STATIC|USE_BUILD_SHARED_LIBS>]
+ LANGUAGE <language>
+ [NO_PROXY]
+ [OUTPUT_DIR <directory>]
+ [OUTFILE_DIR <directory>]
+ SOURCES <file>...
+ )
+
+ Targets created with the ``swig_add_library`` command have the same
+ capabilities as targets created with the :command:`add_library` command, so
+ those targets can be used with any command expecting a target (e.g.
+ :command:`target_link_libraries`).
+
+ .. note::
+
+ For multi-config generators, this module does not support
+ configuration-specific files generated by ``SWIG``. All build
+ configurations must result in the same generated source file.
+
+ ``TYPE``
+ ``SHARED``, ``MODULE`` and ``STATIC`` have the same semantic as for the
+ :command:`add_library` command. If ``USE_BUILD_SHARED_LIBS`` is specified,
+ the library type will be ``STATIC`` or ``SHARED`` based on whether the
+ current value of the :variable:`BUILD_SHARED_LIBS` variable is ``ON``. If
+ no type is specified, ``MODULE`` will be used.
+
+ ``LANGUAGE``
+ Specify the target language.
+
+ ``NO_PROXY``
+ Prevent the generation of the wrapper layer (swig ``-noproxy`` option).
+
+ ``OUTPUT_DIR``
+ Specify where to write the language specific files (swig ``-outdir``
+ option). If not given, the ``CMAKE_SWIG_OUTDIR`` variable will be used.
+ If neither is specified, the default depends on the value of the
+ ``UseSWIG_MODULE_VERSION`` variable as follows:
+
+ * If ``UseSWIG_MODULE_VERSION`` is 1 or is undefined, output is written to
+ the :variable:`CMAKE_CURRENT_BINARY_DIR` directory.
+ * If ``UseSWIG_MODULE_VERSION`` is 2, a dedicated directory will be used.
+ The path of this directory can be retrieved from the
+ ``SWIG_SUPPORT_FILES_DIRECTORY`` target property.
+
+ ``OUTFILE_DIR``
+ Specify an output directory name where the generated source file will be
+ placed (swig -o option). If not specified, the ``SWIG_OUTFILE_DIR`` variable
+ will be used. If neither is specified, ``OUTPUT_DIR`` or
+ ``CMAKE_SWIG_OUTDIR`` is used instead.
+
+ ``SOURCES``
+ List of sources for the library. Files with extension ``.i`` will be
+ identified as sources for the ``SWIG`` tool. Other files will be handled in
+ the standard way.
+
+.. note::
+
+ If ``UseSWIG_MODULE_VERSION`` is set to 2, it is **strongly** recommended
+ to use a dedicated directory unique to the target when either the
+ ``OUTPUT_DIR`` option or the ``CMAKE_SWIG_OUTDIR`` variable are specified.
+ The output directory contents are erased as part of the target build, so
+ to prevent interference between targets or losing other important files, each
+ target should have its own dedicated output directory.
+
+Source file properties on module files **must** be set before the invocation
+of the ``swig_add_library`` command to specify special behavior of SWIG and
+ensure generated files will receive the required settings.
+
+``CPLUSPLUS``
+ Call SWIG in c++ mode. For example:
+
+ .. code-block:: cmake
+
+ set_property(SOURCE mymod.i PROPERTY CPLUSPLUS ON)
+ swig_add_library(mymod LANGUAGE python SOURCES mymod.i)
+
+``INCLUDE_DIRECTORIES``, ``COMPILE_DEFINITIONS`` and ``COMPILE_OPTIONS``
+ Add custom flags to SWIG compiler and have same semantic as properties
+ :prop_sf:`INCLUDE_DIRECTORIES`, :prop_sf:`COMPILE_DEFINITIONS` and
+ :prop_sf:`COMPILE_OPTIONS`.
+
+``GENERATED_INCLUDE_DIRECTORIES``, ``GENERATED_COMPILE_DEFINITIONS`` and ``GENERATED_COMPILE_OPTIONS``
+ Add custom flags to the C/C++ generated source. They will fill, respectively,
+ properties :prop_sf:`INCLUDE_DIRECTORIES`, :prop_sf:`COMPILE_DEFINITIONS` and
+ :prop_sf:`COMPILE_OPTIONS` of generated C/C++ file.
+
+``DEPENDS``
+ Specify additional dependencies to the source file.
+
+``SWIG_MODULE_NAME``
+ Specify the actual import name of the module in the target language.
+ This is required if it cannot be scanned automatically from source
+ or different from the module file basename. For example:
+
+ .. code-block:: cmake
+
+ set_property(SOURCE mymod.i PROPERTY SWIG_MODULE_NAME mymod_realname)
+
+Target library properties can be set to apply same configuration to all SWIG
+input files.
+
+``SWIG_INCLUDE_DIRECTORIES``, ``SWIG_COMPILE_DEFINITIONS`` and ``SWIG_COMPILE_OPTIONS``
+ These properties will be applied to all SWIG input files and have same
+ semantic as target properties :prop_tgt:`INCLUDE_DIRECTORIES`,
+ :prop_tgt:`COMPILE_DEFINITIONS` and :prop_tgt:`COMPILE_OPTIONS`.
+
+ .. code-block:: cmake
+
+ swig_add_library(mymod LANGUAGE python SOURCES mymod.i)
+ set_property(TARGET mymod PROPERTY SWIG_COMPILE_DEFINITIONS MY_DEF1 MY_DEF2)
+ set_property(TARGET mymod PROPERTY SWIG_COMPILE_OPTIONS -bla -blb)
+
+``SWIG_GENERATED_INCLUDE_DIRECTORIES``, ``SWIG_GENERATED_COMPILE_DEFINITIONS`` and ``SWIG_GENERATED_COMPILE_OPTIONS``
+ These properties will populate, respectively, properties
+ :prop_sf:`INCLUDE_DIRECTORIES`, :prop_sf:`COMPILE_DEFINITIONS` and
+ :prop_sf:`COMPILE_FLAGS` of all generated C/C++ files.
+
+``SWIG_DEPENDS``
+ Add dependencies to all SWIG input files.
+
+The following target properties are output properties and can be used to get
+information about support files generated by ``SWIG`` interface compilation.
+
+``SWIG_SUPPORT_FILES``
+ This output property list of wrapper files generated during SWIG compilation.
+
+ .. code-block:: cmake
+
+ swig_add_library(mymod LANGUAGE python SOURCES mymod.i)
+ get_property(support_files TARGET mymod PROPERTY SWIG_SUPPORT_FILES)
+
+ .. note::
+
+ Only most principal support files are listed. In case some advanced
+ features of ``SWIG`` are used (for example ``%template``), associated
+ support files may not be listed. Prefer to use the
+ ``SWIG_SUPPORT_FILES_DIRECTORY`` property to handle support files.
+
+``SWIG_SUPPORT_FILES_DIRECTORY``
+ This output property specifies the directory where support files will be
+ generated.
+
+Some variables can be set to customize the behavior of ``swig_add_library``
+as well as ``SWIG``:
+
+``UseSWIG_MODULE_VERSION``
+ Specify different behaviors for ``UseSWIG`` module.
+
+ * Set to 1 or undefined: Legacy behavior is applied.
+ * Set to 2: A new strategy is applied regarding support files: the output
+ directory of support files is erased before ``SWIG`` interface compilation.
+
+``CMAKE_SWIG_FLAGS``
+ Add flags to all swig calls.
+
+``CMAKE_SWIG_OUTDIR``
+ Specify where to write the language specific files (swig ``-outdir`` option).
+
+``SWIG_OUTFILE_DIR``
+ Specify an output directory name where the generated source file will be
+ placed. If not specified, ``CMAKE_SWIG_OUTDIR`` is used.
+
+``SWIG_MODULE_<name>_EXTRA_DEPS``
+ Specify extra dependencies for the generated module for ``<name>``.
+#]=======================================================================]
+
+
+cmake_policy (VERSION 3.8)
set(SWIG_CXX_EXTENSION "cxx")
set(SWIG_EXTRA_LIBRARIES "")
-set(SWIG_PYTHON_EXTRA_FILE_EXTENSION "py")
+set(SWIG_PYTHON_EXTRA_FILE_EXTENSIONS ".py")
+set(SWIG_JAVA_EXTRA_FILE_EXTENSIONS ".java" "JNI.java")
+
+##
+## PRIVATE functions
+##
+function (__SWIG_COMPUTE_TIMESTAMP name language infile workingdir __timestamp)
+ get_filename_component(filename "${infile}" NAME_WE)
+ set(${__timestamp}
+ "${workingdir}/${filename}${language}.stamp" PARENT_SCOPE)
+ # get_filename_component(filename "${infile}" ABSOLUTE)
+ # string(UUID uuid NAMESPACE 9735D882-D2F8-4E1D-88C9-A0A4F1F6ECA4
+ # NAME ${name}-${language}-${filename} TYPE SHA1)
+ # set(${__timestamp} "${workingdir}/${uuid}.stamp" PARENT_SCOPE)
+endfunction()
#
# For given swig module initialize variables associated with it
#
macro(SWIG_MODULE_INITIALIZE name language)
- string(TOUPPER "${language}" swig_uppercase_language)
- string(TOLOWER "${language}" swig_lowercase_language)
- set(SWIG_MODULE_${name}_LANGUAGE "${swig_uppercase_language}")
- set(SWIG_MODULE_${name}_SWIG_LANGUAGE_FLAG "${swig_lowercase_language}")
+ string(TOUPPER "${language}" SWIG_MODULE_${name}_LANGUAGE)
+ string(TOLOWER "${language}" SWIG_MODULE_${name}_SWIG_LANGUAGE_FLAG)
+
+ set(SWIG_MODULE_${name}_EXTRA_FLAGS)
+ if (NOT DEFINED SWIG_MODULE_${name}_NOPROXY)
+ set (SWIG_MODULE_${name}_NOPROXY FALSE)
+ endif()
+ if ("-noproxy" IN_LIST CMAKE_SWIG_FLAGS)
+ set (SWIG_MODULE_${name}_NOPROXY TRUE)
+ endif ()
- set(SWIG_MODULE_${name}_REAL_NAME "${name}")
- if("${SWIG_MODULE_${name}_LANGUAGE}" STREQUAL "UNKNOWN")
+ if (SWIG_MODULE_${name}_NOPROXY AND NOT "-noproxy" IN_LIST CMAKE_SWIG_FLAGS)
+ list (APPEND SWIG_MODULE_${name}_EXTRA_FLAGS "-noproxy")
+ endif()
+ if(SWIG_MODULE_${name}_LANGUAGE STREQUAL "UNKNOWN")
message(FATAL_ERROR "SWIG Error: Language \"${language}\" not found")
- elseif("${SWIG_MODULE_${name}_LANGUAGE}" STREQUAL "PYTHON")
- # when swig is used without the -interface it will produce in the module.py
- # a 'import _modulename' statement, which implies having a corresponding
- # _modulename.so (*NIX), _modulename.pyd (Win32).
- set(SWIG_MODULE_${name}_REAL_NAME "_${name}")
- elseif("${SWIG_MODULE_${name}_LANGUAGE}" STREQUAL "PERL")
- set(SWIG_MODULE_${name}_EXTRA_FLAGS "-shadow")
+ elseif(SWIG_MODULE_${name}_LANGUAGE STREQUAL "PERL")
+ list(APPEND SWIG_MODULE_${name}_EXTRA_FLAGS "-shadow")
endif()
endmacro()
@@ -65,220 +233,387 @@ endmacro()
# will be generated. This is internal swig macro.
#
-macro(SWIG_GET_EXTRA_OUTPUT_FILES language outfiles generatedpath infile)
- set(${outfiles} "")
- get_source_file_property(SWIG_GET_EXTRA_OUTPUT_FILES_module_basename
- ${infile} SWIG_MODULE_NAME)
- if(SWIG_GET_EXTRA_OUTPUT_FILES_module_basename STREQUAL "NOTFOUND")
- get_filename_component(SWIG_GET_EXTRA_OUTPUT_FILES_module_basename "${infile}" NAME_WE)
+function(SWIG_GET_EXTRA_OUTPUT_FILES language outfiles generatedpath infile)
+ set(files)
+ get_source_file_property(module_basename
+ "${infile}" SWIG_MODULE_NAME)
+ if(NOT swig_module_basename)
+
+ # try to get module name from "%module foo" syntax
+ if ( EXISTS "${infile}" )
+ file ( STRINGS "${infile}" module_basename REGEX "[ ]*%module[ ]*[a-zA-Z0-9_]+.*" )
+ endif ()
+ if ( module_basename )
+ string ( REGEX REPLACE "[ ]*%module[ ]*([a-zA-Z0-9_]+).*" "\\1" module_basename "${module_basename}" )
+
+ else ()
+ # try to get module name from "%module (options=...) foo" syntax
+ if ( EXISTS "${infile}" )
+ file ( STRINGS "${infile}" module_basename REGEX "[ ]*%module[ ]*\\(.*\\)[ ]*[a-zA-Z0-9_]+.*" )
+ endif ()
+ if ( module_basename )
+ string ( REGEX REPLACE "[ ]*%module[ ]*\\(.*\\)[ ]*([a-zA-Z0-9_]+).*" "\\1" module_basename "${module_basename}" )
+
+ else ()
+ # fallback to file basename
+ get_filename_component(module_basename "${infile}" NAME_WE)
+ endif ()
+ endif ()
+
endif()
- foreach(it ${SWIG_${language}_EXTRA_FILE_EXTENSION})
- set(${outfiles} ${${outfiles}}
- "${generatedpath}/${SWIG_GET_EXTRA_OUTPUT_FILES_module_basename}.${it}")
+ foreach(it ${SWIG_${language}_EXTRA_FILE_EXTENSIONS})
+ set(extra_file "${generatedpath}/${module_basename}${it}")
+ list(APPEND files "${extra_file}")
endforeach()
-endmacro()
+ # Treat extra outputs as plain files regardless of language.
+ set_source_files_properties(${files} PROPERTIES LANGUAGE "")
+
+ set (${outfiles} ${files} PARENT_SCOPE)
+endfunction()
#
# Take swig (*.i) file and add proper custom commands for it
#
-macro(SWIG_ADD_SOURCE_TO_MODULE name outfiles infile)
- set(swig_full_infile ${infile})
- get_filename_component(swig_source_file_path "${infile}" PATH)
+function(SWIG_ADD_SOURCE_TO_MODULE name outfiles infile)
get_filename_component(swig_source_file_name_we "${infile}" NAME_WE)
- get_source_file_property(swig_source_file_generated ${infile} GENERATED)
- get_source_file_property(swig_source_file_cplusplus ${infile} CPLUSPLUS)
- get_source_file_property(swig_source_file_flags ${infile} SWIG_FLAGS)
- if("${swig_source_file_flags}" STREQUAL "NOTFOUND")
- set(swig_source_file_flags "")
- endif()
- set(swig_source_file_fullname "${infile}")
- if(${swig_source_file_path} MATCHES "^${CMAKE_CURRENT_SOURCE_DIR}")
- string(REGEX REPLACE
- "^${CMAKE_CURRENT_SOURCE_DIR}" ""
- swig_source_file_relative_path
- "${swig_source_file_path}")
+ get_source_file_property(swig_source_file_cplusplus "${infile}" CPLUSPLUS)
+
+ # If CMAKE_SWIG_OUTDIR was specified then pass it to -outdir
+ if(CMAKE_SWIG_OUTDIR)
+ set(outdir ${CMAKE_SWIG_OUTDIR})
else()
- if(${swig_source_file_path} MATCHES "^${CMAKE_CURRENT_BINARY_DIR}")
- string(REGEX REPLACE
- "^${CMAKE_CURRENT_BINARY_DIR}" ""
- swig_source_file_relative_path
- "${swig_source_file_path}")
- set(swig_source_file_generated 1)
- else()
- set(swig_source_file_relative_path "${swig_source_file_path}")
- if(swig_source_file_generated)
- set(swig_source_file_fullname "${CMAKE_CURRENT_BINARY_DIR}/${infile}")
- else()
- set(swig_source_file_fullname "${CMAKE_CURRENT_SOURCE_DIR}/${infile}")
- endif()
- endif()
+ set(outdir ${CMAKE_CURRENT_BINARY_DIR})
endif()
- set(swig_generated_file_fullname
- "${CMAKE_CURRENT_BINARY_DIR}")
- if(swig_source_file_relative_path)
- set(swig_generated_file_fullname
- "${swig_generated_file_fullname}/${swig_source_file_relative_path}")
+ if(SWIG_OUTFILE_DIR)
+ set(outfiledir ${SWIG_OUTFILE_DIR})
+ else()
+ set(outfiledir ${outdir})
endif()
- # If CMAKE_SWIG_OUTDIR was specified then pass it to -outdir
- if(CMAKE_SWIG_OUTDIR)
- set(swig_outdir ${CMAKE_SWIG_OUTDIR})
+
+ if(SWIG_WORKING_DIR)
+ set (workingdir "${SWIG_WORKING_DIR}")
else()
- set(swig_outdir ${CMAKE_CURRENT_BINARY_DIR})
+ set(workingdir "${outdir}")
+ endif()
+
+ set (swig_source_file_flags ${CMAKE_SWIG_FLAGS})
+ # handle various swig compile flags properties
+ get_source_file_property (include_directories "${infile}" INCLUDE_DIRECTORIES)
+ if (include_directories)
+ list (APPEND swig_source_file_flags "$<$<BOOL:${include_directories}>:-I$<JOIN:${include_directories},$<SEMICOLON>-I>>")
+ endif()
+ set (property "$<TARGET_PROPERTY:${name},SWIG_INCLUDE_DIRECTORIES>")
+ list (APPEND swig_source_file_flags "$<$<BOOL:${property}>:-I$<JOIN:${property},$<SEMICOLON>-I>>")
+
+ set (property "$<TARGET_PROPERTY:${name},INCLUDE_DIRECTORIES>")
+ list (APPEND swig_source_file_flags "$<$<BOOL:${property}>:-I$<JOIN:${property},$<SEMICOLON>-I>>")
+
+ set (property "$<TARGET_PROPERTY:${name},INCLUDE_DIRECTORIES>")
+ get_source_file_property(use_target_include_dirs "${infile}" USE_TARGET_INCLUDE_DIRECTORIES)
+ if (use_target_include_dirs)
+ list (APPEND swig_source_file_flags "$<$<BOOL:${property}>:-I$<JOIN:${property},$<SEMICOLON>-I>>")
+ elseif(use_target_include_dirs STREQUAL "NOTFOUND")
+ # not defined at source level, rely on target level
+ list (APPEND swig_source_file_flags "$<$<AND:$<BOOL:$<TARGET_PROPERTY:${name},SWIG_USE_TARGET_INCLUDE_DIRECTORIES>>,$<BOOL:${property}>>:-I$<JOIN:${property},$<SEMICOLON>-I>>")
+ endif()
+
+ set (property "$<TARGET_PROPERTY:${name},SWIG_COMPILE_DEFINITIONS>")
+ list (APPEND swig_source_file_flags "$<$<BOOL:${property}>:-D$<JOIN:${property},$<SEMICOLON>-D>>")
+ get_source_file_property (compile_definitions "${infile}" COMPILE_DEFINITIONS)
+ if (compile_definitions)
+ list (APPEND swig_source_file_flags "$<$<BOOL:${compile_definitions}>:-D$<JOIN:${compile_definitions},$<SEMICOLON>-D>>")
+ endif()
+
+ list (APPEND swig_source_file_flags "$<TARGET_PROPERTY:${name},SWIG_COMPILE_OPTIONS>")
+ get_source_file_property (compile_options "${infile}" COMPILE_OPTIONS)
+ if (compile_options)
+ list (APPEND swig_source_file_flags ${compile_options})
+ endif()
+
+ # legacy support
+ get_source_file_property (swig_flags "${infile}" SWIG_FLAGS)
+ if (swig_flags)
+ list (APPEND swig_source_file_flags ${swig_flags})
+ endif()
+
+ get_filename_component(swig_source_file_fullname "${infile}" ABSOLUTE)
+
+ if (NOT SWIG_MODULE_${name}_NOPROXY)
+ SWIG_GET_EXTRA_OUTPUT_FILES(${SWIG_MODULE_${name}_LANGUAGE}
+ swig_extra_generated_files
+ "${outdir}"
+ "${swig_source_file_fullname}")
endif()
- SWIG_GET_EXTRA_OUTPUT_FILES(${SWIG_MODULE_${name}_LANGUAGE}
- swig_extra_generated_files
- "${swig_outdir}"
- "${infile}")
set(swig_generated_file_fullname
- "${swig_generated_file_fullname}/${swig_source_file_name_we}")
+ "${outfiledir}/${swig_source_file_name_we}")
# add the language into the name of the file (i.e. TCL_wrap)
# this allows for the same .i file to be wrapped into different languages
- set(swig_generated_file_fullname
- "${swig_generated_file_fullname}${SWIG_MODULE_${name}_LANGUAGE}_wrap")
+ string(APPEND swig_generated_file_fullname
+ "${SWIG_MODULE_${name}_LANGUAGE}_wrap")
if(swig_source_file_cplusplus)
- set(swig_generated_file_fullname
- "${swig_generated_file_fullname}.${SWIG_CXX_EXTENSION}")
+ string(APPEND swig_generated_file_fullname
+ ".${SWIG_CXX_EXTENSION}")
else()
- set(swig_generated_file_fullname
- "${swig_generated_file_fullname}.c")
- endif()
-
- # Shut up some warnings from poor SWIG code generation that we
- # can do nothing about, when this flag is available
- include(CheckCXXCompilerFlag)
- check_cxx_compiler_flag("-Wno-unused-but-set-variable" HAVE_WNO_UNUSED_BUT_SET_VARIABLE)
- if(HAVE_WNO_UNUSED_BUT_SET_VARIABLE)
- set_source_files_properties(${swig_generated_file_fullname}
- PROPERTIES COMPILE_FLAGS "-Wno-unused-but-set-variable")
- endif(HAVE_WNO_UNUSED_BUT_SET_VARIABLE)
-
- get_directory_property(cmake_include_directories INCLUDE_DIRECTORIES)
- list(REMOVE_DUPLICATES cmake_include_directories)
- set(swig_include_dirs)
- foreach(it ${cmake_include_directories})
- set(swig_include_dirs ${swig_include_dirs} "-I${it}")
- endforeach()
+ string(APPEND swig_generated_file_fullname
+ ".c")
+ endif()
+
+ get_directory_property (cmake_include_directories INCLUDE_DIRECTORIES)
+ list (REMOVE_DUPLICATES cmake_include_directories)
+ set (swig_include_dirs)
+ if (cmake_include_directories)
+ set (swig_include_dirs "$<$<BOOL:${cmake_include_directories}>:-I$<JOIN:${cmake_include_directories},$<SEMICOLON>-I>>")
+ endif()
set(swig_special_flags)
# default is c, so add c++ flag if it is c++
if(swig_source_file_cplusplus)
- set(swig_special_flags ${swig_special_flags} "-c++")
- endif()
- set(swig_extra_flags)
- if(SWIG_MODULE_${name}_EXTRA_FLAGS)
- set(swig_extra_flags ${swig_extra_flags} ${SWIG_MODULE_${name}_EXTRA_FLAGS})
+ list (APPEND swig_special_flags "-c++")
endif()
- # hack to work around CMake bug in add_custom_command with multiple OUTPUT files
+ set (swig_extra_flags)
+ if(SWIG_MODULE_${name}_LANGUAGE STREQUAL "CSHARP")
+ if(NOT ("-dllimport" IN_LIST swig_source_file_flags OR "-dllimport" IN_LIST SWIG_MODULE_${name}_EXTRA_FLAGS))
+ # This makes sure that the name used in the generated DllImport
+ # matches the library name created by CMake
+ list (APPEND SWIG_MODULE_${name}_EXTRA_FLAGS "-dllimport" "${name}")
+ endif()
+ endif()
+ list (APPEND swig_extra_flags ${SWIG_MODULE_${name}_EXTRA_FLAGS})
- file(RELATIVE_PATH reldir ${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR})
- execute_process(
- COMMAND ${PYTHON_EXECUTABLE} -c "import re, hashlib
-unique = hashlib.md5(b'${reldir}${ARGN}').hexdigest()[:5]
-print(re.sub('\\W', '_', '${name} ${reldir} ' + unique))"
- OUTPUT_VARIABLE _target OUTPUT_STRIP_TRAILING_WHITESPACE
- )
+ # dependencies
+ set (swig_dependencies ${SWIG_MODULE_${name}_EXTRA_DEPS} $<TARGET_PROPERTY:${name},SWIG_DEPENDS>)
+ get_source_file_property(file_depends "${infile}" DEPENDS)
+ if (file_depends)
+ list (APPEND swig_dependencies ${file_depends})
+ endif()
- file(
- WRITE ${CMAKE_CURRENT_BINARY_DIR}/${_target}.cpp.in
- "int main(void){return 0;}\n"
- )
+ if (UseSWIG_MODULE_VERSION VERSION_GREATER 1)
+ # as part of custom command, start by removing old generated files
+ # to ensure obsolete files do not stay
+ set (swig_cleanup_command COMMAND "${CMAKE_COMMAND}" -E remove_directory "${outdir}")
+ else()
+ unset (swig_cleanup_command)
+ endif()
- # create dummy dependencies
- add_custom_command(
- OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_target}.cpp
- COMMAND ${CMAKE_COMMAND} -E copy
- ${CMAKE_CURRENT_BINARY_DIR}/${_target}.cpp.in
- ${CMAKE_CURRENT_BINARY_DIR}/${_target}.cpp
- DEPENDS "${swig_source_file_fullname}" ${SWIG_MODULE_${name}_EXTRA_DEPS}
- COMMENT ""
- )
-
- # create the dummy target
- add_executable(${_target} ${CMAKE_CURRENT_BINARY_DIR}/${_target}.cpp)
-
- # add a custom command to the dummy target
+ # IMPLICIT_DEPENDS below can not handle situations where a dependent file is
+ # removed. We need an extra step with timestamp and custom target, see #16830
+ # As this is needed only for Makefile generator do it conditionally
+ if(CMAKE_GENERATOR MATCHES "Make")
+ __swig_compute_timestamp(${name} ${SWIG_MODULE_${name}_LANGUAGE}
+ "${infile}" "${workingdir}" swig_generated_timestamp)
+ set(swig_custom_output "${swig_generated_timestamp}")
+ set(swig_custom_products
+ BYPRODUCTS "${swig_generated_file_fullname}" ${swig_extra_generated_files})
+ set(swig_timestamp_command
+ COMMAND ${CMAKE_COMMAND} -E touch "${swig_generated_timestamp}")
+ else()
+ set(swig_custom_output
+ "${swig_generated_file_fullname}" ${swig_extra_generated_files})
+ set(swig_custom_products)
+ set(swig_timestamp_command)
+ endif()
add_custom_command(
- TARGET ${_target}
- # Let's create the ${swig_outdir} at execution time, in case dir contains $(OutDir)
- COMMAND ${CMAKE_COMMAND} -E make_directory ${swig_outdir}
- COMMAND "${SWIG_EXECUTABLE}"
- ARGS "-${SWIG_MODULE_${name}_SWIG_LANGUAGE_FLAG}"
- ${swig_source_file_flags}
- ${CMAKE_SWIG_FLAGS}
- -outdir ${swig_outdir}
+ OUTPUT ${swig_custom_output}
+ ${swig_custom_products}
+ ${swig_cleanup_command}
+ # Let's create the ${outdir} at execution time, in case dir contains $(OutDir)
+ COMMAND "${CMAKE_COMMAND}" -E make_directory ${outdir} ${outfiledir}
+ ${swig_timestamp_command}
+ COMMAND "${CMAKE_COMMAND}" -E env "SWIG_LIB=${SWIG_DIR}" "${SWIG_EXECUTABLE}"
+ "-${SWIG_MODULE_${name}_SWIG_LANGUAGE_FLAG}"
+ "${swig_source_file_flags}"
+ -outdir "${outdir}"
${swig_special_flags}
${swig_extra_flags}
- ${swig_include_dirs}
+ "${swig_include_dirs}"
-o "${swig_generated_file_fullname}"
"${swig_source_file_fullname}"
+ MAIN_DEPENDENCY "${swig_source_file_fullname}"
+ DEPENDS ${swig_dependencies}
+ IMPLICIT_DEPENDS CXX "${swig_source_file_fullname}"
COMMENT "Swig source"
- )
+ COMMAND_EXPAND_LISTS)
+ set_source_files_properties("${swig_generated_file_fullname}" ${swig_extra_generated_files}
+ PROPERTIES GENERATED 1)
- #add dummy independent dependencies from the _target to each file
- #that will be generated by the SWIG command above
+ ## add all properties for generated file to various properties
+ get_property (include_directories SOURCE "${infile}" PROPERTY GENERATED_INCLUDE_DIRECTORIES)
+ set_property (SOURCE "${swig_generated_file_fullname}" PROPERTY INCLUDE_DIRECTORIES ${include_directories} $<TARGET_PROPERTY:${name},SWIG_GENERATED_INCLUDE_DIRECTORIES>)
- set(${outfiles} "${swig_generated_file_fullname}" ${swig_extra_generated_files})
+ # get_property (compile_definitions SOURCE "${infile}" PROPERTY GENERATED_COMPILE_DEFINITIONS)
+ # set_property (SOURCE "${swig_generated_file_fullname}" PROPERTY COMPILE_DEFINITIONS $<TARGET_PROPERTY:${name},SWIG_GENERATED_COMPILE_DEFINITIONS> ${compile_definitions})
- foreach(swig_gen_file ${${outfiles}})
- add_custom_command(
- OUTPUT ${swig_gen_file}
- COMMAND "${CMAKE_COMMAND}" -E touch_nocreate "${swig_gen_file}"
- DEPENDS ${_target}
- COMMENT "dummy command to show ${_target} dependency of ${swig_gen_file}"
- )
- endforeach()
+ # get_property (compile_options SOURCE "${infile}" PROPERTY GENERATED_COMPILE_OPTIONS)
+ # set_property (SOURCE "${swig_generated_file_fullname}" PROPERTY COMPILE_OPTIONS $<TARGET_PROPERTY:${name},SWIG_GENERATED_COMPILE_OPTIONS> ${compile_options})
- set_source_files_properties(
- ${outfiles} PROPERTIES GENERATED 1
- )
+ set(${outfiles} "${swig_generated_file_fullname}" ${swig_extra_generated_files} PARENT_SCOPE)
-endmacro()
+ # legacy support
+ set (swig_generated_file_fullname "${swig_generated_file_fullname}" PARENT_SCOPE)
+endfunction()
#
# Create Swig module
#
macro(SWIG_ADD_MODULE name language)
- SWIG_MODULE_INITIALIZE(${name} ${language})
- set(swig_dot_i_sources)
- set(swig_other_sources)
- foreach(it ${ARGN})
- if(${it} MATCHES ".*\\.i$")
- set(swig_dot_i_sources ${swig_dot_i_sources} "${it}")
+ message(DEPRECATION "SWIG_ADD_MODULE is deprecated. Use SWIG_ADD_LIBRARY instead.")
+ swig_add_library(${name}
+ LANGUAGE ${language}
+ TYPE MODULE
+ SOURCES ${ARGN})
+endmacro()
+
+
+function(SWIG_ADD_LIBRARY name)
+ set(options NO_PROXY)
+ set(oneValueArgs LANGUAGE
+ TYPE
+ OUTPUT_DIR
+ OUTFILE_DIR)
+ set(multiValueArgs SOURCES)
+ cmake_parse_arguments(_SAM "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
+
+ if (TARGET ${name})
+ # a target with same name is already defined.
+ # call NOW add_library command to raise the most useful error message
+ add_library(${name})
+ return()
+ endif()
+
+ if (_SAM_UNPARSED_ARGUMENTS)
+ message(FATAL_ERROR "SWIG_ADD_LIBRARY: ${_SAM_UNPARSED_ARGUMENTS}: unexpected arguments")
+ endif()
+
+ if(NOT DEFINED _SAM_LANGUAGE)
+ message(FATAL_ERROR "SWIG_ADD_LIBRARY: Missing LANGUAGE argument")
+ endif()
+
+ if(NOT DEFINED _SAM_SOURCES)
+ message(FATAL_ERROR "SWIG_ADD_LIBRARY: Missing SOURCES argument")
+ endif()
+
+ if(NOT DEFINED _SAM_TYPE)
+ set(_SAM_TYPE MODULE)
+ elseif(_SAM_TYPE STREQUAL "USE_BUILD_SHARED_LIBS")
+ unset(_SAM_TYPE)
+ endif()
+
+ if (NOT DEFINED UseSWIG_MODULE_VERSION)
+ set (UseSWIG_MODULE_VERSION 1)
+ elseif (NOT UseSWIG_MODULE_VERSION MATCHES "^(1|2)$")
+ message (FATAL_ERROR "UseSWIG_MODULE_VERSION: ${UseSWIG_MODULE_VERSION}: invalid value. 1 or 2 is expected.")
+ endif()
+
+ set (workingdir "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${name}.dir")
+ # set special variable to pass extra information to command SWIG_ADD_SOURCE_TO_MODULE
+ # which cannot be changed due to legacy compatibility
+ set (SWIG_WORKING_DIR "${workingdir}")
+
+ set (outputdir "${_SAM_OUTPUT_DIR}")
+ if (NOT _SAM_OUTPUT_DIR)
+ if (CMAKE_SWIG_OUTDIR)
+ set (outputdir "${CMAKE_SWIG_OUTDIR}")
else()
- set(swig_other_sources ${swig_other_sources} "${it}")
+ if (UseSWIG_MODULE_VERSION VERSION_GREATER 1)
+ set (outputdir "${workingdir}/${_SAM_LANGUAGE}.files")
+ else()
+ set (outputdir "${CMAKE_CURRENT_BINARY_DIR}")
+ endif()
endif()
- endforeach()
+ endif()
+
+ set (outfiledir "${_SAM_OUTFILE_DIR}")
+ if(NOT _SAM_OUTFILE_DIR)
+ if (SWIG_OUTFILE_DIR)
+ set (outfiledir "${SWIG_OUTFILE_DIR}")
+ else()
+ if (_SAM_OUTPUT_DIR OR CMAKE_SWIG_OUTDIR)
+ set (outfiledir "${outputdir}")
+ else()
+ set (outfiledir "${workingdir}")
+ endif()
+ endif()
+ endif()
+ # set again, locally, predefined variables to ensure compatibility
+ # with command SWIG_ADD_SOURCE_TO_MODULE
+ set(CMAKE_SWIG_OUTDIR "${outputdir}")
+ set(SWIG_OUTFILE_DIR "${outfiledir}")
+
+ set (SWIG_MODULE_${name}_NOPROXY ${_SAM_NO_PROXY})
+ swig_module_initialize(${name} ${_SAM_LANGUAGE})
+
+ set(swig_dot_i_sources ${_SAM_SOURCES})
+ list(FILTER swig_dot_i_sources INCLUDE REGEX "\\.i$")
+ if (NOT swig_dot_i_sources)
+ message(FATAL_ERROR "SWIG_ADD_LIBRARY: no SWIG interface files specified")
+ endif()
+ set(swig_other_sources ${_SAM_SOURCES})
+ list(REMOVE_ITEM swig_other_sources ${swig_dot_i_sources})
set(swig_generated_sources)
- foreach(it ${swig_dot_i_sources})
- SWIG_ADD_SOURCE_TO_MODULE(${name} swig_generated_source ${it})
- set(swig_generated_sources ${swig_generated_sources} "${swig_generated_source}")
+ set(swig_generated_timestamps)
+ foreach(swig_it IN LISTS swig_dot_i_sources)
+ SWIG_ADD_SOURCE_TO_MODULE(${name} swig_generated_source "${swig_it}")
+ list (APPEND swig_generated_sources "${swig_generated_source}")
+ if(CMAKE_GENERATOR MATCHES "Make")
+ __swig_compute_timestamp(${name} ${SWIG_MODULE_${name}_LANGUAGE} "${swig_it}"
+ "${workingdir}" swig_timestamp)
+ list (APPEND swig_generated_timestamps "${swig_timestamp}")
+ endif()
endforeach()
- get_directory_property(swig_extra_clean_files ADDITIONAL_MAKE_CLEAN_FILES)
- set_directory_properties(PROPERTIES
- ADDITIONAL_MAKE_CLEAN_FILES "${swig_extra_clean_files};${swig_generated_sources}")
- add_library(${SWIG_MODULE_${name}_REAL_NAME}
- MODULE
+ set_property (DIRECTORY APPEND PROPERTY
+ ADDITIONAL_MAKE_CLEAN_FILES ${swig_generated_sources} ${swig_generated_timestamps})
+ if (UseSWIG_MODULE_VERSION VERSION_GREATER 1)
+ set_property (DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES "${outputdir}")
+ endif()
+
+ add_library(${name}
+ ${_SAM_TYPE}
${swig_generated_sources}
${swig_other_sources})
- string(TOLOWER "${language}" swig_lowercase_language)
- if ("${swig_lowercase_language}" STREQUAL "java")
+ if(CMAKE_GENERATOR MATCHES "Make")
+ # see IMPLICIT_DEPENDS above
+ add_custom_target(${name}_swig_compilation DEPENDS ${swig_generated_timestamps})
+ add_dependencies(${name} ${name}_swig_compilation)
+ endif()
+ if(_SAM_TYPE STREQUAL "MODULE")
+ set_target_properties(${name} PROPERTIES NO_SONAME ON)
+ endif()
+ string(TOLOWER "${_SAM_LANGUAGE}" swig_lowercase_language)
+ if (swig_lowercase_language STREQUAL "octave")
+ set_target_properties(${name} PROPERTIES PREFIX "")
+ set_target_properties(${name} PROPERTIES SUFFIX ".oct")
+ elseif (swig_lowercase_language STREQUAL "go")
+ set_target_properties(${name} PROPERTIES PREFIX "")
+ elseif (swig_lowercase_language STREQUAL "java")
+ # In java you want:
+ # System.loadLibrary("LIBRARY");
+ # then JNI will look for a library whose name is platform dependent, namely
+ # MacOS : libLIBRARY.jnilib
+ # Windows: LIBRARY.dll
+ # Linux : libLIBRARY.so
if (APPLE)
- # In java you want:
- # System.loadLibrary("LIBRARY");
- # then JNI will look for a library whose name is platform dependent, namely
- # MacOS : libLIBRARY.jnilib
- # Windows: LIBRARY.dll
- # Linux : libLIBRARY.so
- set_target_properties (${SWIG_MODULE_${name}_REAL_NAME} PROPERTIES SUFFIX ".jnilib")
- endif ()
- endif ()
- if ("${swig_lowercase_language}" STREQUAL "python")
- # this is only needed for the python case where a _modulename.so is generated
- set_target_properties(${SWIG_MODULE_${name}_REAL_NAME} PROPERTIES PREFIX "")
+ set_target_properties (${name} PROPERTIES SUFFIX ".jnilib")
+ endif()
+ if ((WIN32 AND MINGW) OR CYGWIN OR CMAKE_SYSTEM_NAME STREQUAL MSYS)
+ set_target_properties(${name} PROPERTIES PREFIX "")
+ endif()
+ elseif (swig_lowercase_language STREQUAL "lua")
+ if(_SAM_TYPE STREQUAL "MODULE")
+ set_target_properties(${name} PROPERTIES PREFIX "")
+ endif()
+ elseif (swig_lowercase_language STREQUAL "python")
+ if (SWIG_MODULE_${name}_NOPROXY)
+ set_target_properties(${name} PROPERTIES PREFIX "")
+ else()
+ # swig will produce a module.py containing an 'import _modulename' statement,
+ # which implies having a corresponding _modulename.so (*NIX), _modulename.pyd (Win32),
+ # unless the -noproxy flag is used
+ set_target_properties(${name} PROPERTIES PREFIX "_")
+ endif()
# Python extension modules on Windows must have the extension ".pyd"
# instead of ".dll" as of Python 2.5. Older python versions do support
# this suffix.
@@ -288,18 +623,68 @@ macro(SWIG_ADD_MODULE name language)
# .pyd is now the only filename extension that will be searched for.
# </quote>
if(WIN32 AND NOT CYGWIN)
- set_target_properties(${SWIG_MODULE_${name}_REAL_NAME} PROPERTIES SUFFIX ".pyd")
+ set_target_properties(${name} PROPERTIES SUFFIX ".pyd")
endif()
+ elseif (swig_lowercase_language STREQUAL "r")
+ set_target_properties(${name} PROPERTIES PREFIX "")
+ elseif (swig_lowercase_language STREQUAL "ruby")
+ # In ruby you want:
+ # require 'LIBRARY'
+ # then ruby will look for a library whose name is platform dependent, namely
+ # MacOS : LIBRARY.bundle
+ # Windows: LIBRARY.dll
+ # Linux : LIBRARY.so
+ set_target_properties (${name} PROPERTIES PREFIX "")
+ if (APPLE)
+ set_target_properties (${name} PROPERTIES SUFFIX ".bundle")
+ endif ()
+ elseif (swig_lowercase_language STREQUAL "perl")
+ # assume empty prefix because we expect the module to be dynamically loaded
+ set_target_properties (${name} PROPERTIES PREFIX "")
+ if (APPLE)
+ set_target_properties (${name} PROPERTIES SUFFIX ".dylib")
+ endif ()
+ else()
+ # assume empty prefix because we expect the module to be dynamically loaded
+ set_target_properties (${name} PROPERTIES PREFIX "")
endif ()
-endmacro()
+
+ # target property SWIG_SUPPORT_FILES_DIRECTORY specify output directory of support files
+ set_property (TARGET ${name} PROPERTY SWIG_SUPPORT_FILES_DIRECTORY "${outputdir}")
+ # target property SWIG_SUPPORT_FILES lists principal proxy support files
+ if (NOT SWIG_MODULE_${name}_NOPROXY)
+ string(TOUPPER "${_SAM_LANGUAGE}" swig_uppercase_language)
+ set(swig_all_support_files)
+ foreach (swig_it IN LISTS SWIG_${swig_uppercase_language}_EXTRA_FILE_EXTENSIONS)
+ set (swig_support_files ${swig_generated_sources})
+ list (FILTER swig_support_files INCLUDE REGEX ".*${swig_it}$")
+ list(APPEND swig_all_support_files ${swig_support_files})
+ endforeach()
+ if (swig_all_support_files)
+ list(REMOVE_DUPLICATES swig_all_support_files)
+ endif()
+ set_property (TARGET ${name} PROPERTY SWIG_SUPPORT_FILES ${swig_all_support_files})
+ endif()
+
+ # to ensure legacy behavior, export some variables
+ set (SWIG_MODULE_${name}_LANGUAGE "${SWIG_MODULE_${name}_LANGUAGE}" PARENT_SCOPE)
+ set (SWIG_MODULE_${name}_SWIG_LANGUAGE_FLAG "${SWIG_MODULE_${name}_SWIG_LANGUAGE_FLAG}" PARENT_SCOPE)
+ set (SWIG_MODULE_${name}_REAL_NAME "${name}" PARENT_SCOPE)
+ set (SWIG_MODULE_${name}_NOPROXY "${SWIG_MODULE_${name}_NOPROXY}" PARENT_SCOPE)
+ set (SWIG_MODULE_${name}_EXTRA_FLAGS "${SWIG_MODULE_${name}_EXTRA_FLAGS}" PARENT_SCOPE)
+ # the last one is a bit crazy but it is documented, so...
+ # NOTA: works as expected if only ONE input file is specified
+ set (swig_generated_file_fullname "${swig_generated_file_fullname}" PARENT_SCOPE)
+endfunction()
#
# Like TARGET_LINK_LIBRARIES but for swig modules
#
-macro(SWIG_LINK_LIBRARIES name)
+function(SWIG_LINK_LIBRARIES name)
+ message(DEPRECATION "SWIG_LINK_LIBRARIES is deprecated. Use TARGET_LINK_LIBRARIES instead.")
if(SWIG_MODULE_${name}_REAL_NAME)
- target_link_libraries(${SWIG_MODULE_${name}_REAL_NAME} ${ARGN})
+ target_link_libraries(${name} ${ARGN})
else()
message(SEND_ERROR "Cannot find Swig library \"${name}\".")
endif()
-endmacro()
+endfunction()
diff --git a/gr-fec/apps/CMakeLists.txt b/cmake/Modules/targetConfig.cmake.in
index 41c6e4e2fc..79e4a2830b 100644
--- a/gr-fec/apps/CMakeLists.txt
+++ b/cmake/Modules/targetConfig.cmake.in
@@ -1,4 +1,4 @@
-# Copyright 2015 Free Software Foundation, Inc.
+# Copyright 2018 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -17,24 +17,10 @@
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.
-#include_directories(
-# ${GR_FEC_INCLUDE_DIRS}
-# ${GNURADIO_RUNTIME_INCLUDE_DIRS}
-# ${GSL_INCLUDE_DIRS}
-# ${Boost_INCLUDE_DIRS}
-#)
-#
-#list(APPEND libs
-# ${GSL_LIBRARIES}
-# ${Boost_LIBRARIES}
-# gnuradio-fec gnuradio-runtime
-#)
-#
-#INSTALL(TARGETS
-# DESTINATION ${GR_RUNTIME_DIR}
-#)
-#
-#GR_PYTHON_INSTALL(
-# PROGRAMS
-# DESTINATION ${GR_RUNTIME_DIR}
-#)
+include(CMakeFindDependencyMacro)
+
+set(target_deps "@TARGET_DEPENDENCIES@")
+foreach(dep IN LISTS target_deps)
+ find_dependency(${dep})
+endforeach()
+include("${CMAKE_CURRENT_LIST_DIR}/@TARGET@Targets.cmake")
diff --git a/gnuradio-runtime/CMakeLists.txt b/gnuradio-runtime/CMakeLists.txt
index 6393ab30ed..e24ffab344 100644
--- a/gnuradio-runtime/CMakeLists.txt
+++ b/gnuradio-runtime/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright 2013 Free Software Foundation, Inc.
+# Copyright 2013,2019 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -43,23 +43,9 @@ GR_REGISTER_COMPONENT("gnuradio-runtime" ENABLE_GNURADIO_RUNTIME
LOG4CPP_FOUND
)
-GR_SET_GLOBAL(GNURADIO_RUNTIME_INCLUDE_DIRS
- ${CMAKE_BINARY_DIR}
- ${CMAKE_SOURCE_DIR}/gnuradio-runtime/include
- ${CMAKE_BINARY_DIR}/gnuradio-runtime/include
- ${LOG4CPP_INCLUDE_DIRS}
-)
-
-GR_SET_GLOBAL(GNURADIO_RUNTIME_SWIG_INCLUDE_DIRS
- ${GNURADIO_RUNTIME_INCLUDE_DIRS}
- ${CMAKE_SOURCE_DIR}/gnuradio-runtime/swig
- ${CMAKE_BINARY_DIR}/gnuradio-runtime/swig
-)
-
get_filename_component(GNURADIO_RUNTIME_PYTHONPATH
${CMAKE_SOURCE_DIR}/python ABSOLUTE
)
-GR_SET_GLOBAL(GNURADIO_RUNTIME_PYTHONPATH ${GNURADIO_RUNTIME_PYTHONPATH})
########################################################################
# Register controlport component
@@ -82,7 +68,6 @@ if(ENABLE_GNURADIO_RUNTIME)
get_filename_component(GR_RUNTIME_PYTHONPATH
${CMAKE_CURRENT_SOURCE_DIR}/python ABSOLUTE
)
-GR_SET_GLOBAL(GR_RUNTIME_PYTHONPATH ${GR_RUNTIME_PYTHONPATH})
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/gnuradio-runtime.conf.in
diff --git a/gnuradio-runtime/apps/CMakeLists.txt b/gnuradio-runtime/apps/CMakeLists.txt
index 4a73f3c18f..a713ed564b 100644
--- a/gnuradio-runtime/apps/CMakeLists.txt
+++ b/gnuradio-runtime/apps/CMakeLists.txt
@@ -18,22 +18,10 @@
# Boston, MA 02110-1301, USA.
########################################################################
-# Setup the include and linker paths
-########################################################################
-include_directories(
- ${GNURADIO_RUNTIME_INCLUDE_DIRS}
- ${Boost_INCLUDE_DIRS}
-)
-
-link_directories(
- ${Boost_LIBRARY_DIRS}
-)
-
-########################################################################
# Setup executables
########################################################################
add_executable(gnuradio-config-info gnuradio-config-info.cc)
-target_link_libraries(gnuradio-config-info gnuradio-runtime ${Boost_LIBRARIES})
+target_link_libraries(gnuradio-config-info gnuradio-runtime)
install(
TARGETS gnuradio-config-info
DESTINATION ${GR_RUNTIME_DIR}
diff --git a/gnuradio-runtime/lib/CMakeLists.txt b/gnuradio-runtime/lib/CMakeLists.txt
index d585f22d6c..c0e4f41552 100644
--- a/gnuradio-runtime/lib/CMakeLists.txt
+++ b/gnuradio-runtime/lib/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright 2013 Free Software Foundation, Inc.
+# Copyright 2013,2018 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -18,7 +18,7 @@
# Boston, MA 02110-1301, USA.
include(GrMiscUtils)
-GR_CHECK_HDR_N_DEF(sys/resource.h HAVE_SYS_RESOURCE_H)
+gr_check_hdr_n_def(sys/resource.h HAVE_SYS_RESOURCE_H)
########################################################################
# Handle the generated constants
@@ -35,43 +35,23 @@ string(REPLACE "\\" "\\\\" prefix "${prefix}")
string(REPLACE "\\" "\\\\" SYSCONFDIR "${SYSCONFDIR}")
string(REPLACE "\\" "\\\\" GR_PREFSDIR "${GR_PREFSDIR}")
-configure_file(
- ${CMAKE_CURRENT_SOURCE_DIR}/constants.cc.in
- ${CMAKE_CURRENT_BINARY_DIR}/constants.cc
- ESCAPE_QUOTES
-@ONLY)
-
-list(APPEND gnuradio_runtime_sources ${CMAKE_CURRENT_BINARY_DIR}/constants.cc)
-
-########################################################################
-# Setup the include and linker paths
-########################################################################
-include_directories(${GNURADIO_RUNTIME_INCLUDE_DIRS}
- ${CMAKE_CURRENT_SOURCE_DIR}
- ${VOLK_INCLUDE_DIRS}
- ${Boost_INCLUDE_DIRS}
- ${MPLIB_INCLUDE_DIRS}
-)
-if(ENABLE_CTRLPORT_THRIFT)
- list(APPEND include_directories
- ${THRIFT_INCLUDE_DIRS}
- )
-endif(ENABLE_CTRLPORT_THRIFT)
-
-########################################################################
+#########################################################################
# Include subdirs rather to populate to the sources lists.
########################################################################
add_subdirectory(pmt)
-GR_INCLUDE_SUBDIRECTORY(messages)
-GR_INCLUDE_SUBDIRECTORY(thread)
-GR_INCLUDE_SUBDIRECTORY(math)
-GR_INCLUDE_SUBDIRECTORY(controlport)
########################################################################
# Setup library
########################################################################
-list(APPEND gnuradio_runtime_sources
+configure_file(
+ ${CMAKE_CURRENT_SOURCE_DIR}/constants.cc.in
+ ${CMAKE_CURRENT_BINARY_DIR}/constants.cc
+ ESCAPE_QUOTES
+ @ONLY)
+
+add_library(gnuradio-runtime
+ ${CMAKE_CURRENT_BINARY_DIR}/constants.cc
basic_block.cc
block.cc
block_detail.cc
@@ -117,28 +97,145 @@ list(APPEND gnuradio_runtime_sources
vmcircbuf_mmap_tmpfile.cc
vmcircbuf_prefs.cc
vmcircbuf_sysv_shm.cc
- ${gnuradio_ctrlport_sources}
+ )
+
+# Messages
+target_sources(gnuradio-runtime PRIVATE
+ ${CMAKE_CURRENT_SOURCE_DIR}/messages/msg_accepter.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/messages/msg_accepter_msgq.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/messages/msg_producer.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/messages/msg_queue.cc
+ )
+
+# Thread
+target_sources(gnuradio-runtime PRIVATE
+ ${CMAKE_CURRENT_SOURCE_DIR}/thread/thread.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/thread/thread_body_wrapper.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/thread/thread_group.cc
+ )
+
+# Math
+target_sources(gnuradio-runtime PRIVATE
+ ${CMAKE_CURRENT_SOURCE_DIR}/math/fast_atan2f.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/math/fxpt.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/math/random.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/math/sincos.cc
+ )
+
+# Controlport
+if(ENABLE_GR_CTRLPORT)
+
+# Keep track of the number of backends ControlPort supports
+SET(CTRLPORT_BACKENDS 0)
+
+target_sources(gnuradio-runtime PRIVATE
+ ${CMAKE_CURRENT_SOURCE_DIR}/controlport/rpcmanager.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/controlport/rpcserver_aggregator.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/controlport/rpcserver_booter_aggregator.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/controlport/rpcserver_selector.cc
)
-list(APPEND gnuradio_runtime_libs
- gnuradio-pmt
- ${VOLK_LIBRARIES}
- ${Boost_LIBRARIES}
- ${LOG4CPP_LIBRARIES}
- ${MPLIB_LIBRARIES}
+OPTION(ENABLE_CTRLPORT_THRIFT "Enable ControlPort Thrift support" ON)
+
+if(ENABLE_CTRLPORT_THRIFT)
+# Look if Thrift is installed and use it as a ControlPort backend.
+FIND_PACKAGE(THRIFT)
+
+if(THRIFT_FOUND)
+MATH(EXPR CTRLPORT_BACKENDS "${CTRLPORT_BACKENDS} + 1")
+
+# Indicate thrift as an installed backend in the cmake summary.
+message(STATUS "Found and enabling Thrift backend to ControlPort")
+GR_APPEND_SUBCOMPONENT("thrift")
+
+# Run Thrift To compile C++ and Python files
+message(STATUS "Running thrift to build C++ bindings")
+file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/controlport/thrift/)
+
+list(APPEND gnuradio_thrift_generated_sources
+ ${CMAKE_CURRENT_BINARY_DIR}/controlport/thrift/gnuradio_types.cpp
+ ${CMAKE_CURRENT_BINARY_DIR}/controlport/thrift/gnuradio_constants.cpp
+ ${CMAKE_CURRENT_BINARY_DIR}/controlport/thrift/ControlPort.cpp
+ )
+add_custom_command(
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/controlport/thrift/gnuradio.thrift
+ OUTPUT ${gnuradio_thrift_generated_sources}
+ COMMAND ${THRIFT_BIN} --gen cpp -out ${CMAKE_CURRENT_BINARY_DIR}/controlport/thrift/ ${CMAKE_CURRENT_SOURCE_DIR}/controlport/thrift/gnuradio.thrift
+ )
+
+target_include_directories(gnuradio-runtime PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/controlport>)
+
+target_sources(gnuradio-runtime PRIVATE
+ ${CMAKE_CURRENT_SOURCE_DIR}/controlport/thrift/rpcserver_thrift.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/controlport/thrift/rpcpmtconverters_thrift.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/controlport/thrift/rpcserver_booter_thrift.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/controlport/thrift/thrift_application_base.cc
+ # add files built by compiling gnuradio.thrift
+ ${gnuradio_thrift_generated_sources}
+ )
+target_link_libraries(gnuradio-runtime PUBLIC
+ Thrift::thrift
+ )
+
+# Add install rule to move example Thrift configuration file into a
+# documentation directory
+install(
+ FILES ${CMAKE_CURRENT_SOURCE_DIR}/controlport/thrift/thrift.conf.example
+ DESTINATION ${GR_PKG_DOC_DIR}/config
+)
+
+endif(THRIFT_FOUND)
+endif(ENABLE_CTRLPORT_THRIFT)
+
+########################################################################
+# Add controlport stuff to gnuradio-runtime
+########################################################################
+
+# Save the number of backends for testing against later
+set(
+ CTRLPORT_BACKENDS ${CTRLPORT_BACKENDS}
+ CACHE INTERNAL "Number of ControlPort backends available"
)
+endif(ENABLE_GR_CTRLPORT)
+
+target_link_libraries(gnuradio-runtime PUBLIC
+ gnuradio-pmt
+ ${GR_VOLK_LIB}
+ Boost::program_options
+ Boost::filesystem
+ Boost::system
+ Boost::regex
+ Boost::thread
+ Log4Cpp::log4cpp
+ MPLib::mplib
+ )
+
+target_include_directories(gnuradio-runtime
+ PUBLIC
+ $<INSTALL_INTERFACE:${CMAKE_INSTALL_PREFIX}/include>
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../include>
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/../include>
+ PRIVATE
+ ${CMAKE_CURRENT_SOURCE_DIR}
+ )
+
+ if(ENABLE_GR_CTRLPORT)
+ target_compile_definitions(gnuradio-runtime PUBLIC GR_CTRLPORT)
+ endif()
+
+
#Add libraries for winsock2.h on Windows
-CHECK_INCLUDE_FILE_CXX(windows.h HAVE_WINDOWS_H)
-IF(HAVE_WINDOWS_H)
- ADD_DEFINITIONS(-DHAVE_WINDOWS_H -DUSING_WINSOCK -DWIN32_LEAN_AND_MEAN)
- MESSAGE(STATUS "Adding windows libs to gnuradio runtime libs...")
- LIST(APPEND gnuradio_runtime_libs ws2_32 wsock32)
-ENDIF(HAVE_WINDOWS_H)
+check_include_file_cxx(windows.h HAVE_WINDOWS_H)
+if(HAVE_WINDOWS_H)
+ target_compile_definitions(gnuradio-runtime PUBLIC -DHAVE_WINDOWS_H -DUSING_WINSOCK -DWIN32_LEAN_AND_MEAN)
+ message(STATUS "Adding windows libs to gnuradio runtime libs...")
+ target_link_libraries(gnuradio-runtime PUBLIC ws2_32 wsock32)
+endif(HAVE_WINDOWS_H)
#need to link with librt on ubuntu 11.10 for shm_*
if((LINUX) OR (CMAKE_SYSTEM_NAME STREQUAL "kFreeBSD"))
- list(APPEND gnuradio_runtime_libs rt)
+ target_link_libraries(gnuradio-runtime PUBLIC rt)
endif()
########################################################################
@@ -153,7 +250,7 @@ if(MSVC)
${CMAKE_CURRENT_BINARY_DIR}/gnuradio-runtime.rc
@ONLY)
- list(APPEND gnuradio_runtime_sources
+ target_sources(gnuradio-runtime PRIVATE
${CMAKE_CURRENT_BINARY_DIR}/gnuradio-runtime.rc
)
endif(MSVC)
@@ -170,59 +267,25 @@ endif(MSVC)
########################################################################
if(WIN32)
- OPTION(TRY_SHM_VMCIRCBUF "Try SHM VMCIRCBUF" OFF)
+ option(TRY_SHM_VMCIRCBUF "Try SHM VMCIRCBUF" OFF)
else(WIN32)
- OPTION(TRY_SHM_VMCIRCBUF "Try SHM VMCIRCBUF" ON)
+ option(TRY_SHM_VMCIRCBUF "Try SHM VMCIRCBUF" ON)
endif(WIN32)
message(STATUS "TRY_SHM_VMCIRCBUF set to ${TRY_SHM_VMCIRCBUF}.")
if(TRY_SHM_VMCIRCBUF)
- add_definitions( -DTRY_SHM_VMCIRCBUF )
+ target_compile_definitions(gnuradio-runtime PRIVATE -DTRY_SHM_VMCIRCBUF )
endif(TRY_SHM_VMCIRCBUF)
+set(EXTRA_DEPS "")
+if(ENABLE_CTRLPORT_THRIFT)
+ if(THRIFT_FOUND)
+ list(APPEND EXTRA_DEPS THRIFT)
+ endif()
+endif()
+gr_library_foo(gnuradio-runtime ${EXTRA_DEPS})
-#######################################################
-# SHARED LIB BUILD
-#######################################################
-add_library(gnuradio-runtime SHARED ${gnuradio_runtime_sources})
-target_link_libraries(gnuradio-runtime ${gnuradio_runtime_libs})
-GR_LIBRARY_FOO(gnuradio-runtime)
-
-#######################################################
-# STATIC LIB BUILD
-#######################################################
-if(ENABLE_STATIC_LIBS)
- # Remove controlport-specific source files from staticlibs build if
- # ICE is the backend since it does not build statically.
- if(ENABLE_GR_CTRLPORT)
- if(ICE_FOUND)
- list(REMOVE_ITEM gnuradio_runtime_sources
- ${gnuradio_ctrlport_sources}
- )
-
- # Remove GR_CTRLPORT set this target's definitions.
- # Makes sure we don't try to use ControlPort stuff in source files
- GET_DIRECTORY_PROPERTY(STATIC_DEFS COMPILE_DEFINITIONS)
- list(REMOVE_ITEM STATIC_DEFS "GR_CTRLPORT")
- SET_PROPERTY(DIRECTORY PROPERTY COMPILE_DEFINITIONS "${STATIC_DEFS}")
-
- # readd it to the target since we removed it from the directory-wide list.
- SET_PROPERTY(TARGET gnuradio-runtime APPEND PROPERTY COMPILE_DEFINITIONS "GR_CTRLPORT")
- endif(ICE_FOUND)
- endif(ENABLE_GR_CTRLPORT)
-
- add_library(gnuradio-runtime_static STATIC ${gnuradio_runtime_sources})
-
- if(NOT WIN32)
- set_target_properties(gnuradio-runtime_static
- PROPERTIES OUTPUT_NAME gnuradio-runtime)
- endif(NOT WIN32)
-
- install(TARGETS gnuradio-runtime_static
- ARCHIVE DESTINATION lib${LIB_SUFFIX} # .lib file
- )
-endif(ENABLE_STATIC_LIBS)
########################################################################
# Setup tests
@@ -241,13 +304,13 @@ if(ENABLE_TESTING)
list(APPEND GR_TEST_TARGET_DEPS gnuradio-runtime gnuradio-pmt)
foreach(qa_file ${test_gnuradio_runtime_sources})
- GR_ADD_CPP_TEST("runtime_${qa_file}"
+ gr_add_cpp_test("runtime_${qa_file}"
${CMAKE_CURRENT_SOURCE_DIR}/${qa_file}
- )
+ )
+
endforeach(qa_file)
# Math tests:
- include_directories(BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/math)
list(APPEND test_gnuradio_math_sources
qa_fxpt.cc
qa_fxpt_nco.cc
@@ -258,14 +321,18 @@ if(ENABLE_TESTING)
)
foreach(qa_file ${test_gnuradio_math_sources})
- GR_ADD_CPP_TEST("math_${qa_file}"
+ gr_add_cpp_test("math_${qa_file}"
${CMAKE_CURRENT_SOURCE_DIR}/math/${qa_file}
- )
+ )
+ target_include_directories("math_${qa_file}"
+ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/math
+ )
endforeach(qa_file)
# PMT tests:
- include_directories(${CMAKE_CURRENT_BINARY_DIR}/pmt)
- GR_ADD_CPP_TEST("pmt_prims" ${CMAKE_CURRENT_SOURCE_DIR}/pmt/qa_pmt_prims.cc)
- GR_ADD_CPP_TEST("pmt_unv" ${CMAKE_CURRENT_SOURCE_DIR}/pmt/qa_pmt_unv.cc)
+ gr_add_cpp_test("pmt_prims" ${CMAKE_CURRENT_SOURCE_DIR}/pmt/qa_pmt_prims.cc)
+ gr_add_cpp_test("pmt_unv" ${CMAKE_CURRENT_SOURCE_DIR}/pmt/qa_pmt_unv.cc)
+ target_include_directories("pmt_prims" PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/pmt)
+ target_include_directories("pmt_unv" PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/pmt)
endif(ENABLE_TESTING)
diff --git a/gnuradio-runtime/lib/controlport/CMakeLists.txt b/gnuradio-runtime/lib/controlport/CMakeLists.txt
deleted file mode 100644
index 0aa8539742..0000000000
--- a/gnuradio-runtime/lib/controlport/CMakeLists.txt
+++ /dev/null
@@ -1,104 +0,0 @@
-# Copyright 2013 Free Software Foundation, Inc.
-#
-# This file is part of GNU Radio
-#
-# GNU Radio is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3, or (at your option)
-# any later version.
-#
-# GNU Radio is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with GNU Radio; see the file COPYING. If not, write to
-# the Free Software Foundation, Inc., 51 Franklin Street,
-# Boston, MA 02110-1301, USA.
-
-if(ENABLE_GR_CTRLPORT)
-
-# Keep track of the number of backends ControlPort supports
-SET(CTRLPORT_BACKENDS 0)
-
-# Add definition so we can compile in ControlPort to the blocks.
-add_definitions(-DGR_CTRLPORT)
-
-include_directories(${CMAKE_CURRENT_SOURCE_DIR})
-
-list(APPEND gnuradio_ctrlport_sources
- ${CMAKE_CURRENT_SOURCE_DIR}/rpcmanager.cc
- ${CMAKE_CURRENT_SOURCE_DIR}/rpcserver_aggregator.cc
- ${CMAKE_CURRENT_SOURCE_DIR}/rpcserver_booter_aggregator.cc
- ${CMAKE_CURRENT_SOURCE_DIR}/rpcserver_selector.cc
-)
-
-
-OPTION(ENABLE_CTRLPORT_THRIFT "Enable ControlPort Thrift support" ON)
-
-if(ENABLE_CTRLPORT_THRIFT)
-
-# Look if Thrift is installed and use it as a ControlPort backend.
-FIND_PACKAGE(Thrift)
-
-if(THRIFT_FOUND)
-
-include_directories(${THRIFT_INCLUDE_DIRS})
-MATH(EXPR CTRLPORT_BACKENDS "${CTRLPORT_BACKENDS} + 1")
-
-# Indicate thrift as an installed backend in the cmake summary.
-message(STATUS "Found and enabling Thrift backend to ControlPort")
-GR_APPEND_SUBCOMPONENT("thrift")
-
-# Run Thrift To compile C++ and Python files
-message(STATUS "Running thrift to build C++ bindings")
-file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/thrift/)
-
-list(APPEND gnuradio_thrift_generated_sources
- ${CMAKE_CURRENT_BINARY_DIR}/thrift/gnuradio_types.cpp
- ${CMAKE_CURRENT_BINARY_DIR}/thrift/gnuradio_constants.cpp
- ${CMAKE_CURRENT_BINARY_DIR}/thrift/ControlPort.cpp
- )
-add_custom_command(
- DEPENDS ${CMAKE_SOURCE_DIR}/gnuradio-runtime/lib/controlport/thrift/gnuradio.thrift
- OUTPUT ${gnuradio_thrift_generated_sources}
- COMMAND ${THRIFT_BIN} --gen cpp -out ${CMAKE_CURRENT_BINARY_DIR}/thrift/ ${CMAKE_CURRENT_SOURCE_DIR}/thrift/gnuradio.thrift
- )
-list(APPEND gnuradio_ctrlport_sources
- ${CMAKE_CURRENT_SOURCE_DIR}/thrift/rpcserver_thrift.cc
- ${CMAKE_CURRENT_SOURCE_DIR}/thrift/rpcpmtconverters_thrift.cc
- ${CMAKE_CURRENT_SOURCE_DIR}/thrift/rpcserver_booter_thrift.cc
- ${CMAKE_CURRENT_SOURCE_DIR}/thrift/thrift_application_base.cc
- # add files built by compiling gnuradio.thrift
- ${gnuradio_thrift_generated_sources}
- )
-
-# Add required libraries here
-list(APPEND gnuradio_runtime_libs
- ${THRIFT_LIBRARIES}
-)
-
-# Add install rule to move example Thrift configuration file into
-# $prefix/etc/gnuradio
-install(
- FILES ${CMAKE_CURRENT_SOURCE_DIR}/thrift/thrift.conf.example
- DESTINATION ${SYSCONFDIR}/${CMAKE_PROJECT_NAME}
-)
-
-endif(THRIFT_FOUND)
-endif(ENABLE_CTRLPORT_THRIFT)
-
-########################################################################
-# Add controlport stuff to gnuradio-runtime
-########################################################################
-
-include_directories(${CMAKE_CURRENT_BINARY_DIR})
-
-# Save the number of backends for testing against later
-set(
- CTRLPORT_BACKENDS ${CTRLPORT_BACKENDS}
- CACHE INTERNAL "Number of ControlPort backends available"
-)
-
-endif(ENABLE_GR_CTRLPORT)
diff --git a/gnuradio-runtime/lib/controlport/thrift/thrift.conf.example b/gnuradio-runtime/lib/controlport/thrift/thrift.conf.example
index 71cc506249..dacb0e5f9b 100644
--- a/gnuradio-runtime/lib/controlport/thrift/thrift.conf.example
+++ b/gnuradio-runtime/lib/controlport/thrift/thrift.conf.example
@@ -1,3 +1,6 @@
+# This file contains sane defaults for the Thrift RPC backend
+# You should move this to your system config directory, typically something like
+# /etc/gnuradio/conf.d/thrift.conf
[thrift]
port = 9090
nthreads = 2
diff --git a/gnuradio-runtime/lib/math/CMakeLists.txt b/gnuradio-runtime/lib/math/CMakeLists.txt
deleted file mode 100644
index c95c84cecb..0000000000
--- a/gnuradio-runtime/lib/math/CMakeLists.txt
+++ /dev/null
@@ -1,29 +0,0 @@
-# Copyright 2010,2013 Free Software Foundation, Inc.
-#
-# This file is part of GNU Radio
-#
-# GNU Radio is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3, or (at your option)
-# any later version.
-#
-# GNU Radio is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with GNU Radio; see the file COPYING. If not, write to
-# the Free Software Foundation, Inc., 51 Franklin Street,
-# Boston, MA 02110-1301, USA.
-
-########################################################################
-# This file included, use CMake directory variables
-########################################################################
-
-list(APPEND gnuradio_runtime_sources
- ${CMAKE_CURRENT_SOURCE_DIR}/fast_atan2f.cc
- ${CMAKE_CURRENT_SOURCE_DIR}/fxpt.cc
- ${CMAKE_CURRENT_SOURCE_DIR}/random.cc
- ${CMAKE_CURRENT_SOURCE_DIR}/sincos.cc
-)
diff --git a/gnuradio-runtime/lib/messages/CMakeLists.txt b/gnuradio-runtime/lib/messages/CMakeLists.txt
deleted file mode 100644
index 20d4f30b06..0000000000
--- a/gnuradio-runtime/lib/messages/CMakeLists.txt
+++ /dev/null
@@ -1,29 +0,0 @@
-# Copyright 2010,2013 Free Software Foundation, Inc.
-#
-# This file is part of GNU Radio
-#
-# GNU Radio is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3, or (at your option)
-# any later version.
-#
-# GNU Radio is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with GNU Radio; see the file COPYING. If not, write to
-# the Free Software Foundation, Inc., 51 Franklin Street,
-# Boston, MA 02110-1301, USA.
-
-########################################################################
-# This file included, use CMake directory variables
-########################################################################
-
-list(APPEND gnuradio_runtime_sources
- ${CMAKE_CURRENT_SOURCE_DIR}/msg_accepter.cc
- ${CMAKE_CURRENT_SOURCE_DIR}/msg_accepter_msgq.cc
- ${CMAKE_CURRENT_SOURCE_DIR}/msg_producer.cc
- ${CMAKE_CURRENT_SOURCE_DIR}/msg_queue.cc
-)
diff --git a/gnuradio-runtime/lib/pmt/CMakeLists.txt b/gnuradio-runtime/lib/pmt/CMakeLists.txt
index 132060166d..c46227e765 100644
--- a/gnuradio-runtime/lib/pmt/CMakeLists.txt
+++ b/gnuradio-runtime/lib/pmt/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright 2010-2013 Free Software Foundation, Inc.
+# Copyright 2010-2013,2018-2019 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -17,13 +17,7 @@
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.
-########################################################################
-# This file included, use CMake directory variables
-########################################################################
-include_directories(BEFORE ${CMAKE_CURRENT_SOURCE_DIR})
-include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR})
-
-set(pmt_sources
+add_library(gnuradio-pmt
${CMAKE_CURRENT_SOURCE_DIR}/pmt_unv.cc
${CMAKE_CURRENT_SOURCE_DIR}/pmt.cc
${CMAKE_CURRENT_SOURCE_DIR}/pmt_io.cc
@@ -31,11 +25,19 @@ set(pmt_sources
${CMAKE_CURRENT_SOURCE_DIR}/pmt_serialize.cc
)
-list(APPEND gnuradio_pmt_libs
- ${Boost_LIBRARIES}
- ${LOG4CPP_LIBRARIES}
+target_link_libraries(gnuradio-pmt
+ Boost::boost
+ Log4Cpp::log4cpp
)
+target_include_directories(gnuradio-pmt
+ PUBLIC
+ $<INSTALL_INTERFACE:${CMAKE_INSTALL_PREFIX}/include>
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../../include>
+ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/
+ )
+
+
#Add Windows DLL resource file if using MSVC
if(MSVC)
include(${CMAKE_SOURCE_DIR}/cmake/Modules/GrVersion.cmake)
@@ -45,28 +47,11 @@ if(MSVC)
${CMAKE_CURRENT_BINARY_DIR}/gnuradio-pmt.rc
@ONLY)
- list(APPEND gr_pmt_sources
+ target_sources(gnuradio-pmt PRIVATE
${CMAKE_CURRENT_BINARY_DIR}/gnuradio-pmt.rc
)
endif(MSVC)
-
-add_library(gnuradio-pmt SHARED ${pmt_sources})
-target_link_libraries(gnuradio-pmt ${gnuradio_pmt_libs})
-
-GR_LIBRARY_FOO(gnuradio-pmt)
-
-if(ENABLE_STATIC_LIBS)
- add_library(gnuradio-pmt_static STATIC ${pmt_sources})
-
- add_dependencies(gnuradio-pmt_static)
-
- if(NOT WIN32)
- set_target_properties(gnuradio-pmt_static
- PROPERTIES OUTPUT_NAME gnuradio-pmt)
- endif(NOT WIN32)
-
- install(TARGETS gnuradio-pmt_static
- ARCHIVE DESTINATION lib${LIB_SUFFIX} # .lib file
- )
-endif(ENABLE_STATIC_LIBS)
+if(BUILD_SHARED_LIBS)
+ GR_LIBRARY_FOO(gnuradio-pmt)
+endif()
diff --git a/gnuradio-runtime/swig/CMakeLists.txt b/gnuradio-runtime/swig/CMakeLists.txt
index a163a8c9cf..a6c11b5a26 100644
--- a/gnuradio-runtime/swig/CMakeLists.txt
+++ b/gnuradio-runtime/swig/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright 2013 Free Software Foundation, Inc.
+# Copyright 2013,2019 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -24,19 +24,13 @@ include(GrPython)
include(GrSwig)
set(GR_SWIG_INCLUDE_DIRS
- ${GNURADIO_RUNTIME_INCLUDE_DIRS}
- ${GNURADIO_RUNTIME_SWIG_INCLUDE_DIRS}
- ${CMAKE_CURRENT_BINARY_DIR}
- ${Boost_INCLUDE_DIRS}
-)
-
-link_directories(${Boost_LIBRARY_DIRS})
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
+ $<INSTALL_INTERFACE:include/gnuradio/swig>
+ )
set(GR_SWIG_LIBRARIES
- gnuradio-pmt
- gnuradio-runtime
- ${LOG4CPP_LIBRARIES}
-)
+ gnuradio-runtime)
###############################################################
# Build pmt swig
@@ -52,32 +46,39 @@ GR_SWIG_INSTALL(
DESTINATION ${GR_PYTHON_DIR}/pmt
)
-add_custom_target(pmt_swig DEPENDS ${SWIG_MODULE_pmt_swig_REAL_NAME})
-
###############################################################
# Build gnuradio-runtime swig
###############################################################
-
-if(ENABLE_GR_CTRLPORT)
- ADD_DEFINITIONS(-DGR_CTRLPORT)
- list(APPEND GR_SWIG_FLAGS -DGR_CTRLPORT)
-endif(ENABLE_GR_CTRLPORT)
-
set(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/runtime_swig_doc.i)
set(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../include)
set(GR_RUNTIME_SWIG_DOC_FILE ${GR_SWIG_DOC_FILE})
+if(ENABLE_GR_CTRLPORT)
+ set(GR_SWIG_FLAGS "-DGR_CTRLPORT")
+endif()
list(APPEND GR_SWIG_TARGET_DEPS pmt_swig)
GR_SWIG_MAKE(runtime_swig runtime_swig.i)
-GR_SWIG_INSTALL(
- TARGETS runtime_swig
- DESTINATION ${GR_PYTHON_DIR}/gnuradio/gr
+install(
+ TARGETS runtime_swig
+ EXPORT runtime_swig-export
+ DESTINATION ${GR_PYTHON_DIR}/gnuradio/gr
+ )
+
+include(GrPython)
+GR_PYTHON_INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/runtime_swig.py
+ DESTINATION ${GR_PYTHON_DIR}/gnuradio/gr
+ DEPENDS runtime_swig
+)
+
+install(EXPORT runtime_swig-export
+ FILE runtime_swigTargets.cmake
+ NAMESPACE gnuradio::
+ DESTINATION ${GR_LIBRARY_DIR}/cmake/gnuradio
)
install(
FILES
- gnuradio_swig_bug_workaround.h
runtime_swig.i
gnuradio.i
basic_block.i
diff --git a/gnuradio-runtime/swig/gen-swig-bug-fix b/gnuradio-runtime/swig/gen-swig-bug-fix
deleted file mode 100755
index 5e9f82e7d7..0000000000
--- a/gnuradio-runtime/swig/gen-swig-bug-fix
+++ /dev/null
@@ -1,111 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright 2004 Free Software Foundation, Inc.
-#
-# This file is part of GNU Radio
-#
-# GNU Radio is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3, or (at your option)
-# any later version.
-#
-# GNU Radio is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with GNU Radio; see the file COPYING. If not, write to
-# the Free Software Foundation, Inc., 51 Franklin Street,
-# Boston, MA 02110-1301, USA.
-#
-
-import sys
-import re
-
-def write_header (f):
- f.write ('''/* -*- c++ -*- */
-/*
- * Copyright 2004 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef INCLUDED_GNURADIO_SWIG_BUG_WORKAROUND_H
-#define INCLUDED_GNURADIO_SWIG_BUG_WORKAROUND_H
-
-/*
- * This include files works around a bug in SWIG 1.3.21 and 22
- * where it fails to emit these declarations when doing
- * %import "gnuradio.i"
- */
-
-''')
-
-def write_trailer (f):
- f.write ('''
-#endif /* INCLUDED_GNURADIO_SWIG_BUG_WORKAROUND_H */
-''')
-
-def doit (input, output):
- re_RULES_BEGIN = re.compile ('RULES \(BEGIN\)')
- re_RULES_END = re.compile ('RULES \(END\)')
- re_RETURN = re.compile ('^\s*return')
- re_NOT_ID = re.compile ('[^a-zA-Z0-9_]')
- words = {}
-
- write_header (output)
- for line in input:
- if re_RULES_BEGIN.search (line):
- break
-
- for line in input:
- if re_RULES_END.search (line):
- break
- if not re_RETURN.match (line):
- continue
- line = re_NOT_ID.sub (' ', line)
- line = re.sub (' +', ' ', line)
- for w in line.split (' '):
- words[w] = 1
-
- for w in ('', 'return', 'void', 'x'):
- del words[w]
-
- wl = words.keys()
- wl.sort ()
- for w in wl:
- output.write ('class ' + w + ';\n')
-
- write_trailer (output)
-
-
-def main ():
- if len (sys.argv) != 3:
- sys.stderr.write ("usage: %s gnuradio_swig_python.cc gnuradio_swig_bug_workaround.h\n"
- % (sys.argv[0],))
- sys.exit (1)
- input_filename = sys.argv[1]
- output_filename = sys.argv[2]
- input = open (input_filename, "r")
- output = open (output_filename, "w")
- doit (input, output)
-
-if __name__ == '__main__':
- main ()
-
diff --git a/gnuradio-runtime/swig/gnuradio.i b/gnuradio-runtime/swig/gnuradio.i
index b616e81229..19c5f158ee 100644
--- a/gnuradio-runtime/swig/gnuradio.i
+++ b/gnuradio-runtime/swig/gnuradio.i
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2003,2004,2009,2012 Free Software Foundation, Inc.
+ * Copyright 2003,2004,2009,2012,2019 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -38,10 +38,6 @@
////////////////////////////////////////////////////////////////////////
// Headers
-%{
-#include "gnuradio_swig_bug_workaround.h" // mandatory bug fix
-%}
-
%feature("autodoc","1");
// Required for a bug in SWIG 2.0.4 with GCC 4.6
diff --git a/gnuradio-runtime/swig/gnuradio_swig_bug_workaround.h b/gnuradio-runtime/swig/gnuradio_swig_bug_workaround.h
deleted file mode 100644
index 1fc3755707..0000000000
--- a/gnuradio-runtime/swig/gnuradio_swig_bug_workaround.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef INCLUDED_GNURADIO_SWIG_BUG_WORKAROUND_H
-#define INCLUDED_GNURADIO_SWIG_BUG_WORKAROUND_H
-
-/*
- * This include files works around a bug in SWIG 1.3.21 and 22
- * where it fails to emit these declarations when doing
- * %import "gnuradio.i"
- */
-
-class base_error_handler;
-class basic_block;
-class block;
-class file_error_handler;
-class hier_block2;
-class msg_handler;
-class msg_queue;
-class sync_block;
-class sync_decimator;
-class sync_interpolator;
-class top_block;
-
-#endif /* INCLUDED_GNURADIO_SWIG_BUG_WORKAROUND_H */
diff --git a/gnuradio-runtime/swig/gr_logger.i b/gnuradio-runtime/swig/gr_logger.i
index 7ed59776cf..63e137acb2 100644
--- a/gnuradio-runtime/swig/gr_logger.i
+++ b/gnuradio-runtime/swig/gr_logger.i
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2012 Free Software Foundation, Inc.
+ * Copyright 2012,2019 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -33,7 +33,6 @@
%import "gnuradio.i" // the common stuff
%{
-#include "gnuradio_swig_bug_workaround.h" // mandatory bug fix
#include <stdexcept>
%}
@@ -84,4 +83,3 @@ namespace gr {
};
} /* namespace gr */
-
diff --git a/gnuradio-runtime/swig/runtime_swig.i b/gnuradio-runtime/swig/runtime_swig.i
index 15cfebd300..966c431114 100644
--- a/gnuradio-runtime/swig/runtime_swig.i
+++ b/gnuradio-runtime/swig/runtime_swig.i
@@ -24,7 +24,7 @@
#ifndef SWIGIMPORTED
%include "runtime_swig_doc.i"
-%module(directors="1") gnuradio_runtime
+%module(directors="1") runtime_swig
#endif
%feature("autodoc", "1"); // generate python docstrings
diff --git a/gr-analog/CMakeLists.txt b/gr-analog/CMakeLists.txt
index c6ca6192dd..6934172229 100644
--- a/gr-analog/CMakeLists.txt
+++ b/gr-analog/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright 2012 Free Software Foundation, Inc.
+# Copyright 2012,2019 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -35,15 +35,6 @@ GR_REGISTER_COMPONENT("gr-analog" ENABLE_GR_ANALOG
ENABLE_GR_FILTER
)
-GR_SET_GLOBAL(GR_ANALOG_INCLUDE_DIRS
- ${CMAKE_CURRENT_SOURCE_DIR}/include
- ${CMAKE_CURRENT_BINARY_DIR}/include
-)
-
-GR_SET_GLOBAL(GR_ANALOG_SWIG_INCLUDE_DIRS
- ${CMAKE_CURRENT_SOURCE_DIR}/swig
-)
-
SET(GR_PKG_ANALOG_EXAMPLES_DIR ${GR_PKG_DATA_DIR}/examples/analog)
########################################################################
diff --git a/gr-analog/lib/CMakeLists.txt b/gr-analog/lib/CMakeLists.txt
index 684fee4666..9b20f4ac90 100644
--- a/gr-analog/lib/CMakeLists.txt
+++ b/gr-analog/lib/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright 2012-2014 Free Software Foundation, Inc.
+# Copyright 2012-2014,2019 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -18,31 +18,10 @@
# Boston, MA 02110-1301, USA.
########################################################################
-# Setup the include and linker paths
-########################################################################
-include_directories(
- ${CMAKE_CURRENT_BINARY_DIR}/../include
- ${CMAKE_CURRENT_SOURCE_DIR}
- ${CMAKE_CURRENT_BINARY_DIR}
- ${GR_ANALOG_INCLUDE_DIRS}
- ${GR_FILTER_INCLUDE_DIRS}
- ${GR_FFT_INCLUDE_DIRS}
- ${GR_BLOCKS_INCLUDE_DIRS}
- ${GNURADIO_RUNTIME_INCLUDE_DIRS}
- ${VOLK_INCLUDE_DIRS}
- ${Boost_INCLUDE_DIRS}
-)
-
-link_directories(${Boost_LIBRARY_DIRS})
-
-if(ENABLE_GR_CTRLPORT)
- ADD_DEFINITIONS(-DGR_CTRLPORT)
-endif(ENABLE_GR_CTRLPORT)
-
-########################################################################
# Setup library
########################################################################
-list(APPEND analog_sources
+
+add_library(gnuradio-analog
cpm.cc
squelch_base_cc_impl.cc
squelch_base_ff_impl.cc
@@ -73,7 +52,17 @@ list(APPEND analog_sources
random_uniform_source_impl.cc
sig_source_impl.cc
simple_squelch_cc_impl.cc
+ )
+target_link_libraries(gnuradio-analog PUBLIC
+ gnuradio-runtime
+ gnuradio-blocks
+ gnuradio-filter
)
+target_include_directories(gnuradio-analog
+ PUBLIC
+ $<INSTALL_INTERFACE:include>
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../include>
+ )
#Add Windows DLL resource file if using MSVC
IF(MSVC)
@@ -84,40 +73,15 @@ IF(MSVC)
${CMAKE_CURRENT_BINARY_DIR}/gnuradio-analog.rc
@ONLY)
- list(APPEND analog_sources
+ target_sources(gnuradio-analog PRIVATE
${CMAKE_CURRENT_BINARY_DIR}/gnuradio-analog.rc
)
ENDIF(MSVC)
-list(APPEND analog_libs
- gnuradio-runtime
- gnuradio-blocks
- gnuradio-filter
- ${VOLK_LIBRARIES}
- ${Boost_LIBRARIES}
-)
-
-add_library(gnuradio-analog SHARED ${analog_sources})
-target_link_libraries(gnuradio-analog ${analog_libs})
-GR_LIBRARY_FOO(gnuradio-analog)
-add_dependencies(gnuradio-analog gnuradio-filter)
-
-if(ENABLE_STATIC_LIBS)
- add_library(gnuradio-analog_static STATIC ${analog_sources})
-
- add_dependencies(gnuradio-analog_static
- gnuradio-filter_static)
-
- if(NOT WIN32)
- set_target_properties(gnuradio-analog_static
- PROPERTIES OUTPUT_NAME gnuradio-analog)
- endif(NOT WIN32)
-
- install(TARGETS gnuradio-analog_static
- ARCHIVE DESTINATION lib${LIB_SUFFIX} # .lib file
- )
-endif(ENABLE_STATIC_LIBS)
+if(BUILD_SHARED_LIBS)
+ GR_LIBRARY_FOO(gnuradio-analog)
+endif()
########################################################################
# QA C++ Code for gr-analog
@@ -125,11 +89,6 @@ endif(ENABLE_STATIC_LIBS)
if(ENABLE_TESTING)
include(GrTest)
- include_directories(
- ${GR_ANALOG_INCLUDE_DIRS}
- ${GNURADIO_RUNTIME_INCLUDE_DIRS}
- )
-
list(APPEND test_gr_analog_sources
)
list(APPEND GR_TEST_TARGET_DEPS gnuradio-analog)
diff --git a/gr-analog/swig/CMakeLists.txt b/gr-analog/swig/CMakeLists.txt
index 9646299098..e55e0f41ea 100644
--- a/gr-analog/swig/CMakeLists.txt
+++ b/gr-analog/swig/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright 2012 Free Software Foundation, Inc.
+# Copyright 2012,2019 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -23,18 +23,8 @@
include(GrPython)
include(GrSwig)
-set(GR_SWIG_INCLUDE_DIRS
- ${GR_BLOCKS_INCLUDE_DIRS}
- ${GR_ANALOG_INCLUDE_DIRS}
- ${GR_FILTER_INCLUDE_DIRS}
- ${GNURADIO_RUNTIME_SWIG_INCLUDE_DIRS}
- ${VOLK_INCLUDE_DIRS}
- ${Boost_INCLUDE_DIRS}
-)
-
-if(ENABLE_GR_CTRLPORT)
- list(APPEND GR_SWIG_FLAGS "-DGR_CTRLPORT")
-endif(ENABLE_GR_CTRLPORT)
+set(GR_SWIG_INCLUDE_DIRS $<TARGET_PROPERTY:runtime_swig,INCLUDE_DIRECTORIES>)
+set(GR_SWIG_TARGET_DEPS runtime_swig)
set(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/analog_swig_doc.i)
set(GR_SWIG_DOC_DIRS
diff --git a/gr-audio/CMakeLists.txt b/gr-audio/CMakeLists.txt
index 6f373b7b94..9a4cf42b51 100644
--- a/gr-audio/CMakeLists.txt
+++ b/gr-audio/CMakeLists.txt
@@ -31,10 +31,6 @@ GR_REGISTER_COMPONENT("gr-audio" ENABLE_GR_AUDIO
ENABLE_GNURADIO_RUNTIME
)
-GR_SET_GLOBAL(GR_AUDIO_INCLUDE_DIRS
- ${CMAKE_CURRENT_SOURCE_DIR}/include
-)
-
SET(GR_PKG_AUDIO_EXAMPLES_DIR ${GR_PKG_DATA_DIR}/examples/audio)
########################################################################
diff --git a/gr-audio/examples/c++/CMakeLists.txt b/gr-audio/examples/c++/CMakeLists.txt
index 202a79afe7..813e162d8a 100644
--- a/gr-audio/examples/c++/CMakeLists.txt
+++ b/gr-audio/examples/c++/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright 2011 Free Software Foundation, Inc.
+# Copyright 2011,2019 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -17,13 +17,6 @@
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.
-include_directories(
- ${GR_AUDIO_INCLUDE_DIRS}
- ${GR_ANALOG_INCLUDE_DIRS}
- ${GNURADIO_RUNTIME_INCLUDE_DIRS}
- ${Boost_INCLUDE_DIRS}
-)
-
add_executable(dial_tone dial_tone.cc)
target_link_libraries(dial_tone
gnuradio-runtime gnuradio-audio gnuradio-analog)
diff --git a/gr-audio/lib/CMakeLists.txt b/gr-audio/lib/CMakeLists.txt
index 7d01bac39d..91333b24df 100644
--- a/gr-audio/lib/CMakeLists.txt
+++ b/gr-audio/lib/CMakeLists.txt
@@ -20,46 +20,38 @@
include(GrComponent)
########################################################################
-# Setup the include and linker paths
+# Setup library
########################################################################
-include_directories(
- ${CMAKE_CURRENT_SOURCE_DIR}
- ${GR_AUDIO_INCLUDE_DIRS}
- ${GNURADIO_RUNTIME_INCLUDE_DIRS}
- ${Boost_INCLUDE_DIRS}
-)
-
-link_directories(${Boost_LIBRARY_DIRS})
+add_library(gnuradio-audio audio_registry.cc)
+target_link_libraries(gnuradio-audio PUBLIC gnuradio-runtime)
+target_include_directories(gnuradio-audio
+ PUBLIC
+ $<INSTALL_INTERFACE:include>
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../include>
+ )
-list(APPEND gr_audio_libs gnuradio-runtime ${Boost_LIBRARIES})
-list(APPEND gr_audio_sources audio_registry.cc)
list(APPEND gr_audio_confs ${CMAKE_CURRENT_SOURCE_DIR}/gr-audio.conf)
-if(ENABLE_GR_CTRLPORT)
- ADD_DEFINITIONS(-DGR_CTRLPORT)
-endif(ENABLE_GR_CTRLPORT)
-
########################################################################
## ALSA Support
########################################################################
find_package(ALSA)
-if((ALSA_FOUND) AND NOT (CMAKE_SYSTEM_NAME STREQUAL "kFreeBSD") AND NOT (CMAKE_SYSTEM_NAME STREQUAL GNU))
-
- add_definitions(-DALSA_FOUND)
- GR_APPEND_SUBCOMPONENT("alsa")
+set(audio_deps "")
- include_directories(BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/alsa)
- include_directories(${ALSA_INCLUDE_DIRS})
- list(APPEND gr_audio_libs ${ALSA_LIBRARIES})
- list(APPEND gr_audio_sources
+if((ALSA_FOUND) AND NOT (CMAKE_SYSTEM_NAME STREQUAL "kFreeBSD") AND NOT (CMAKE_SYSTEM_NAME STREQUAL GNU))
+ target_compile_definitions(gnuradio-audio PRIVATE -DALSA_FOUND)
+ target_link_libraries(gnuradio-audio PUBLIC ALSA::ALSA)
+ target_sources(gnuradio-audio PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/alsa/alsa_impl.cc
${CMAKE_CURRENT_SOURCE_DIR}/alsa/alsa_source.cc
${CMAKE_CURRENT_SOURCE_DIR}/alsa/alsa_sink.cc
- )
- list(APPEND gr_audio_confs ${CMAKE_CURRENT_SOURCE_DIR}/alsa/gr-audio-alsa.conf)
+ )
-endif((ALSA_FOUND) AND NOT (CMAKE_SYSTEM_NAME STREQUAL "kFreeBSD") AND NOT (CMAKE_SYSTEM_NAME STREQUAL GNU))
+ gr_append_subcomponent("alsa")
+ list(APPEND audio_deps "ALSA")
+ list(APPEND gr_audio_confs ${CMAKE_CURRENT_SOURCE_DIR}/alsa/gr-audio-alsa.conf)
+endif()
########################################################################
## OSS Support
@@ -67,119 +59,97 @@ endif((ALSA_FOUND) AND NOT (CMAKE_SYSTEM_NAME STREQUAL "kFreeBSD") AND NOT (CMAK
find_package(OSS)
if(OSS_FOUND)
-
- add_definitions(-DOSS_FOUND)
- GR_APPEND_SUBCOMPONENT("oss")
-
- include_directories(BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/oss)
- include_directories(${OSS_INCLUDE_DIRS})
- list(APPEND gr_audio_sources
+ target_compile_definitions(gnuradio-audio PRIVATE -DOSS_FOUND)
+ target_link_libraries(gnuradio-audio PUBLIC OSS::OSS)
+ target_sources(gnuradio-audio PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/oss/oss_source.cc
${CMAKE_CURRENT_SOURCE_DIR}/oss/oss_sink.cc
- )
- list(APPEND gr_audio_confs ${CMAKE_CURRENT_SOURCE_DIR}/oss/gr-audio-oss.conf)
+ )
+ gr_append_subcomponent("oss")
+ list(APPEND audio_deps "OSS")
+ list(APPEND gr_audio_confs ${CMAKE_CURRENT_SOURCE_DIR}/oss/gr-audio-oss.conf)
endif(OSS_FOUND)
########################################################################
## Jack Support
########################################################################
-find_package(Jack)
+find_package(JACK)
if(JACK_FOUND)
-
- add_definitions(-DJACK_FOUND)
- GR_APPEND_SUBCOMPONENT("jack")
-
- include_directories(BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/jack)
- include_directories(${JACK_INCLUDE_DIRS})
- list(APPEND gr_audio_libs ${JACK_LIBRARIES})
- add_definitions(${JACK_DEFINITIONS})
- list(APPEND gr_audio_sources
+ target_compile_definitions(gnuradio-audio PRIVATE -DJACK_FOUND)
+ target_link_libraries(gnuradio-audio PUBLIC JACK::JACK)
+ target_sources(gnuradio-audio PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/jack/jack_impl.cc
${CMAKE_CURRENT_SOURCE_DIR}/jack/jack_source.cc
${CMAKE_CURRENT_SOURCE_DIR}/jack/jack_sink.cc
)
+ gr_append_subcomponent("jack")
+ list(APPEND audio_deps "JACK")
list(APPEND gr_audio_confs ${CMAKE_CURRENT_SOURCE_DIR}/jack/gr-audio-jack.conf)
-
endif(JACK_FOUND)
########################################################################
## OSX Support
########################################################################
include(CheckIncludeFileCXX)
-CHECK_INCLUDE_FILE_CXX(AudioUnit/AudioUnit.h AUDIO_UNIT_H)
-CHECK_INCLUDE_FILE_CXX(AudioToolbox/AudioToolbox.h AUDIO_TOOLBOX_H)
+check_include_file_cxx(AudioUnit/AudioUnit.h AUDIO_UNIT_H)
+check_include_file_cxx(AudioToolbox/AudioToolbox.h AUDIO_TOOLBOX_H)
if(AUDIO_UNIT_H AND AUDIO_TOOLBOX_H)
-
- add_definitions(-DOSX_FOUND)
- GR_APPEND_SUBCOMPONENT("osx")
-
- set(OSX_AUDIO_VALID 1 CACHE INTERNAL "OSX Audio is valid")
-
- include_directories(BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/osx)
- list(APPEND gr_audio_libs
+ target_compile_definitions(gnuradio-audio PRIVATE -DOSX_FOUND)
+ target_link_libraries(gnuradio-audio
+ PUBLIC
"-framework AudioUnit"
"-framework CoreAudio"
"-framework AudioToolbox"
"-framework Carbon"
- )
- list(APPEND gr_audio_sources
+ )
+ target_sources(gnuradio-audio PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/osx/osx_impl.cc
${CMAKE_CURRENT_SOURCE_DIR}/osx/osx_source.cc
${CMAKE_CURRENT_SOURCE_DIR}/osx/osx_sink.cc
)
+ gr_append_subcomponent("osx")
+ set(OSX_AUDIO_VALID 1 CACHE INTERNAL "OSX Audio is valid")
list(APPEND gr_audio_confs ${CMAKE_CURRENT_SOURCE_DIR}/osx/gr-audio-osx.conf)
-
-else(AUDIO_UNIT_H AND AUDIO_TOOLBOX_H)
-
+else()
set(OSX_AUDIO_VALID 0 CACHE INTERNAL "OSX Audio is not valid")
-
-endif(AUDIO_UNIT_H AND AUDIO_TOOLBOX_H)
+endif()
########################################################################
## PortAudio Support
########################################################################
-find_package(Portaudio)
+find_package(PORTAUDIO)
if(PORTAUDIO2_FOUND)
-
- add_definitions(-DPORTAUDIO_FOUND)
- GR_APPEND_SUBCOMPONENT("portaudio")
-
- include_directories(BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/portaudio)
- include_directories(${PORTAUDIO_INCLUDE_DIRS})
- list(APPEND gr_audio_libs ${PORTAUDIO_LIBRARIES})
- add_definitions(${PORTAUDIO_DEFINITIONS})
- list(APPEND gr_audio_sources
+ target_compile_definitions(gnuradio-audio PRIVATE -DPORTAUDIO_FOUND)
+ target_link_libraries(gnuradio-audio PUBLIC Portaudio::Portaudio)
+ target_sources(gnuradio-audio PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/portaudio/portaudio_impl.cc
${CMAKE_CURRENT_SOURCE_DIR}/portaudio/portaudio_source.cc
${CMAKE_CURRENT_SOURCE_DIR}/portaudio/portaudio_sink.cc
)
+ list(APPEND audio_deps "PORTAUDIO")
+ gr_append_subcomponent("portaudio")
list(APPEND gr_audio_confs ${CMAKE_CURRENT_SOURCE_DIR}/portaudio/gr-audio-portaudio.conf)
-
endif(PORTAUDIO2_FOUND)
########################################################################
## Windows Support
########################################################################
if(WIN32)
-
- add_definitions(-DWIN32_FOUND)
- GR_APPEND_SUBCOMPONENT("windows")
-
- include_directories(BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/windows)
- list(APPEND gr_audio_libs winmm.lib)
- list(APPEND gr_audio_sources
+ target_compile_definitions(gnuradio-audio PRIVATE -DWIN32_FOUND)
+ target_link_libraries(gnuradio-audio PUBLIC winmm.lib)
+ target_sources(gnuradio-audio PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/windows/windows_source.cc
${CMAKE_CURRENT_SOURCE_DIR}/windows/windows_sink.cc
)
-
+ gr_append_subcomponent("windows")
#Add Windows DLL resource file if using MSVC
- IF(MSVC)
+ if(MSVC)
include(${CMAKE_SOURCE_DIR}/cmake/Modules/GrVersion.cmake)
configure_file(
@@ -187,42 +157,11 @@ if(WIN32)
${CMAKE_CURRENT_BINARY_DIR}/gnuradio-audio.rc
@ONLY)
- list(APPEND gr_audio_sources
+ target_sources(gnuradio-audio PRIVATE
${CMAKE_CURRENT_BINARY_DIR}/gnuradio-audio.rc
)
- ENDIF()
-
+ endif()
endif(WIN32)
-########################################################################
-# Setup library
-########################################################################
-add_library(gnuradio-audio SHARED ${gr_audio_sources})
-target_link_libraries(gnuradio-audio ${gr_audio_libs})
-GR_LIBRARY_FOO(gnuradio-audio)
-
+gr_library_foo(gnuradio-audio ${audio_deps})
install(FILES ${gr_audio_confs} DESTINATION ${GR_PREFSDIR})
-
-if(ENABLE_STATIC_LIBS)
- if(ENABLE_GR_CTRLPORT)
- # Remove GR_CTRLPORT set this target's definitions.
- # Makes sure we don't try to use ControlPort stuff in source files
- GET_DIRECTORY_PROPERTY(STATIC_DEFS COMPILE_DEFINITIONS)
- list(REMOVE_ITEM STATIC_DEFS "GR_CTRLPORT")
- SET_PROPERTY(DIRECTORY PROPERTY COMPILE_DEFINITIONS "${STATIC_DEFS}")
-
- # readd it to the target since we removed it from the directory-wide list.
- SET_PROPERTY(TARGET gnuradio-audio APPEND PROPERTY COMPILE_DEFINITIONS "GR_CTRLPORT")
- endif(ENABLE_GR_CTRLPORT)
-
- add_library(gnuradio-audio_static STATIC ${gr_audio_sources})
-
- if(NOT WIN32)
- set_target_properties(gnuradio-audio_static
- PROPERTIES OUTPUT_NAME gnuradio-audio)
- endif(NOT WIN32)
-
- install(TARGETS gnuradio-audio_static
- ARCHIVE DESTINATION lib${LIB_SUFFIX} # .lib file
- )
-endif(ENABLE_STATIC_LIBS)
diff --git a/gr-audio/swig/CMakeLists.txt b/gr-audio/swig/CMakeLists.txt
index 4c67f5bd58..f31201aba7 100644
--- a/gr-audio/swig/CMakeLists.txt
+++ b/gr-audio/swig/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright 2011 Free Software Foundation, Inc.
+# Copyright 2011,2019 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -23,15 +23,8 @@
include(GrPython)
include(GrSwig)
-set(GR_SWIG_INCLUDE_DIRS
- ${GR_AUDIO_INCLUDE_DIRS}
- ${GNURADIO_RUNTIME_SWIG_INCLUDE_DIRS}
- ${Boost_INCLUDE_DIRS}
-)
-
-if(ENABLE_GR_CTRLPORT)
- list(APPEND GR_SWIG_FLAGS "-DGR_CTRLPORT")
-endif(ENABLE_GR_CTRLPORT)
+set(GR_SWIG_INCLUDE_DIRS $<TARGET_PROPERTY:runtime_swig,INCLUDE_DIRECTORIES>)
+set(GR_SWIG_TARGET_DEPS runtime_swig)
set(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/audio_swig_doc.i)
set(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../include/gnuradio/audio)
diff --git a/gr-blocks/CMakeLists.txt b/gr-blocks/CMakeLists.txt
index 86ad046d16..2ca88c1c12 100644
--- a/gr-blocks/CMakeLists.txt
+++ b/gr-blocks/CMakeLists.txt
@@ -32,14 +32,6 @@ GR_REGISTER_COMPONENT("gr-blocks" ENABLE_GR_BLOCKS
ENABLE_GNURADIO_RUNTIME
)
-GR_SET_GLOBAL(GR_BLOCKS_INCLUDE_DIRS
- ${CMAKE_CURRENT_SOURCE_DIR}/lib
- ${CMAKE_CURRENT_SOURCE_DIR}/include
- ${CMAKE_CURRENT_BINARY_DIR}/lib
- ${CMAKE_CURRENT_BINARY_DIR}/include
- ${VOLK_INCLUDE_DIRS}
-)
-
########################################################################
# Begin conditional configuration
########################################################################
diff --git a/gr-blocks/lib/CMakeLists.txt b/gr-blocks/lib/CMakeLists.txt
index dda5c395cb..7ee527d2fb 100644
--- a/gr-blocks/lib/CMakeLists.txt
+++ b/gr-blocks/lib/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright 2012-2014,2018 Free Software Foundation, Inc.
+# Copyright 2012-2014,2018-2019 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -23,27 +23,9 @@
include(${CMAKE_CURRENT_SOURCE_DIR}/ConfigChecks.cmake)
########################################################################
-# Setup the include and linker paths
-########################################################################
-include_directories(
- ${CMAKE_CURRENT_SOURCE_DIR}
- ${CMAKE_CURRENT_BINARY_DIR}
- ${CMAKE_CURRENT_BINARY_DIR}/../include
- ${GR_BLOCKS_INCLUDE_DIRS}
- ${GNURADIO_RUNTIME_INCLUDE_DIRS}
- ${Boost_INCLUDE_DIRS}
-)
-
-link_directories(${Boost_LIBRARY_DIRS})
-
-if(ENABLE_GR_CTRLPORT)
- ADD_DEFINITIONS(-DGR_CTRLPORT)
-endif(ENABLE_GR_CTRLPORT)
-
-########################################################################
# Setup library
########################################################################
-list(APPEND gr_blocks_sources
+add_library(gnuradio-blocks
abs_blk_impl.cc
add_blk_impl.cc
add_const_v_impl.cc
@@ -197,12 +179,23 @@ list(APPEND gr_blocks_sources
vector_to_streams_impl.cc
wavfile_sink_impl.cc
wavfile_source_impl.cc
-)
+ )
+
+target_link_libraries(gnuradio-blocks
+ gnuradio-runtime
+ ${GR_VOLK_LIB}
+ )
+
+target_include_directories(gnuradio-blocks
+ PUBLIC
+ $<INSTALL_INTERFACE:include>
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../include>
+ )
set_source_files_properties(file_source_impl.cc PROPERTIES COMPILE_FLAGS -D_FILE_OFFSET_BITS=64)
if(ENABLE_GR_CTRLPORT)
-list(APPEND blocks_ctrlport_sources
+target_sources(gnuradio-blocks PRIVATE
ctrlport_probe_c_impl.cc
ctrlport_probe2_c_impl.cc
ctrlport_probe2_f_impl.cc
@@ -210,11 +203,7 @@ list(APPEND blocks_ctrlport_sources
ctrlport_probe2_i_impl.cc
ctrlport_probe2_b_impl.cc
)
-
-list(APPEND gr_blocks_sources
- ${blocks_ctrlport_sources}
-)
-endif(ENABLE_GR_CTRLPORT)
+endif()
#Add Windows DLL resource file if using MSVC
IF(MSVC)
@@ -225,54 +214,14 @@ IF(MSVC)
${CMAKE_CURRENT_BINARY_DIR}/gnuradio-blocks.rc
@ONLY)
- list(APPEND gr_blocks_sources
+ target_sources(gnuradio-blocks PRIVATE
${CMAKE_CURRENT_BINARY_DIR}/gnuradio-blocks.rc
)
ENDIF(MSVC)
-list(APPEND blocks_libs
- gnuradio-runtime
- ${VOLK_LIBRARIES}
- ${Boost_LIBRARIES}
-)
-
-add_library(gnuradio-blocks SHARED ${gr_blocks_sources})
-
-target_link_libraries(gnuradio-blocks ${blocks_libs})
-GR_LIBRARY_FOO(gnuradio-blocks)
-
-if(ENABLE_STATIC_LIBS)
- # Remove controlport-specific source files from staticlibs build
- if(ENABLE_GR_CTRLPORT)
- if(ICE_FOUND)
- list(REMOVE_ITEM gr_blocks_sources
- ${blocks_ctrlport_sources}
- )
-
- # Remove GR_CTRLPORT set this target's definitions.
- # Makes sure we don't try to use ControlPort stuff in source files
- GET_DIRECTORY_PROPERTY(STATIC_DEFS COMPILE_DEFINITIONS)
- list(REMOVE_ITEM STATIC_DEFS "GR_CTRLPORT")
- SET_PROPERTY(DIRECTORY PROPERTY COMPILE_DEFINITIONS "${STATIC_DEFS}")
-
- # readd it to the target since we removed it from the directory-wide list.
- SET_PROPERTY(TARGET gnuradio-blocks APPEND PROPERTY COMPILE_DEFINITIONS "GR_CTRLPORT")
- endif(ICE_FOUND)
- endif(ENABLE_GR_CTRLPORT)
-
- add_library(gnuradio-blocks_static STATIC ${gr_blocks_sources})
-
- add_dependencies(gnuradio-blocks_static)
-
- if(NOT WIN32)
- set_target_properties(gnuradio-blocks_static
- PROPERTIES OUTPUT_NAME gnuradio-blocks)
- endif(NOT WIN32)
-
- install(TARGETS gnuradio-blocks_static
- ARCHIVE DESTINATION lib${LIB_SUFFIX} # .lib file
- )
-endif(ENABLE_STATIC_LIBS)
+if(BUILD_SHARED_LIBS)
+ GR_LIBRARY_FOO(gnuradio-blocks)
+endif()
########################################################################
# QA C++ Code for gr-blocks
@@ -280,11 +229,6 @@ endif(ENABLE_STATIC_LIBS)
if(ENABLE_TESTING)
include(GrTest)
- include_directories(
- ${GR_BLOCKS_INCLUDE_DIRS}
- ${GNURADIO_RUNTIME_INCLUDE_DIRS}
- )
-
list(APPEND test_gr_blocks_sources
qa_block_tags.cc
qa_gr_block.cc
@@ -296,8 +240,6 @@ if(ENABLE_TESTING)
qa_set_msg_handler.cc
)
list(APPEND GR_TEST_TARGET_DEPS gnuradio-blocks
- ${Boost_LIBRARIES}
- ${CMAKE_THREAD_LIBS_INIT}
)
foreach(qa_file ${test_gr_blocks_sources})
diff --git a/gr-blocks/swig/CMakeLists.txt b/gr-blocks/swig/CMakeLists.txt
index 1dc4aca483..388a4af4fb 100644
--- a/gr-blocks/swig/CMakeLists.txt
+++ b/gr-blocks/swig/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright 2012 Free Software Foundation, Inc.
+# Copyright 2012,2019 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -23,17 +23,6 @@
include(GrPython)
include(GrSwig)
-set(GR_SWIG_INCLUDE_DIRS
- ${GR_BLOCKS_INCLUDE_DIRS}
- ${GNURADIO_RUNTIME_INCLUDE_DIRS}
- ${GNURADIO_RUNTIME_SWIG_INCLUDE_DIRS}
- ${Boost_INCLUDE_DIRS}
-)
-
-if(ENABLE_GR_CTRLPORT)
- list(APPEND GR_SWIG_FLAGS "-DGR_CTRLPORT")
-endif(ENABLE_GR_CTRLPORT)
-
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/blocks_swig.py.in
${CMAKE_CURRENT_BINARY_DIR}/blocks_swig.py
@@ -57,7 +46,13 @@ set(GR_SWIG_BLOCK_IFILES
blocks_swig8
blocks_swig9
blocks_swig10
-)
+ )
+
+set(GR_SWIG_INCLUDE_DIRS $<TARGET_PROPERTY:runtime_swig,INCLUDE_DIRECTORIES>)
+set(GR_SWIG_TARGET_DEPS runtime_swig)
+if(ENABLE_GR_CTRLPORT)
+ set(GR_SWIG_FLAGS "-DGR_CTRLPORT")
+endif()
foreach(swigfile ${GR_SWIG_BLOCK_IFILES})
set(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/${swigfile}_doc.i)
@@ -67,6 +62,7 @@ foreach(swigfile ${GR_SWIG_BLOCK_IFILES})
)
set(GR_SWIG_DOCS_TARGET_DEPS runtime_swig_swig_doc)
set(GR_SWIG_LIBRARIES gnuradio-blocks)
+ set(GR_SWIG_MODULES runtime_swig)
GR_SWIG_MAKE(${swigfile} ${swigfile}.i)
GR_SWIG_INSTALL(
diff --git a/gr-blocks/tests/CMakeLists.txt b/gr-blocks/tests/CMakeLists.txt
index a012e2c844..b43a00491a 100644
--- a/gr-blocks/tests/CMakeLists.txt
+++ b/gr-blocks/tests/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright 2010-2013 Free Software Foundation, Inc.
+# Copyright 2010-2013,2019 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -22,19 +22,6 @@ include(GrMiscUtils) #check n def
GR_CHECK_HDR_N_DEF(sys/resource.h HAVE_SYS_RESOURCE_H)
########################################################################
-# Setup the include and linker paths
-########################################################################
-include_directories(
- ${GR_BLOCKS_INCLUDE_DIRS}
- ${GNURADIO_RUNTIME_INCLUDE_DIRS}
- ${Boost_INCLUDE_DIRS}
-)
-
-link_directories(
- ${Boost_LIBRARY_DIRS}
-)
-
-########################################################################
# Build benchmarks and non-registered tests
########################################################################
set(tests_not_run #single source per test
diff --git a/gr-channels/CMakeLists.txt b/gr-channels/CMakeLists.txt
index a508362be0..223b43a753 100644
--- a/gr-channels/CMakeLists.txt
+++ b/gr-channels/CMakeLists.txt
@@ -37,11 +37,6 @@ GR_REGISTER_COMPONENT("gr-channels" ENABLE_GR_CHANNELS
ENABLE_GR_ANALOG
)
-GR_SET_GLOBAL(GR_CHANNELS_INCLUDE_DIRS
- ${CMAKE_CURRENT_SOURCE_DIR}/lib
- ${CMAKE_CURRENT_SOURCE_DIR}/include
-)
-
SET(GR_PKG_CHANNELS_EXAMPLES_DIR ${GR_PKG_DATA_DIR}/examples/channels)
########################################################################
diff --git a/gr-channels/lib/CMakeLists.txt b/gr-channels/lib/CMakeLists.txt
index 07bcf9c0e4..e1d83640fd 100644
--- a/gr-channels/lib/CMakeLists.txt
+++ b/gr-channels/lib/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright 2012-2013 Free Software Foundation, Inc.
+# Copyright 2012-2013,2019 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -18,29 +18,9 @@
# Boston, MA 02110-1301, USA.
########################################################################
-# Setup the include and linker paths
-########################################################################
-include_directories(
- ${CMAKE_CURRENT_SOURCE_DIR}
- ${CMAKE_CURRENT_BINARY_DIR}
- ${GR_CHANNELS_INCLUDE_DIRS}
- ${GR_BLOCKS_INCLUDE_DIRS}
- ${GR_FILTER_INCLUDE_DIRS}
- ${GR_ANALOG_INCLUDE_DIRS}
- ${GNURADIO_RUNTIME_INCLUDE_DIRS}
- ${Boost_INCLUDE_DIRS}
-)
-
-link_directories(${Boost_LIBRARY_DIRS})
-
-if(ENABLE_GR_CTRLPORT)
- ADD_DEFINITIONS(-DGR_CTRLPORT)
-endif(ENABLE_GR_CTRLPORT)
-
-########################################################################
# Setup library
########################################################################
-list(APPEND channels_sources
+add_library(gnuradio-channels
channel_model_impl.cc
channel_model2_impl.cc
dynamic_channel_model_impl.cc
@@ -52,6 +32,20 @@ list(APPEND channels_sources
sro_model_impl.cc
)
+target_link_libraries(gnuradio-channels PUBLIC
+ gnuradio-runtime
+ gnuradio-filter
+ gnuradio-analog
+ gnuradio-blocks
+ Boost::boost
+)
+
+target_include_directories(gnuradio-channels
+ PUBLIC
+ $<INSTALL_INTERFACE:include>
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../include>
+ )
+
#Add Windows DLL resource file if using MSVC
if(MSVC)
include(${CMAKE_SOURCE_DIR}/cmake/Modules/GrVersion.cmake)
@@ -61,52 +55,11 @@ if(MSVC)
${CMAKE_CURRENT_BINARY_DIR}/gnuradio-channels.rc
@ONLY)
- list(APPEND channels_sources
+ target_sources(gnuradio-channels PRIVATE
${CMAKE_CURRENT_BINARY_DIR}/gnuradio-channels.rc
)
endif(MSVC)
-list(APPEND channels_libs
- gnuradio-runtime
- gnuradio-filter
- gnuradio-analog
- gnuradio-blocks
- ${VOLK_LIBRARIES}
- ${Boost_LIBRARIES}
-)
-
-add_library(gnuradio-channels SHARED ${channels_sources})
-target_link_libraries(gnuradio-channels ${channels_libs})
-GR_LIBRARY_FOO(gnuradio-channels)
-add_dependencies(gnuradio-channels
- gnuradio-runtime gnuradio-filter gnuradio-analog gnuradio-blocks)
-
-if(ENABLE_STATIC_LIBS)
- if(ENABLE_GR_CTRLPORT)
- # Remove GR_CTRLPORT set this target's definitions.
- # Makes sure we don't try to use ControlPort stuff in source files
- GET_DIRECTORY_PROPERTY(STATIC_DEFS COMPILE_DEFINITIONS)
- list(REMOVE_ITEM STATIC_DEFS "GR_CTRLPORT")
- SET_PROPERTY(DIRECTORY PROPERTY COMPILE_DEFINITIONS "${STATIC_DEFS}")
-
- # readd it to the target since we removed it from the directory-wide list.
- SET_PROPERTY(TARGET gnuradio-channels APPEND PROPERTY COMPILE_DEFINITIONS "GR_CTRLPORT")
- endif(ENABLE_GR_CTRLPORT)
-
- add_library(gnuradio-channels_static STATIC ${channels_sources})
-
- add_dependencies(gnuradio-channels_static
- gnuradio-runtime_static
- gnuradio-filter_static
- gnuradio-analog_static
- gnuradio-blocks_static)
-
- if(NOT WIN32)
- set_target_properties(gnuradio-channels_static
- PROPERTIES OUTPUT_NAME gnuradio-channels)
- endif(NOT WIN32)
-
- install(TARGETS gnuradio-channels_static
- ARCHIVE DESTINATION lib${LIB_SUFFIX} # .lib file
- )
-endif(ENABLE_STATIC_LIBS)
+if(BUILD_SHARED_LIBS)
+ GR_LIBRARY_FOO(gnuradio-channels)
+endif()
diff --git a/gr-channels/swig/CMakeLists.txt b/gr-channels/swig/CMakeLists.txt
index 55b7ea7a47..bf196a83e4 100644
--- a/gr-channels/swig/CMakeLists.txt
+++ b/gr-channels/swig/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright 2012 Free Software Foundation, Inc.
+# Copyright 2012,2019 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -23,16 +23,8 @@
include(GrPython)
include(GrSwig)
-set(GR_SWIG_INCLUDE_DIRS
- ${GR_CHANNELS_INCLUDE_DIRS}
- ${GR_FILTER_INCLUDE_DIRS}
- ${GNURADIO_RUNTIME_SWIG_INCLUDE_DIRS}
- ${Boost_INCLUDE_DIRS}
-)
-
-if(ENABLE_GR_CTRLPORT)
- list(APPEND GR_SWIG_FLAGS "-DGR_CTRLPORT")
-endif(ENABLE_GR_CTRLPORT)
+set(GR_SWIG_INCLUDE_DIRS $<TARGET_PROPERTY:runtime_swig,INCLUDE_DIRECTORIES>)
+set(GR_SWIG_TARGET_DEPS runtime_swig)
set(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/channels_swig_doc.i)
set(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../include/gnuradio/channels)
diff --git a/gr-comedi/CMakeLists.txt b/gr-comedi/CMakeLists.txt
index ca12f73b77..be0b17dad2 100644
--- a/gr-comedi/CMakeLists.txt
+++ b/gr-comedi/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright 2012 Free Software Foundation, Inc.
+# Copyright 2012,2019 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -35,15 +35,6 @@ GR_REGISTER_COMPONENT("gr-comedi" ENABLE_GR_COMEDI
ENABLE_GNURADIO_RUNTIME
)
-GR_SET_GLOBAL(GR_COMEDI_INCLUDE_DIRS
- ${CMAKE_CURRENT_SOURCE_DIR}/include
- ${CMAKE_CURRENT_BINARY_DIR}/include
-)
-
-GR_SET_GLOBAL(GR_COMEDI_SWIG_INCLUDE_DIRS
- ${CMAKE_CURRENT_SOURCE_DIR}/swig
-)
-
SET(GR_PKG_COMEDI_EXAMPLES_DIR ${GR_PKG_DATA_DIR}/examples/comedi)
########################################################################
diff --git a/gr-comedi/lib/CMakeLists.txt b/gr-comedi/lib/CMakeLists.txt
index aca63b7680..43054ef9d6 100644
--- a/gr-comedi/lib/CMakeLists.txt
+++ b/gr-comedi/lib/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright 2011,2012 Free Software Foundation, Inc.
+# Copyright 2011,2012,2019 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -18,62 +18,24 @@
# Boston, MA 02110-1301, USA.
########################################################################
-# Setup the include and linker paths
-########################################################################
-include_directories(
- ${GR_COMEDI_INCLUDE_DIRS}
- ${GNURADIO_RUNTIME_INCLUDE_DIRS}
- ${Boost_INCLUDE_DIRS}
- ${COMEDI_INCLUDE_DIRS}
-)
-
-link_directories(
- ${Boost_LIBRARY_DIRS}
- ${COMEDI_LIBRARY_DIRS}
-)
-
-if(ENABLE_GR_CTRLPORT)
- ADD_DEFINITIONS(-DGR_CTRLPORT)
-endif(ENABLE_GR_CTRLPORT)
-
-########################################################################
# Setup library
########################################################################
-list(APPEND comedi_sources
+add_library(gnuradio-comedi
sink_s_impl.cc
source_s_impl.cc
)
-list(APPEND comedi_libs
+target_link_libraries(gnuradio-comedi
gnuradio-runtime
- ${Boost_LIBRARIES}
${COMEDI_LIBRARIES}
)
-add_library(gnuradio-comedi SHARED ${comedi_sources})
-target_link_libraries(gnuradio-comedi ${comedi_libs})
-GR_LIBRARY_FOO(gnuradio-comedi)
-
-if(ENABLE_STATIC_LIBS)
- if(ENABLE_GR_CTRLPORT)
- # Remove GR_CTRLPORT set this target's definitions.
- # Makes sure we don't try to use ControlPort stuff in source files
- GET_DIRECTORY_PROPERTY(STATIC_DEFS COMPILE_DEFINITIONS)
- list(REMOVE_ITEM STATIC_DEFS "GR_CTRLPORT")
- SET_PROPERTY(DIRECTORY PROPERTY COMPILE_DEFINITIONS "${STATIC_DEFS}")
-
- # readd it to the target since we removed it from the directory-wide list.
- SET_PROPERTY(TARGET gnuradio-comedi APPEND PROPERTY COMPILE_DEFINITIONS "GR_CTRLPORT")
- endif(ENABLE_GR_CTRLPORT)
-
- add_library(gnuradio-comedi_static STATIC ${comedi_sources})
-
- if(NOT WIN32)
- set_target_properties(gnuradio-comedi_static
- PROPERTIES OUTPUT_NAME gnuradio-comedi)
- endif(NOT WIN32)
+target_include_directories(gnuradio-comedi
+ PUBLIC
+ $<INSTALL_INTERFACE:include>
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../include>
+ )
- install(TARGETS gnuradio-comedi_static
- ARCHIVE DESTINATION lib${LIB_SUFFIX} # .lib file
- )
-endif(ENABLE_STATIC_LIBS)
+if(BUILD_SHARED_LIBS)
+ GR_LIBRARY_FOO(gnuradio-comedi)
+endif()
diff --git a/gr-comedi/swig/CMakeLists.txt b/gr-comedi/swig/CMakeLists.txt
index bc9a99bd4a..77edb0ca89 100644
--- a/gr-comedi/swig/CMakeLists.txt
+++ b/gr-comedi/swig/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright 2012 Free Software Foundation, Inc.
+# Copyright 2012,2019 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -23,16 +23,10 @@
include(GrPython)
include(GrSwig)
-set(GR_SWIG_INCLUDE_DIRS
- ${GR_COMEDI_INCLUDE_DIRS}
- ${GNURADIO_RUNTIME_SWIG_INCLUDE_DIRS}
- ${Boost_INCLUDE_DIRS}
-)
-
-if(ENABLE_GR_CTRLPORT)
- list(APPEND GR_SWIG_FLAGS "-DGR_CTRLPORT")
-endif(ENABLE_GR_CTRLPORT)
+set(GR_SWIG_INCLUDE_DIRS $<TARGET_PROPERTY:runtime_swig,INCLUDE_DIRECTORIES>)
+set(GR_SWIG_TARGET_DEPS runtime_swig)
+set(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/analog_swig_doc.i)
# Setup swig docs to depend on includes and pull in from build directory
set(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/comedi_swig_doc.i)
set(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../include/gnuradio/comedi)
diff --git a/gr-digital/CMakeLists.txt b/gr-digital/CMakeLists.txt
index bc02e96331..4e0411fb1a 100644
--- a/gr-digital/CMakeLists.txt
+++ b/gr-digital/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright 2011 Free Software Foundation, Inc.
+# Copyright 2011,2019 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -36,15 +36,6 @@ GR_REGISTER_COMPONENT("gr-digital" ENABLE_GR_DIGITAL
ENABLE_GR_ANALOG
)
-GR_SET_GLOBAL(GR_DIGITAL_INCLUDE_DIRS
- ${CMAKE_CURRENT_SOURCE_DIR}/include
- ${CMAKE_CURRENT_BINARY_DIR}/include
-)
-
-GR_SET_GLOBAL(GR_DIGITAL_SWIG_INCLUDE_DIRS
- ${CMAKE_CURRENT_SOURCE_DIR}/swig
-)
-
SET(GR_PKG_DIGITAL_EXAMPLES_DIR ${GR_PKG_DATA_DIR}/examples/digital)
########################################################################
diff --git a/gr-digital/lib/CMakeLists.txt b/gr-digital/lib/CMakeLists.txt
index 28e603d13f..0cad7ee216 100644
--- a/gr-digital/lib/CMakeLists.txt
+++ b/gr-digital/lib/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (C) 2011-2016,2017 Free Software Foundation, Inc.
+# Copyright (C) 2011-2016,2017,2019 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -18,30 +18,10 @@
# Boston, MA 02110-1301, USA.
########################################################################
-# Setup the include and linker paths
-########################################################################
-include_directories(
- ${GR_DIGITAL_INCLUDE_DIRS}
- ${GR_BLOCKS_INCLUDE_DIRS}
- ${GR_ANALOG_INCLUDE_DIRS}
- ${GR_FFT_INCLUDE_DIRS}
- ${GR_FILTER_INCLUDE_DIRS}
- ${GR_BLOCKS_INCLUDE_DIRS}
- ${GNURADIO_RUNTIME_INCLUDE_DIRS}
- ${VOLK_INCLUDE_DIRS}
- ${Boost_INCLUDE_DIRS}
-)
-
-link_directories(${Boost_LIBRARY_DIRS})
-
-if(ENABLE_GR_CTRLPORT)
- ADD_DEFINITIONS(-DGR_CTRLPORT)
-endif(ENABLE_GR_CTRLPORT)
-
-########################################################################
# Setup library
########################################################################
-list(APPEND digital_sources
+
+add_library(gnuradio-digital
additive_scrambler_bb_impl.cc
binary_slicer_fb_impl.cc
burst_shaper_impl.cc
@@ -119,8 +99,23 @@ list(APPEND digital_sources
symbol_sync_cc_impl.cc
symbol_sync_ff_impl.cc
timing_error_detector.cc
+ )
+
+target_link_libraries(gnuradio-digital PUBLIC
+ gnuradio-runtime
+ gnuradio-filter
+ gnuradio-blocks
+ gnuradio-analog
+ Boost::boost
+ ${GR_VOLK_LIB}
)
+
+target_include_directories(gnuradio-digital
+ PUBLIC $<INSTALL_INTERFACE:include>
+ PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../include>
+ )
+
#Add Windows DLL resource file if using MSVC
IF(MSVC)
include(${CMAKE_SOURCE_DIR}/cmake/Modules/GrVersion.cmake)
@@ -130,62 +125,14 @@ IF(MSVC)
${CMAKE_CURRENT_BINARY_DIR}/gnuradio-digital.rc
@ONLY)
- list(APPEND gr_digital_sources
+ target_sources(gnuradio-digital PRIVATE
${CMAKE_CURRENT_BINARY_DIR}/gnuradio-digital.rc
)
ENDIF(MSVC)
-list(APPEND digital_libs
- gnuradio-runtime
- gnuradio-filter
- gnuradio-blocks
- gnuradio-analog
- ${VOLK_LIBRARIES}
- ${Boost_LIBRARIES}
-)
-
-add_library(gnuradio-digital SHARED ${digital_sources})
-target_link_libraries(gnuradio-digital ${digital_libs})
-GR_LIBRARY_FOO(gnuradio-digital)
-
-add_dependencies(
- gnuradio-digital
- gnuradio-runtime
- gnuradio-filter
- gnuradio-analog
- gnuradio-blocks
-)
-
-if(ENABLE_STATIC_LIBS)
- if(ENABLE_GR_CTRLPORT)
- # Remove GR_CTRLPORT set this target's definitions.
- # Makes sure we don't try to use ControlPort stuff in source files
- GET_DIRECTORY_PROPERTY(STATIC_DEFS COMPILE_DEFINITIONS)
- list(REMOVE_ITEM STATIC_DEFS "GR_CTRLPORT")
- SET_PROPERTY(DIRECTORY PROPERTY COMPILE_DEFINITIONS "${STATIC_DEFS}")
-
- # readd it to the target since we removed it from the directory-wide list.
- SET_PROPERTY(TARGET gnuradio-digital APPEND PROPERTY COMPILE_DEFINITIONS "GR_CTRLPORT")
- endif(ENABLE_GR_CTRLPORT)
-
- add_library(gnuradio-digital_static STATIC ${digital_sources})
-
- add_dependencies(gnuradio-digital_static
- gnuradio-runtime_static
- gnuradio-filter_static
- gnuradio-analog_static
- gnuradio-blocks_static)
-
- if(NOT WIN32)
- set_target_properties(gnuradio-digital_static
- PROPERTIES OUTPUT_NAME gnuradio-digital)
- endif(NOT WIN32)
-
- install(TARGETS gnuradio-digital_static
- ARCHIVE DESTINATION lib${LIB_SUFFIX} # .lib file
- )
-endif(ENABLE_STATIC_LIBS)
-
+if(BUILD_SHARED_LIBS)
+ GR_LIBRARY_FOO(gnuradio-digital)
+endif()
########################################################################
# QA C++ Code for gr-blocks
@@ -193,11 +140,6 @@ endif(ENABLE_STATIC_LIBS)
if(ENABLE_TESTING)
include(GrTest)
- include_directories(
- ${GR_DIGITAL_INCLUDE_DIRS}
- ${GNURADIO_RUNTIME_INCLUDE_DIRS}
- )
-
list(APPEND test_gr_digital_sources
qa_header_format.cc
qa_header_buffer.cc
diff --git a/gr-digital/swig/CMakeLists.txt b/gr-digital/swig/CMakeLists.txt
index fcfc14c33c..8fb2c2017c 100644
--- a/gr-digital/swig/CMakeLists.txt
+++ b/gr-digital/swig/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright 2011-2016 Free Software Foundation, Inc.
+# Copyright 2011-2016,2019 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -23,20 +23,8 @@
include(GrPython)
include(GrSwig)
-set(GR_SWIG_INCLUDE_DIRS
- ${GR_DIGITAL_INCLUDE_DIRS}
- ${GR_BLOCKS_INCLUDE_DIRS}
- ${GR_ANALOG_INCLUDE_DIRS}
- ${GR_FFT_INCLUDE_DIRS}
- ${GR_FILTER_INCLUDE_DIRS}
- ${GNURADIO_RUNTIME_SWIG_INCLUDE_DIRS}
- ${VOLK_INCLUDE_DIRS}
- ${Boost_INCLUDE_DIRS}
-)
-
-if(ENABLE_GR_CTRLPORT)
- list(APPEND GR_SWIG_FLAGS "-DGR_CTRLPORT")
-endif(ENABLE_GR_CTRLPORT)
+set(GR_SWIG_INCLUDE_DIRS $<TARGET_PROPERTY:runtime_swig,INCLUDE_DIRECTORIES>)
+set(GR_SWIG_TARGET_DEPS runtime_swig)
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/digital_swig.py.in
diff --git a/gr-dtv/CMakeLists.txt b/gr-dtv/CMakeLists.txt
index 119837ace4..d2eb09ec00 100644
--- a/gr-dtv/CMakeLists.txt
+++ b/gr-dtv/CMakeLists.txt
@@ -36,12 +36,6 @@ GR_REGISTER_COMPONENT("gr-dtv" ENABLE_GR_DTV
ENABLE_VOLK
)
-GR_SET_GLOBAL(GR_DTV_INCLUDE_DIRS
- ${CMAKE_CURRENT_SOURCE_DIR}/lib
- ${CMAKE_CURRENT_SOURCE_DIR}/include
- ${CMAKE_CURRENT_BINARY_DIR}/lib
-)
-
SET(GR_PKG_DTV_EXAMPLES_DIR ${GR_PKG_DATA_DIR}/examples/dtv)
########################################################################
diff --git a/gr-dtv/lib/CMakeLists.txt b/gr-dtv/lib/CMakeLists.txt
index 1cc39a7f9f..c7429f4e40 100644
--- a/gr-dtv/lib/CMakeLists.txt
+++ b/gr-dtv/lib/CMakeLists.txt
@@ -18,29 +18,9 @@
# Boston, MA 02110-1301, USA.
########################################################################
-# Setup the include and linker paths
-########################################################################
-include_directories(
- ${CMAKE_CURRENT_SOURCE_DIR}
- ${GR_DTV_INCLUDE_DIRS}
- ${GR_FILTER_INCLUDE_DIRS}
- ${GR_ANALOG_INCLUDE_DIRS}
- ${GR_FEC_INCLUDE_DIRS}
- ${GNURADIO_RUNTIME_INCLUDE_DIRS}
- ${VOLK_INCLUDE_DIRS}
- ${Boost_INCLUDE_DIRS}
-)
-
-link_directories(${Boost_LIBRARY_DIRS})
-
-if(ENABLE_GR_CTRLPORT)
- ADD_DEFINITIONS(-DGR_CTRLPORT)
-endif(ENABLE_GR_CTRLPORT)
-
-########################################################################
# Setup library
########################################################################
-list(APPEND dtv_sources
+add_library(gnuradio-dtv
atsc/atsc_deinterleaver_impl.cc
atsc/atsc_depad_impl.cc
atsc/atsc_derandomizer_impl.cc
@@ -100,13 +80,19 @@ list(APPEND dtv_sources
catv/catv_trellis_enc_bb_impl.cc
)
-list(APPEND dtv_libs
+target_link_libraries(gnuradio-dtv PUBLIC
gnuradio-runtime
gnuradio-analog
gnuradio-filter
gnuradio-fec
- ${VOLK_LIBRARIES}
-)
+ ${GR_VOLK_LIB}
+ )
+
+target_include_directories(gnuradio-dtv
+ PUBLIC
+ $<INSTALL_INTERFACE:include>
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../include>
+ )
include (CheckCCompilerFlag)
if (MSVC)
@@ -136,7 +122,7 @@ if(SSE2_SUPPORTED)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /arch:SSE2")
endif ()
endif()
- ADD_DEFINITIONS(-DDTV_SSE2)
+ target_compile_definitions(gnuradio-dtv PRIVATE -DDTV_SSE2)
endif(SSE2_SUPPORTED)
#Add Windows DLL resource file if using MSVC
@@ -148,11 +134,11 @@ if(MSVC)
${CMAKE_CURRENT_BINARY_DIR}/gnuradio-dtv.rc
@ONLY)
- list(APPEND dtv_sources
+ target_sources(gnuradio-dtv PRIVATE
${CMAKE_CURRENT_BINARY_DIR}/gnuradio-dtv.rc
)
endif(MSVC)
-add_library(gnuradio-dtv SHARED ${dtv_sources})
-target_link_libraries(gnuradio-dtv ${dtv_libs})
-GR_LIBRARY_FOO(gnuradio-dtv)
+if(BUILD_SHARED_LIBS)
+ GR_LIBRARY_FOO(gnuradio-dtv)
+endif()
diff --git a/gr-dtv/lib/dvb/dvb_ldpc_bb_impl.h b/gr-dtv/lib/dvb/dvb_ldpc_bb_impl.h
index e6a2f6c492..bf2ad5c8ce 100644
--- a/gr-dtv/lib/dvb/dvb_ldpc_bb_impl.h
+++ b/gr-dtv/lib/dvb/dvb_ldpc_bb_impl.h
@@ -1,17 +1,17 @@
/* -*- c++ -*- */
-/*
+/*
* Copyright 2015,2016 Free Software Foundation, Inc.
- *
+ *
* This is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
- *
+ *
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
@@ -21,8 +21,9 @@
#ifndef INCLUDED_DTV_DVB_LDPC_BB_IMPL_H
#define INCLUDED_DTV_DVB_LDPC_BB_IMPL_H
-#include <gnuradio/dtv/dvb_ldpc_bb.h>
#include "dvb_defines.h"
+
+#include <gnuradio/dtv/dvb_ldpc_bb.h>
#include <boost/smart_ptr.hpp>
@@ -128,4 +129,3 @@ namespace gr {
} // namespace gr
#endif /* INCLUDED_DTV_DVB_LDPC_BB_IMPL_H */
-
diff --git a/gr-dtv/lib/dvbs2/dvbs2_interleaver_bb_impl.h b/gr-dtv/lib/dvbs2/dvbs2_interleaver_bb_impl.h
index 36d314c279..b19800c25e 100644
--- a/gr-dtv/lib/dvbs2/dvbs2_interleaver_bb_impl.h
+++ b/gr-dtv/lib/dvbs2/dvbs2_interleaver_bb_impl.h
@@ -1,17 +1,17 @@
/* -*- c++ -*- */
-/*
+/*
* Copyright 2015 Free Software Foundation, Inc.
- *
+ *
* This is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
- *
+ *
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
@@ -21,8 +21,9 @@
#ifndef INCLUDED_DTV_DVBS2_INTERLEAVER_BB_IMPL_H
#define INCLUDED_DTV_DVBS2_INTERLEAVER_BB_IMPL_H
+#include "../dvb/dvb_defines.h"
+
#include <gnuradio/dtv/dvbs2_interleaver_bb.h>
-#include "dvb/dvb_defines.h"
namespace gr {
namespace dtv {
@@ -60,4 +61,3 @@ namespace gr {
} // namespace gr
#endif /* INCLUDED_DTV_DVBS2_INTERLEAVER_BB_IMPL_H */
-
diff --git a/gr-dtv/lib/dvbs2/dvbs2_modulator_bc_impl.h b/gr-dtv/lib/dvbs2/dvbs2_modulator_bc_impl.h
index ca042c25dc..d606d535c0 100644
--- a/gr-dtv/lib/dvbs2/dvbs2_modulator_bc_impl.h
+++ b/gr-dtv/lib/dvbs2/dvbs2_modulator_bc_impl.h
@@ -1,17 +1,17 @@
/* -*- c++ -*- */
-/*
+/*
* Copyright 2015,2016 Free Software Foundation, Inc.
- *
+ *
* This is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
- *
+ *
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
@@ -21,8 +21,9 @@
#ifndef INCLUDED_DTV_DVBS2_MODULATOR_BC_IMPL_H
#define INCLUDED_DTV_DVBS2_MODULATOR_BC_IMPL_H
+#include "../dvb/dvb_defines.h"
+
#include <gnuradio/dtv/dvbs2_modulator_bc.h>
-#include "dvb/dvb_defines.h"
namespace gr {
namespace dtv {
@@ -57,4 +58,3 @@ namespace gr {
} // namespace gr
#endif /* INCLUDED_DVBS2_MODULATOR_BC_IMPL_H */
-
diff --git a/gr-dtv/lib/dvbs2/dvbs2_physical_cc_impl.h b/gr-dtv/lib/dvbs2/dvbs2_physical_cc_impl.h
index 47a0a3e19b..845c5687d7 100644
--- a/gr-dtv/lib/dvbs2/dvbs2_physical_cc_impl.h
+++ b/gr-dtv/lib/dvbs2/dvbs2_physical_cc_impl.h
@@ -1,17 +1,17 @@
/* -*- c++ -*- */
-/*
+/*
* Copyright 2015,2016 Free Software Foundation, Inc.
- *
+ *
* This is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
- *
+ *
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
@@ -21,8 +21,9 @@
#ifndef INCLUDED_DTV_DVBS2_PHYSICAL_CC_IMPL_H
#define INCLUDED_DTV_DVBS2_PHYSICAL_CC_IMPL_H
+#include "../dvb/dvb_defines.h"
+
#include <gnuradio/dtv/dvbs2_physical_cc.h>
-#include "dvb/dvb_defines.h"
#define VLSNR_HEADER_LENGTH 900
@@ -72,4 +73,3 @@ namespace gr {
} // namespace gr
#endif /* INCLUDED_DTV_DVBS2_PHYSICAL_CC_IMPL_H */
-
diff --git a/gr-dtv/lib/dvbt2/dvbt2_cellinterleaver_cc_impl.h b/gr-dtv/lib/dvbt2/dvbt2_cellinterleaver_cc_impl.h
index 6b7fb0586b..233c805096 100644
--- a/gr-dtv/lib/dvbt2/dvbt2_cellinterleaver_cc_impl.h
+++ b/gr-dtv/lib/dvbt2/dvbt2_cellinterleaver_cc_impl.h
@@ -1,17 +1,17 @@
/* -*- c++ -*- */
-/*
+/*
* Copyright 2015 Free Software Foundation, Inc.
- *
+ *
* This is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
- *
+ *
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
@@ -21,8 +21,9 @@
#ifndef INCLUDED_DTV_DVBT2_CELLINTERLEAVER_CC_IMPL_H
#define INCLUDED_DTV_DVBT2_CELLINTERLEAVER_CC_IMPL_H
+#include "../dvb/dvb_defines.h"
+
#include <gnuradio/dtv/dvbt2_cellinterleaver_cc.h>
-#include "dvb/dvb_defines.h"
namespace gr {
namespace dtv {
@@ -56,4 +57,3 @@ namespace gr {
} // namespace gr
#endif /* INCLUDED_DTV_DVBT2_CELLINTERLEAVER_CC_IMPL_H */
-
diff --git a/gr-dtv/lib/dvbt2/dvbt2_framemapper_cc_impl.h b/gr-dtv/lib/dvbt2/dvbt2_framemapper_cc_impl.h
index 8d35493f45..06998ebe73 100644
--- a/gr-dtv/lib/dvbt2/dvbt2_framemapper_cc_impl.h
+++ b/gr-dtv/lib/dvbt2/dvbt2_framemapper_cc_impl.h
@@ -1,17 +1,17 @@
/* -*- c++ -*- */
-/*
+/*
* Copyright 2015 Free Software Foundation, Inc.
- *
+ *
* This is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
- *
+ *
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
@@ -21,8 +21,9 @@
#ifndef INCLUDED_DTV_DVBT2_FRAMEMAPPER_CC_IMPL_H
#define INCLUDED_DTV_DVBT2_FRAMEMAPPER_CC_IMPL_H
+#include "../dvb/dvb_defines.h"
+
#include <gnuradio/dtv/dvbt2_framemapper_cc.h>
-#include "dvb/dvb_defines.h"
#define KBCH_1_4 3072
#define NBCH_1_4 3240
@@ -205,4 +206,3 @@ namespace gr {
} // namespace gr
#endif /* INCLUDED_DTV_DVBT2_FRAMEMAPPER_CC_IMPL_H */
-
diff --git a/gr-dtv/lib/dvbt2/dvbt2_freqinterleaver_cc_impl.h b/gr-dtv/lib/dvbt2/dvbt2_freqinterleaver_cc_impl.h
index a52dc9ed94..7e4fd08314 100644
--- a/gr-dtv/lib/dvbt2/dvbt2_freqinterleaver_cc_impl.h
+++ b/gr-dtv/lib/dvbt2/dvbt2_freqinterleaver_cc_impl.h
@@ -1,17 +1,17 @@
/* -*- c++ -*- */
-/*
+/*
* Copyright 2015 Free Software Foundation, Inc.
- *
+ *
* This is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
- *
+ *
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
@@ -21,8 +21,9 @@
#ifndef INCLUDED_DTV_DVBT2_FREQINTERLEAVER_CC_IMPL_H
#define INCLUDED_DTV_DVBT2_FREQINTERLEAVER_CC_IMPL_H
+#include "../dvb/dvb_defines.h"
+
#include <gnuradio/dtv/dvbt2_freqinterleaver_cc.h>
-#include "dvb/dvb_defines.h"
namespace gr {
namespace dtv {
@@ -69,4 +70,3 @@ namespace gr {
} // namespace gr
#endif /* INCLUDED_DTV_DVBT2_FREQINTERLEAVER_CC_IMPL_H */
-
diff --git a/gr-dtv/lib/dvbt2/dvbt2_interleaver_bb_impl.h b/gr-dtv/lib/dvbt2/dvbt2_interleaver_bb_impl.h
index 7218464d5e..59a89d9618 100644
--- a/gr-dtv/lib/dvbt2/dvbt2_interleaver_bb_impl.h
+++ b/gr-dtv/lib/dvbt2/dvbt2_interleaver_bb_impl.h
@@ -6,12 +6,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
- *
+ *
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
@@ -21,8 +21,9 @@
#ifndef INCLUDED_DTV_DVBT2_INTERLEAVER_BB_IMPL_H
#define INCLUDED_DTV_DVBT2_INTERLEAVER_BB_IMPL_H
+#include "../dvb/dvb_defines.h"
+
#include <gnuradio/dtv/dvbt2_interleaver_bb.h>
-#include "dvb/dvb_defines.h"
namespace gr {
namespace dtv {
@@ -85,4 +86,3 @@ namespace gr {
} // namespace gr
#endif /* INCLUDED_DTV_DVBT2_INTERLEAVER_BB_IMPL_H */
-
diff --git a/gr-dtv/lib/dvbt2/dvbt2_miso_cc_impl.h b/gr-dtv/lib/dvbt2/dvbt2_miso_cc_impl.h
index 8dcbdf9c7a..2d14808107 100644
--- a/gr-dtv/lib/dvbt2/dvbt2_miso_cc_impl.h
+++ b/gr-dtv/lib/dvbt2/dvbt2_miso_cc_impl.h
@@ -1,17 +1,17 @@
/* -*- c++ -*- */
-/*
+/*
* Copyright 2015 Free Software Foundation, Inc.
- *
+ *
* This is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
- *
+ *
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
@@ -21,8 +21,9 @@
#ifndef INCLUDED_DTV_DVBT2_MISO_CC_IMPL_H
#define INCLUDED_DTV_DVBT2_MISO_CC_IMPL_H
+#include "../dvb/dvb_defines.h"
+
#include <gnuradio/dtv/dvbt2_miso_cc.h>
-#include "dvb/dvb_defines.h"
namespace gr {
namespace dtv {
@@ -50,4 +51,3 @@ namespace gr {
} // namespace gr
#endif /* INCLUDED_DTV_DVBT2_MISO_CC_IMPL_H */
-
diff --git a/gr-dtv/lib/dvbt2/dvbt2_modulator_bc_impl.h b/gr-dtv/lib/dvbt2/dvbt2_modulator_bc_impl.h
index 67f17e1e78..3853075e5b 100644
--- a/gr-dtv/lib/dvbt2/dvbt2_modulator_bc_impl.h
+++ b/gr-dtv/lib/dvbt2/dvbt2_modulator_bc_impl.h
@@ -1,17 +1,17 @@
/* -*- c++ -*- */
-/*
+/*
* Copyright 2015 Free Software Foundation, Inc.
- *
+ *
* This is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
- *
+ *
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
@@ -21,8 +21,9 @@
#ifndef INCLUDED_DTV_DVBT2_MODULATOR_BC_IMPL_H
#define INCLUDED_DTV_DVBT2_MODULATOR_BC_IMPL_H
+#include "../dvb/dvb_defines.h"
+
#include <gnuradio/dtv/dvbt2_modulator_bc.h>
-#include "dvb/dvb_defines.h"
namespace gr {
namespace dtv {
@@ -54,4 +55,3 @@ namespace gr {
} // namespace gr
#endif /* INCLUDED_DTV_DVBT2_MODULATOR_BC_IMPL_H */
-
diff --git a/gr-dtv/lib/dvbt2/dvbt2_p1insertion_cc_impl.h b/gr-dtv/lib/dvbt2/dvbt2_p1insertion_cc_impl.h
index 3931723009..7d83b4c4a1 100644
--- a/gr-dtv/lib/dvbt2/dvbt2_p1insertion_cc_impl.h
+++ b/gr-dtv/lib/dvbt2/dvbt2_p1insertion_cc_impl.h
@@ -1,17 +1,17 @@
/* -*- c++ -*- */
-/*
+/*
* Copyright 2015 Free Software Foundation, Inc.
- *
+ *
* This is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
- *
+ *
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
@@ -21,9 +21,10 @@
#ifndef INCLUDED_DTV_DVBT2_P1INSERTION_CC_IMPL_H
#define INCLUDED_DTV_DVBT2_P1INSERTION_CC_IMPL_H
+#include "../dvb/dvb_defines.h"
+
#include <gnuradio/dtv/dvbt2_p1insertion_cc.h>
#include <gnuradio/fft/fft.h>
-#include "dvb/dvb_defines.h"
namespace gr {
namespace dtv {
@@ -82,4 +83,3 @@ namespace gr {
} // namespace gr
#endif /* INCLUDED_DTV_DVBT2_P1INSERTION_CC_IMPL_H */
-
diff --git a/gr-dtv/lib/dvbt2/dvbt2_paprtr_cc_impl.h b/gr-dtv/lib/dvbt2/dvbt2_paprtr_cc_impl.h
index 3e2245392b..886afd2e38 100644
--- a/gr-dtv/lib/dvbt2/dvbt2_paprtr_cc_impl.h
+++ b/gr-dtv/lib/dvbt2/dvbt2_paprtr_cc_impl.h
@@ -1,17 +1,17 @@
/* -*- c++ -*- */
-/*
+/*
* Copyright 2015 Free Software Foundation, Inc.
- *
+ *
* This is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
- *
+ *
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
@@ -21,9 +21,10 @@
#ifndef INCLUDED_DTV_DVBT2_PAPRTR_CC_IMPL_H
#define INCLUDED_DTV_DVBT2_PAPRTR_CC_IMPL_H
+#include "../dvb/dvb_defines.h"
+
#include <gnuradio/dtv/dvbt2_paprtr_cc.h>
#include <gnuradio/fft/fft.h>
-#include "dvb/dvb_defines.h"
#define MAX_CARRIERS 27841
#define MAX_FFTSIZE 32768
@@ -109,4 +110,3 @@ namespace gr {
} // namespace gr
#endif /* INCLUDED_DTV_DVBT2_PAPRTR_CC_IMPL_H */
-
diff --git a/gr-dtv/lib/dvbt2/dvbt2_pilotgenerator_cc_impl.h b/gr-dtv/lib/dvbt2/dvbt2_pilotgenerator_cc_impl.h
index 9f06721d04..b6809dbc06 100644
--- a/gr-dtv/lib/dvbt2/dvbt2_pilotgenerator_cc_impl.h
+++ b/gr-dtv/lib/dvbt2/dvbt2_pilotgenerator_cc_impl.h
@@ -1,17 +1,17 @@
/* -*- c++ -*- */
-/*
+/*
* Copyright 2015 Free Software Foundation, Inc.
- *
+ *
* This is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
- *
+ *
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
@@ -21,8 +21,9 @@
#ifndef INCLUDED_DTV_DVBT2_PILOTGENERATOR_CC_IMPL_H
#define INCLUDED_DTV_DVBT2_PILOTGENERATOR_CC_IMPL_H
+#include "../dvb/dvb_defines.h"
+
#include <gnuradio/dtv/dvbt2_pilotgenerator_cc.h>
-#include "dvb/dvb_defines.h"
#include <gnuradio/fft/fft.h>
#include <vector>
@@ -171,4 +172,3 @@ namespace gr {
} // namespace gr
#endif /* INCLUDED_DTV_DVBT2_PILOTGENERATOR_CC_IMPL_H */
-
diff --git a/gr-dtv/swig/CMakeLists.txt b/gr-dtv/swig/CMakeLists.txt
index 7e98fa3b45..b1f02999fc 100644
--- a/gr-dtv/swig/CMakeLists.txt
+++ b/gr-dtv/swig/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright 2014 Free Software Foundation, Inc.
+# Copyright 2014,2019 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -23,15 +23,8 @@
include(GrPython)
include(GrSwig)
-set(GR_SWIG_INCLUDE_DIRS
- ${GR_DTV_INCLUDE_DIRS}
- ${GNURADIO_RUNTIME_SWIG_INCLUDE_DIRS}
- ${Boost_INCLUDE_DIRS}
-)
-
-if(ENABLE_GR_CTRLPORT)
- list(APPEND GR_SWIG_FLAGS "-DGR_CTRLPORT")
-endif(ENABLE_GR_CTRLPORT)
+set(GR_SWIG_INCLUDE_DIRS $<TARGET_PROPERTY:runtime_swig,INCLUDE_DIRECTORIES>)
+set(GR_SWIG_TARGET_DEPS runtime_swig)
set(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/dtv_swig_doc.i)
set(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../include/gnuradio/dtv)
diff --git a/gr-fec/CMakeLists.txt b/gr-fec/CMakeLists.txt
index be554db7ef..2b562da5fb 100644
--- a/gr-fec/CMakeLists.txt
+++ b/gr-fec/CMakeLists.txt
@@ -36,13 +36,6 @@ GR_REGISTER_COMPONENT("gr-fec" ENABLE_GR_FEC
ENABLE_GR_BLOCKS
)
-GR_SET_GLOBAL(GR_FEC_INCLUDE_DIRS
- ${CMAKE_CURRENT_SOURCE_DIR}/lib
- ${CMAKE_CURRENT_SOURCE_DIR}/lib/viterbi
- ${CMAKE_CURRENT_SOURCE_DIR}/lib/reed-solomon
- ${CMAKE_CURRENT_SOURCE_DIR}/include
-)
-
SET(GR_PKG_FEC_EXAMPLES_DIR ${GR_PKG_DATA_DIR}/examples/fec)
########################################################################
@@ -66,7 +59,6 @@ endif(ENABLE_GRC)
add_subdirectory(examples)
add_subdirectory(docs)
add_subdirectory(ldpc_alist)
-add_subdirectory(apps)
########################################################################
# Create Pkg Config File
diff --git a/gr-fec/lib/CMakeLists.txt b/gr-fec/lib/CMakeLists.txt
index 7f07314768..cbcfb62861 100644
--- a/gr-fec/lib/CMakeLists.txt
+++ b/gr-fec/lib/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright 2012-2014 Free Software Foundation, Inc.
+# Copyright 2012-2014,2019 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -19,34 +19,11 @@
# These are convenience libraries of 3rd party code.
# Change to test for distro provided packages
-GR_INCLUDE_SUBDIRECTORY(reed-solomon)
-GR_INCLUDE_SUBDIRECTORY(viterbi)
-
-########################################################################
-# Setup the include and linker paths
-########################################################################
-include_directories(
- ${CMAKE_CURRENT_SOURCE_DIR}
- ${CMAKE_CURRENT_BINARY_DIR}
- ${GR_FEC_INCLUDE_DIRS}
- ${GR_BLOCKS_INCLUDE_DIRS}
- ${GNURADIO_RUNTIME_INCLUDE_DIRS}
- ${VOLK_INCLUDE_DIRS}
- ${Boost_INCLUDE_DIRS}
-)
-
-if(ENABLE_GR_CTRLPORT)
- ADD_DEFINITIONS(-DGR_CTRLPORT)
-endif(ENABLE_GR_CTRLPORT)
-
-link_directories(
- ${Boost_LIBRARY_DIRS}
-)
########################################################################
# Setup library
########################################################################
-list(APPEND gnuradio_fec_sources
+add_library(gnuradio-fec
generic_decoder.cc
generic_encoder.cc
decoder_impl.cc
@@ -87,7 +64,20 @@ list(APPEND gnuradio_fec_sources
scl_list.cc
polar_encoder_systematic.cc
polar_decoder_sc_systematic.cc
-)
+ )
+target_include_directories(gnuradio-fec
+ PUBLIC
+ $<INSTALL_INTERFACE:include>
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../include>
+ )
+
+add_subdirectory(reed-solomon)
+
+target_sources(gnuradio-fec PRIVATE
+ ${CMAKE_CURRENT_SOURCE_DIR}/viterbi/metrics.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/viterbi/tab.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/viterbi/viterbi.cc
+ )
#Add Windows DLL resource file if using MSVC
if(MSVC)
@@ -98,25 +88,20 @@ if(MSVC)
${CMAKE_CURRENT_BINARY_DIR}/gnuradio-fec.rc
@ONLY)
- list(APPEND gnuradio_fec_sources
+ target_sources(gnuradio-fec PRIVATE
${CMAKE_CURRENT_BINARY_DIR}/gnuradio-fec.rc
)
endif(MSVC)
-list(APPEND gnuradio_fec_libs
- gnuradio-blocks
+target_link_libraries(gnuradio-fec PUBLIC
gnuradio-runtime
- ${VOLK_LIBRARIES}
- ${Boost_LIBRARIES}
+ gnuradio-blocks
)
# Only include the LDPC work if we have GSL installed
if(GSL_FOUND)
- include_directories(${GSL_INCLUDE_DIRS})
- link_directories(${GSL_LIBRARY_DIRS})
- list(APPEND gnuradio_fec_libs ${GSL_LDFLAGS})
-
- list(APPEND gnuradio_fec_sources
+ target_link_libraries(gnuradio-fec PUBLIC gsl::gsl)
+ target_sources(gnuradio-fec PRIVATE
ldpc_bit_flip_decoder_impl.cc
ldpc_par_mtrx_encoder_impl.cc
ldpc_gen_mtrx_encoder_impl.cc
@@ -126,30 +111,6 @@ if(GSL_FOUND)
)
endif(GSL_FOUND)
-add_library(gnuradio-fec SHARED ${gnuradio_fec_sources})
-target_link_libraries(gnuradio-fec ${gnuradio_fec_libs})
-GR_LIBRARY_FOO(gnuradio-fec)
-
-if(ENABLE_STATIC_LIBS)
- if(ENABLE_GR_CTRLPORT)
- # Remove GR_CTRLPORT set this target's definitions.
- # Makes sure we don't try to use ControlPort stuff in source files
- GET_DIRECTORY_PROPERTY(STATIC_DEFS COMPILE_DEFINITIONS)
- list(REMOVE_ITEM STATIC_DEFS "GR_CTRLPORT")
- SET_PROPERTY(DIRECTORY PROPERTY COMPILE_DEFINITIONS "${STATIC_DEFS}")
-
- # readd it to the target since we removed it from the directory-wide list.
- SET_PROPERTY(TARGET gnuradio-fec APPEND PROPERTY COMPILE_DEFINITIONS "GR_CTRLPORT")
- endif(ENABLE_GR_CTRLPORT)
-
- add_library(gnuradio-fec_static STATIC ${gnuradio_fec_sources})
-
- if(NOT WIN32)
- set_target_properties(gnuradio-fec_static
- PROPERTIES OUTPUT_NAME gnuradio-fec)
- endif(NOT WIN32)
-
- install(TARGETS gnuradio-fec_static
- ARCHIVE DESTINATION lib${LIB_SUFFIX} # .lib file
- )
-endif(ENABLE_STATIC_LIBS)
+if(BUILD_SHARED_LIBS)
+ GR_LIBRARY_FOO(gnuradio-fec)
+endif()
diff --git a/gr-fec/lib/reed-solomon/CMakeLists.txt b/gr-fec/lib/reed-solomon/CMakeLists.txt
index 383441e9eb..2c96921bf7 100644
--- a/gr-fec/lib/reed-solomon/CMakeLists.txt
+++ b/gr-fec/lib/reed-solomon/CMakeLists.txt
@@ -32,30 +32,31 @@ if(MSVC)
)
endif(MSVC)
-set(gr_fec_rs_sources
+add_library(gr_fec_rs OBJECT
${CMAKE_CURRENT_SOURCE_DIR}/encode_rs.c
${CMAKE_CURRENT_SOURCE_DIR}/decode_rs.c
${CMAKE_CURRENT_SOURCE_DIR}/init_rs.c
-)
+ )
+target_include_directories(gr_fec_rs
+ PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../../include>
+ PRIVATE $<TARGET_PROPERTY:gnuradio-runtime,INCLUDE_DIRECTORIES>
+ )
+set_target_properties(gr_fec_rs PROPERTIES POSITION_INDEPENDENT_CODE ON)
-########################################################################
-# Setup sources and includes
-########################################################################
-list(APPEND gnuradio_fec_sources ${gr_fec_rs_sources})
-
-#install(
-# FILES ${CMAKE_CURRENT_SOURCE_DIR}/rs.h
-# DESTINATION ${GR_INCLUDE_DIR}/gnuradio/fec
-#)
+target_sources(gnuradio-fec PRIVATE $<TARGET_OBJECTS:gr_fec_rs>)
########################################################################
# Register unit tests
########################################################################
if(ENABLE_TESTING)
add_executable(gr_fec_rstest
- ${gr_fec_rs_sources}
- ${CMAKE_CURRENT_SOURCE_DIR}/rstest.c
${CMAKE_CURRENT_SOURCE_DIR}/exercise.c
-)
-add_test(gr-fec-reed-solomon-test gr_fec_rstest)
+ ${CMAKE_CURRENT_SOURCE_DIR}/rstest.c
+ $<TARGET_OBJECTS:gr_fec_rs>
+ )
+ target_link_libraries(gr_fec_rstest gnuradio-runtime)
+ target_include_directories(gr_fec_rstest
+ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../include
+ )
+add_test(test_rs gr_fec_rstest)
endif(ENABLE_TESTING)
diff --git a/gr-fec/lib/viterbi/CMakeLists.txt b/gr-fec/lib/viterbi/CMakeLists.txt
deleted file mode 100644
index c13d500f7f..0000000000
--- a/gr-fec/lib/viterbi/CMakeLists.txt
+++ /dev/null
@@ -1,50 +0,0 @@
-# Copyright 2010-2011 Free Software Foundation, Inc.
-#
-# This file is part of GNU Radio
-#
-# GNU Radio is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3, or (at your option)
-# any later version.
-#
-# GNU Radio is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with GNU Radio; see the file COPYING. If not, write to
-# the Free Software Foundation, Inc., 51 Franklin Street,
-# Boston, MA 02110-1301, USA.
-
-########################################################################
-# This file included, use CMake directory variables
-########################################################################
-
-set(viterbi_sources
- ${CMAKE_CURRENT_SOURCE_DIR}/metrics.c
- ${CMAKE_CURRENT_SOURCE_DIR}/tab.c
- ${CMAKE_CURRENT_SOURCE_DIR}/viterbi.c
-)
-
-########################################################################
-# Append gnuradio-runtime library sources
-########################################################################
-SET_SOURCE_FILES_PROPERTIES( ${viterbi_sources} PROPERTIES LANGUAGE CXX )
-list(APPEND gnuradio_fec_sources ${viterbi_sources})
-
-########################################################################
-# Install runtime headers
-########################################################################
-#install(
-# FILES ${CMAKE_CURRENT_SOURCE_DIR}/viterbi.h
-# DESTINATION ${GR_INCLUDE_DIR}/gnuradio/fec
-#)
-
-########################################################################
-# Create some text executables (not registered tests)
-# Its not much to build so the sources are just re-listed,
-# rather than create a new library just for these two apps.
-########################################################################
-#ADD_EXECUTABLE(viterbi_encode ${CMAKE_CURRENT_SOURCE_DIR}/encode.cc ${viterbi_sources})
-#ADD_EXECUTABLE(viterbi_decode ${CMAKE_CURRENT_SOURCE_DIR}/decode.cc ${viterbi_sources})
diff --git a/gr-fec/lib/viterbi/metrics.c b/gr-fec/lib/viterbi/metrics.cc
index c94133be15..c94133be15 100644
--- a/gr-fec/lib/viterbi/metrics.c
+++ b/gr-fec/lib/viterbi/metrics.cc
diff --git a/gr-fec/lib/viterbi/tab.c b/gr-fec/lib/viterbi/tab.cc
index 1c135acfee..1c135acfee 100644
--- a/gr-fec/lib/viterbi/tab.c
+++ b/gr-fec/lib/viterbi/tab.cc
diff --git a/gr-fec/lib/viterbi/viterbi.c b/gr-fec/lib/viterbi/viterbi.cc
index 11b9f79b9a..11b9f79b9a 100644
--- a/gr-fec/lib/viterbi/viterbi.c
+++ b/gr-fec/lib/viterbi/viterbi.cc
diff --git a/gr-fec/swig/CMakeLists.txt b/gr-fec/swig/CMakeLists.txt
index 5eaa5de748..9fb98fe5d3 100644
--- a/gr-fec/swig/CMakeLists.txt
+++ b/gr-fec/swig/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright 2012 Free Software Foundation, Inc.
+# Copyright 2012,2019 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -23,16 +23,8 @@
include(GrPython)
include(GrSwig)
-set(GR_SWIG_INCLUDE_DIRS
- ${CMAKE_CURRENT_BINARY_DIR}/../include
- ${GR_FEC_INCLUDE_DIRS}
- ${GNURADIO_RUNTIME_SWIG_INCLUDE_DIRS}
- ${Boost_INCLUDE_DIRS}
-)
-
-if(ENABLE_GR_CTRLPORT)
- list(APPEND GR_SWIG_FLAGS "-DGR_CTRLPORT")
-endif(ENABLE_GR_CTRLPORT)
+set(GR_SWIG_INCLUDE_DIRS $<TARGET_PROPERTY:runtime_swig,INCLUDE_DIRECTORIES>)
+set(GR_SWIG_TARGET_DEPS runtime_swig)
if(GSL_FOUND)
list(APPEND GR_SWIG_FLAGS "-DGSL_FOUND")
diff --git a/gr-fft/CMakeLists.txt b/gr-fft/CMakeLists.txt
index 4bf8263965..1da483f407 100644
--- a/gr-fft/CMakeLists.txt
+++ b/gr-fft/CMakeLists.txt
@@ -34,12 +34,7 @@ GR_REGISTER_COMPONENT("gr-fft" ENABLE_GR_FFT
Boost_FOUND
ENABLE_GNURADIO_RUNTIME
ENABLE_GR_BLOCKS
- FFTW3F_FOUND
-)
-
-GR_SET_GLOBAL(GR_FFT_INCLUDE_DIRS
- ${CMAKE_CURRENT_SOURCE_DIR}/lib
- ${CMAKE_CURRENT_SOURCE_DIR}/include
+ FFTW3f_FOUND
)
########################################################################
diff --git a/gr-fft/lib/CMakeLists.txt b/gr-fft/lib/CMakeLists.txt
index 9777d243df..7b8207665e 100644
--- a/gr-fft/lib/CMakeLists.txt
+++ b/gr-fft/lib/CMakeLists.txt
@@ -18,29 +18,9 @@
# Boston, MA 02110-1301, USA.
########################################################################
-# Setup the include and linker paths
-########################################################################
-include_directories(
- ${CMAKE_CURRENT_SOURCE_DIR}
- ${CMAKE_CURRENT_BINARY_DIR}
- ${GR_FFT_INCLUDE_DIRS}
- ${GNURADIO_RUNTIME_INCLUDE_DIRS}
- ${VOLK_INCLUDE_DIRS}
- ${Boost_INCLUDE_DIRS}
- ${FFTW3F_INCLUDE_DIRS}
-)
-
-link_directories(${Boost_LIBRARY_DIRS})
-link_directories(${FFTW3F_LIBRARY_DIRS})
-
-if(ENABLE_GR_CTRLPORT)
- ADD_DEFINITIONS(-DGR_CTRLPORT)
-endif(ENABLE_GR_CTRLPORT)
-
-########################################################################
# Setup library
########################################################################
-list(APPEND fft_sources
+add_library(gnuradio-fft
fft.cc
fft_vcc_fftw.cc
fft_vfc_fftw.cc
@@ -49,18 +29,24 @@ list(APPEND fft_sources
window.cc
)
+target_link_libraries(gnuradio-fft PUBLIC
+ gnuradio-runtime
+ fftw3f::fftw3f
+ ${GR_VOLK_LIB}
+)
+
+target_include_directories(gnuradio-fft
+ PUBLIC
+ $<INSTALL_INTERFACE:include>
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../include>
+ )
+
if(ENABLE_GR_CTRLPORT)
-list(APPEND fft_sources
+target_sources(gnuradio-fft PRIVATE
ctrlport_probe_psd_impl.cc
)
endif(ENABLE_GR_CTRLPORT)
-list(APPEND fft_libs
- gnuradio-runtime
- ${VOLK_LIBRARIES}
- ${Boost_LIBRARIES}
- ${FFTW3F_LIBRARIES}
-)
#Add Windows DLL resource file if using MSVC
if(MSVC)
@@ -71,40 +57,11 @@ if(MSVC)
${CMAKE_CURRENT_BINARY_DIR}/gnuradio-fft.rc
@ONLY)
- list(APPEND fft_sources
+ target_sources(gnuradio-fft PRIVATE
${CMAKE_CURRENT_BINARY_DIR}/gnuradio-fft.rc
)
endif(MSVC)
-if(FFTW3F_THREADS_LIBRARIES)
- list(APPEND fft_libs ${FFTW3F_THREADS_LIBRARIES})
- add_definitions("-DFFTW3F_THREADS")
+if(BUILD_SHARED_LIBS)
+ GR_LIBRARY_FOO(gnuradio-fft FFTW3f)
endif()
-
-add_library(gnuradio-fft SHARED ${fft_sources})
-target_link_libraries(gnuradio-fft ${fft_libs})
-GR_LIBRARY_FOO(gnuradio-fft)
-
-if(ENABLE_STATIC_LIBS)
- if(ENABLE_GR_CTRLPORT)
- # Remove GR_CTRLPORT set this target's definitions.
- # Makes sure we don't try to use ControlPort stuff in source files
- GET_DIRECTORY_PROPERTY(STATIC_DEFS COMPILE_DEFINITIONS)
- list(REMOVE_ITEM STATIC_DEFS "GR_CTRLPORT")
- SET_PROPERTY(DIRECTORY PROPERTY COMPILE_DEFINITIONS "${STATIC_DEFS}")
-
- # readd it to the target since we removed it from the directory-wide list.
- SET_PROPERTY(TARGET gnuradio-fft APPEND PROPERTY COMPILE_DEFINITIONS "GR_CTRLPORT")
- endif(ENABLE_GR_CTRLPORT)
-
- add_library(gnuradio-fft_static STATIC ${fft_sources})
-
- if(NOT WIN32)
- set_target_properties(gnuradio-fft_static
- PROPERTIES OUTPUT_NAME gnuradio-fft)
- endif(NOT WIN32)
-
- install(TARGETS gnuradio-fft_static
- ARCHIVE DESTINATION lib${LIB_SUFFIX} # .lib file
- )
-endif(ENABLE_STATIC_LIBS)
diff --git a/gr-fft/swig/CMakeLists.txt b/gr-fft/swig/CMakeLists.txt
index 67e34bbba8..e0e780a282 100644
--- a/gr-fft/swig/CMakeLists.txt
+++ b/gr-fft/swig/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright 2012 Free Software Foundation, Inc.
+# Copyright 2012,2019 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -23,16 +23,8 @@
include(GrPython)
include(GrSwig)
-set(GR_SWIG_INCLUDE_DIRS
- ${GR_FFT_INCLUDE_DIRS}
- ${GNURADIO_RUNTIME_SWIG_INCLUDE_DIRS}
- ${Boost_INCLUDE_DIRS}
- ${FFTW3F_INCLUDE_DIRS}
-)
-
-if(ENABLE_GR_CTRLPORT)
- list(APPEND GR_SWIG_FLAGS "-DGR_CTRLPORT")
-endif(ENABLE_GR_CTRLPORT)
+set(GR_SWIG_INCLUDE_DIRS $<TARGET_PROPERTY:runtime_swig,INCLUDE_DIRECTORIES>)
+set(GR_SWIG_TARGET_DEPS runtime_swig)
set(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/fft_swig_doc.i)
set(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../include/gnuradio/fft)
diff --git a/gr-filter/CMakeLists.txt b/gr-filter/CMakeLists.txt
index ed1e52ab91..73899793f9 100644
--- a/gr-filter/CMakeLists.txt
+++ b/gr-filter/CMakeLists.txt
@@ -35,14 +35,6 @@ GR_REGISTER_COMPONENT("gr-filter" ENABLE_GR_FILTER
ENABLE_GR_BLOCKS
)
-GR_SET_GLOBAL(GR_FILTER_INCLUDE_DIRS
- ${CMAKE_CURRENT_SOURCE_DIR}/lib
- ${CMAKE_CURRENT_SOURCE_DIR}/include
- ${CMAKE_CURRENT_BINARY_DIR}/lib
- ${CMAKE_CURRENT_BINARY_DIR}/include
- ${GR_FFT_INCLUDE_DIRS}
-)
-
SET(GR_PKG_FILTER_EXAMPLES_DIR ${GR_PKG_DATA_DIR}/examples/filter)
########################################################################
diff --git a/gr-filter/lib/CMakeLists.txt b/gr-filter/lib/CMakeLists.txt
index 97eae93e6e..0eef7fdc39 100644
--- a/gr-filter/lib/CMakeLists.txt
+++ b/gr-filter/lib/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (C) 2012-2014,2017-2018 Free Software Foundation, Inc.
+# Copyright (C) 2012-2014,2017-2019 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -18,31 +18,9 @@
# Boston, MA 02110-1301, USA.
########################################################################
-# Setup the include and linker paths
-########################################################################
-include_directories(
- ${CMAKE_CURRENT_SOURCE_DIR}
- ${CMAKE_CURRENT_BINARY_DIR}
- ${GR_FILTER_INCLUDE_DIRS}
- ${GR_FFT_INCLUDE_DIRS}
- ${GR_BLOCKS_INCLUDE_DIRS}
- ${GNURADIO_RUNTIME_INCLUDE_DIRS}
- ${VOLK_INCLUDE_DIRS}
- ${Boost_INCLUDE_DIRS}
-)
-
-link_directories(
- ${Boost_LIBRARY_DIRS}
-)
-
-if(ENABLE_GR_CTRLPORT)
- ADD_DEFINITIONS(-DGR_CTRLPORT)
-endif(ENABLE_GR_CTRLPORT)
-
-########################################################################
# Setup library
########################################################################
-list(APPEND filter_sources
+add_library(gnuradio-filter
fir_filter.cc
fir_filter_blk_impl.cc
fir_filter_with_buffer.cc
@@ -88,6 +66,19 @@ list(APPEND filter_sources
single_pole_iir_filter_ff_impl.cc
)
+target_link_libraries(gnuradio-filter PUBLIC
+ gnuradio-runtime
+ gnuradio-fft
+ gnuradio-blocks
+ ${GR_VOLK_LIB}
+)
+
+target_include_directories(gnuradio-filter
+ PUBLIC
+ $<INSTALL_INTERFACE:include>
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../include>
+ )
+
#Add Windows DLL resource file if using MSVC
if(MSVC)
include(${CMAKE_SOURCE_DIR}/cmake/Modules/GrVersion.cmake)
@@ -97,53 +88,12 @@ if(MSVC)
${CMAKE_CURRENT_BINARY_DIR}/gnuradio-filter.rc
@ONLY)
- list(APPEND filter_sources
+ target_sources(gnuradio-filter PRIVATE
${CMAKE_CURRENT_BINARY_DIR}/gnuradio-filter.rc
)
endif(MSVC)
-list(APPEND filter_libs
- gnuradio-runtime
- gnuradio-fft
- gnuradio-blocks
- ${VOLK_LIBRARIES}
- ${Boost_LIBRARIES}
-)
-
-
-add_library(gnuradio-filter SHARED ${filter_sources})
-target_link_libraries(gnuradio-filter ${filter_libs})
GR_LIBRARY_FOO(gnuradio-filter)
-add_dependencies(gnuradio-filter
- gnuradio-runtime gnuradio-fft)
-
-if(ENABLE_STATIC_LIBS)
- if(ENABLE_GR_CTRLPORT)
- # Remove GR_CTRLPORT set this target's definitions.
- # Makes sure we don't try to use ControlPort stuff in source files
- GET_DIRECTORY_PROPERTY(STATIC_DEFS COMPILE_DEFINITIONS)
- list(REMOVE_ITEM STATIC_DEFS "GR_CTRLPORT")
- SET_PROPERTY(DIRECTORY PROPERTY COMPILE_DEFINITIONS "${STATIC_DEFS}")
-
- # readd it to the target since we removed it from the directory-wide list.
- SET_PROPERTY(TARGET gnuradio-filter APPEND PROPERTY COMPILE_DEFINITIONS "GR_CTRLPORT")
- endif(ENABLE_GR_CTRLPORT)
-
- add_library(gnuradio-filter_static STATIC ${filter_sources})
-
- add_dependencies(gnuradio-filter_static
- gnuradio-runtime_static gnuradio-fft_static)
-
- if(NOT WIN32)
- set_target_properties(gnuradio-filter_static
- PROPERTIES OUTPUT_NAME gnuradio-filter)
- endif(NOT WIN32)
-
- install(TARGETS gnuradio-filter_static
- ARCHIVE DESTINATION lib${LIB_SUFFIX} # .lib file
- )
-endif(ENABLE_STATIC_LIBS)
-
########################################################################
# QA C++ Code for gr-filter
@@ -151,11 +101,6 @@ endif(ENABLE_STATIC_LIBS)
if(ENABLE_TESTING)
include(GrTest)
- include_directories(
- ${GR_BLOCKS_INCLUDE_DIRS}
- ${GNURADIO_RUNTIME_INCLUDE_DIRS}
- )
-
list(APPEND test_gr_filter_sources
qa_firdes.cc
qa_fir_filter_with_buffer.cc
diff --git a/gr-filter/swig/CMakeLists.txt b/gr-filter/swig/CMakeLists.txt
index 2308739062..c1dd0bd480 100644
--- a/gr-filter/swig/CMakeLists.txt
+++ b/gr-filter/swig/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright 2012 Free Software Foundation, Inc.
+# Copyright 2012,2019 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -23,17 +23,8 @@
include(GrPython)
include(GrSwig)
-set(GR_SWIG_INCLUDE_DIRS
- ${GR_FILTER_INCLUDE_DIRS}
- ${GR_FFT_INCLUDE_DIRS}
- ${GNURADIO_RUNTIME_SWIG_INCLUDE_DIRS}
- ${Boost_INCLUDE_DIRS}
- ${FFTW3F_INCLUDE_DIRS}
-)
-
-if(ENABLE_GR_CTRLPORT)
- list(APPEND GR_SWIG_FLAGS "-DGR_CTRLPORT")
-endif(ENABLE_GR_CTRLPORT)
+set(GR_SWIG_INCLUDE_DIRS $<TARGET_PROPERTY:runtime_swig,INCLUDE_DIRECTORIES>)
+set(GR_SWIG_TARGET_DEPS runtime_swig)
# FIXME: rename to filter_swig_doc.i when gnuradio-runtime is updated
set(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/gr_filter_swig_doc.i)
diff --git a/gr-qtgui/CMakeLists.txt b/gr-qtgui/CMakeLists.txt
index b0b109f55c..41ac05232d 100644
--- a/gr-qtgui/CMakeLists.txt
+++ b/gr-qtgui/CMakeLists.txt
@@ -30,8 +30,6 @@ include(GrPython)
find_package(Qt5Widgets QUIET)
set(QT_FOUND ${Qt5Widgets_FOUND})
-set(QT_LIBRARIES ${Qt5Widgets_LIBRARIES})
-set(QT_INCLUDE_DIRS ${Qt5Widgets_INCLUDE_DIRS})
GR_PYTHON_CHECK_MODULE("PyQt5" PyQt5 True PYQT5_FOUND)
@@ -59,12 +57,6 @@ GR_REGISTER_COMPONENT("gr-qtgui" ENABLE_GR_QTGUI
${qt_gui_python_deps}
)
-GR_SET_GLOBAL(GR_QTGUI_INCLUDE_DIRS
- ${CMAKE_CURRENT_SOURCE_DIR}/include
- ${CMAKE_CURRENT_SOURCE_DIR}/lib
- ${CMAKE_CURRENT_BINARY_DIR}/lib
-)
-
SET(GR_PKG_QTGUI_EXAMPLES_DIR ${GR_PKG_DATA_DIR}/examples/qt-gui)
########################################################################
diff --git a/gr-qtgui/lib/CMakeLists.txt b/gr-qtgui/lib/CMakeLists.txt
index dbccc3df48..d3c1d1e6b6 100644
--- a/gr-qtgui/lib/CMakeLists.txt
+++ b/gr-qtgui/lib/CMakeLists.txt
@@ -20,45 +20,9 @@
########################################################################
# Setup the QT file generations stuff
########################################################################
-set(qtgui_mod_includedir ${CMAKE_CURRENT_SOURCE_DIR}/../include/gnuradio/qtgui)
-set(qtgui_moc_hdrs
- ${qtgui_mod_includedir}/spectrumdisplayform.h
- ${qtgui_mod_includedir}/displayform.h
- ${qtgui_mod_includedir}/timedisplayform.h
- ${qtgui_mod_includedir}/timecontrolpanel.h
- ${qtgui_mod_includedir}/timerasterdisplayform.h
- ${qtgui_mod_includedir}/freqdisplayform.h
- ${qtgui_mod_includedir}/freqcontrolpanel.h
- ${qtgui_mod_includedir}/constellationdisplayform.h
- ${qtgui_mod_includedir}/waterfalldisplayform.h
- ${qtgui_mod_includedir}/histogramdisplayform.h
- ${qtgui_mod_includedir}/numberdisplayform.h
- ${qtgui_mod_includedir}/vectordisplayform.h
- ${qtgui_mod_includedir}/form_menus.h
- ${qtgui_mod_includedir}/DisplayPlot.h
- ${qtgui_mod_includedir}/FrequencyDisplayPlot.h
- ${qtgui_mod_includedir}/TimeDomainDisplayPlot.h
- ${qtgui_mod_includedir}/TimeRasterDisplayPlot.h
- ${qtgui_mod_includedir}/WaterfallDisplayPlot.h
- ${qtgui_mod_includedir}/ConstellationDisplayPlot.h
- ${qtgui_mod_includedir}/HistogramDisplayPlot.h
- ${qtgui_mod_includedir}/VectorDisplayPlot.h
- edit_box_msg_impl.h
-)
-QT5_WRAP_CPP(qtgui_moc_sources ${qtgui_moc_hdrs})
-QT5_WRAP_UI(qtgui_ui_hdrs spectrumdisplayform.ui)
-#FIXME the sources expect <foo>.ui.h, but the macros generate ui_foo.h
-#avoid changing the sources by generating the header with the include
-set(spectrum_ui_hdr ${CMAKE_CURRENT_BINARY_DIR}/spectrumdisplayform.ui.h)
-if(NOT EXISTS ${spectrum_ui_hdr})
- file(WRITE ${spectrum_ui_hdr} "#include <ui_spectrumdisplayform.h>\n")
-endif(NOT EXISTS ${spectrum_ui_hdr})
-
-set(qtgui_sources
- ${qtgui_moc_sources}
- ${qtgui_ui_hdrs}
+add_library(gnuradio-qtgui
DisplayPlot.cc
FrequencyDisplayPlot.cc
TimeDomainDisplayPlot.cc
@@ -103,100 +67,92 @@ set(qtgui_sources
vector_sink_f_impl.cc
edit_box_msg_impl.cc
)
-
-#Add Windows DLL resource file if using MSVC
-if(MSVC)
- include(${CMAKE_SOURCE_DIR}/cmake/Modules/GrVersion.cmake)
-
- configure_file(
- ${CMAKE_CURRENT_SOURCE_DIR}/gnuradio-qtgui.rc.in
- ${CMAKE_CURRENT_BINARY_DIR}/gnuradio-qtgui.rc
- @ONLY)
-
- list(APPEND qtgui_sources
- ${CMAKE_CURRENT_BINARY_DIR}/gnuradio-qtgui.rc
- )
-endif(MSVC)
-
-########################################################################
-# Setup the include and linker paths
-########################################################################
-include_directories(
- ${GR_QTGUI_INCLUDE_DIRS}
- ${GR_FFT_INCLUDE_DIRS}
- ${GR_FILTER_INCLUDE_DIRS}
- ${GNURADIO_RUNTIME_INCLUDE_DIRS}
- ${VOLK_INCLUDE_DIRS}
- ${QWT_INCLUDE_DIRS}
- ${QT_INCLUDE_DIRS}
- ${FFTW3F_INCLUDE_DIRS}
- ${Boost_INCLUDE_DIRS}
- ${PYTHON_INCLUDE_DIRS}
-)
-
-link_directories(
- ${QWT_LIBRARY_DIRS}
- ${FFTW3F_LIBRARY_DIRS}
- ${Boost_LIBRARY_DIRS}
-)
-
-include_directories(${PYTHON_INCLUDE_PATH}) #deprecated for dirs (cmake 2.6)
-
-if(ENABLE_GR_CTRLPORT)
- ADD_DEFINITIONS(-DGR_CTRLPORT)
-endif(ENABLE_GR_CTRLPORT)
-
-########################################################################
-# Setup library
-########################################################################
-list(APPEND qtgui_libs
+target_compile_definitions(gnuradio-qtgui PRIVATE -DQWT_DLL) #setup QWT library linkage
+target_include_directories(gnuradio-qtgui
+ PUBLIC
+ $<INSTALL_INTERFACE:include>
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../include>
+ PRIVATE
+ ${CMAKE_CURRENT_BINARY_DIR}
+ )
+target_link_libraries(gnuradio-qtgui PUBLIC
gnuradio-runtime
gnuradio-fft
gnuradio-filter
- ${VOLK_LIBRARIES}
- ${QWT_LIBRARIES}
- ${QT_LIBRARIES}
- ${FFTW3F_LIBRARIES}
+ ${GR_VOLK_LIB}
+ qwt::qwt
+ Qt5::Widgets
)
if (WIN32)
- list(APPEND qtgui_libs
+ target_link_libraries(gnuradio-qtgui PUBLIC
dwrite
)
endif(WIN32)
include(GrPython)
if(ENABLE_PYTHON)
- add_definitions(-DENABLE_PYTHON)
- list(APPEND qtgui_libs
- ${PYTHON_LIBRARIES}
+ target_compile_definitions(gnuradio-qtgui PUBLIC -DENABLE_PYTHON)
+ target_link_libraries(gnuradio-qtgui PUBLIC
+ Python::Python
)
endif(ENABLE_PYTHON)
-add_definitions(-DQWT_DLL) #setup QWT library linkage
-add_library(gnuradio-qtgui SHARED ${qtgui_sources})
-target_link_libraries(gnuradio-qtgui ${qtgui_libs})
-GR_LIBRARY_FOO(gnuradio-qtgui)
+set(qtgui_mod_includedir ${CMAKE_CURRENT_SOURCE_DIR}/../include/gnuradio/qtgui)
+QT5_WRAP_CPP(qtgui_moc_sources
+ ${qtgui_mod_includedir}/spectrumdisplayform.h
+ ${qtgui_mod_includedir}/displayform.h
+ ${qtgui_mod_includedir}/timedisplayform.h
+ ${qtgui_mod_includedir}/timecontrolpanel.h
+ ${qtgui_mod_includedir}/timerasterdisplayform.h
+ ${qtgui_mod_includedir}/freqdisplayform.h
+ ${qtgui_mod_includedir}/freqcontrolpanel.h
+ ${qtgui_mod_includedir}/constellationdisplayform.h
+ ${qtgui_mod_includedir}/waterfalldisplayform.h
+ ${qtgui_mod_includedir}/histogramdisplayform.h
+ ${qtgui_mod_includedir}/numberdisplayform.h
+ ${qtgui_mod_includedir}/vectordisplayform.h
+ ${qtgui_mod_includedir}/form_menus.h
+ ${qtgui_mod_includedir}/DisplayPlot.h
+ ${qtgui_mod_includedir}/FrequencyDisplayPlot.h
+ ${qtgui_mod_includedir}/TimeDomainDisplayPlot.h
+ ${qtgui_mod_includedir}/TimeRasterDisplayPlot.h
+ ${qtgui_mod_includedir}/WaterfallDisplayPlot.h
+ ${qtgui_mod_includedir}/ConstellationDisplayPlot.h
+ ${qtgui_mod_includedir}/HistogramDisplayPlot.h
+ ${qtgui_mod_includedir}/VectorDisplayPlot.h
+ edit_box_msg_impl.h
+ )
+ target_sources(gnuradio-qtgui PRIVATE
+ ${qtgui_moc_sources}
+ )
+ QT5_WRAP_UI(qtgui_ui_hdrs spectrumdisplayform.ui)
+ target_sources(gnuradio-qtgui PRIVATE
+ ${qtgui_ui_hdrs}
+ )
-if(ENABLE_STATIC_LIBS)
- if(ENABLE_GR_CTRLPORT)
- # Remove GR_CTRLPORT set this target's definitions.
- # Makes sure we don't try to use ControlPort stuff in source files
- GET_DIRECTORY_PROPERTY(STATIC_DEFS COMPILE_DEFINITIONS)
- list(REMOVE_ITEM STATIC_DEFS "GR_CTRLPORT")
- SET_PROPERTY(DIRECTORY PROPERTY COMPILE_DEFINITIONS "${STATIC_DEFS}")
- # readd it to the target since we removed it from the directory-wide list.
- SET_PROPERTY(TARGET gnuradio-qtgui APPEND PROPERTY COMPILE_DEFINITIONS "GR_CTRLPORT")
- endif(ENABLE_GR_CTRLPORT)
+#FIXME the sources expect <foo>.ui.h, but the macros generate ui_foo.h
+#avoid changing the sources by generating the header with the include
+set(spectrum_ui_hdr ${CMAKE_CURRENT_BINARY_DIR}/spectrumdisplayform.ui.h)
+if(NOT EXISTS ${spectrum_ui_hdr})
+ file(WRITE ${spectrum_ui_hdr} "#include <ui_spectrumdisplayform.h>\n")
+endif()
- add_library(gnuradio-qtgui_static STATIC ${qtgui_sources})
+#Add Windows DLL resource file if using MSVC
+if(MSVC)
+ include(${CMAKE_SOURCE_DIR}/cmake/Modules/GrVersion.cmake)
- if(NOT WIN32)
- set_target_properties(gnuradio-qtgui_static
- PROPERTIES OUTPUT_NAME gnuradio-qtgui)
- endif(NOT WIN32)
+ configure_file(
+ ${CMAKE_CURRENT_SOURCE_DIR}/gnuradio-qtgui.rc.in
+ ${CMAKE_CURRENT_BINARY_DIR}/gnuradio-qtgui.rc
+ @ONLY)
- install(TARGETS gnuradio-qtgui_static
- ARCHIVE DESTINATION lib${LIB_SUFFIX} # .lib file
+ target_sources(gnuradio-qtgui PRIVATE
+ ${CMAKE_CURRENT_BINARY_DIR}/gnuradio-qtgui.rc
)
-endif(ENABLE_STATIC_LIBS)
+endif(MSVC)
+
+
+if(BUILD_SHARED_LIBS)
+ GR_LIBRARY_FOO(gnuradio-qtgui QWT Qt5Widgets FFTW3f)
+endif()
diff --git a/gr-qtgui/swig/CMakeLists.txt b/gr-qtgui/swig/CMakeLists.txt
index 2990ac9086..d9f4c99704 100644
--- a/gr-qtgui/swig/CMakeLists.txt
+++ b/gr-qtgui/swig/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright 2010-2012 Free Software Foundation, Inc.
+# Copyright 2010-2012,2019 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -26,19 +26,8 @@ include(GrSwig)
add_definitions(-DENABLE_PYTHON)
list(APPEND GR_SWIG_FLAGS "-DENABLE_PYTHON")
-set(GR_SWIG_INCLUDE_DIRS
- ${GR_QTGUI_INCLUDE_DIRS}
- ${GR_FFT_INCLUDE_DIRS}
- ${GR_FILTER_INCLUDE_DIRS}
- ${GNURADIO_RUNTIME_SWIG_INCLUDE_DIRS}
- ${QWT_INCLUDE_DIRS}
- ${QT_INCLUDE_DIRS}
- ${Boost_INCLUDE_DIRS}
-)
-
-if(ENABLE_GR_CTRLPORT)
- list(APPEND GR_SWIG_FLAGS "-DGR_CTRLPORT")
-endif(ENABLE_GR_CTRLPORT)
+set(GR_SWIG_INCLUDE_DIRS $<TARGET_PROPERTY:runtime_swig,INCLUDE_DIRECTORIES>)
+set(GR_SWIG_TARGET_DEPS runtime_swig)
set(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/qtgui_swig_doc.i)
set(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../include/gnuradio/qtgui)
diff --git a/gr-trellis/CMakeLists.txt b/gr-trellis/CMakeLists.txt
index af4d94ae66..de5159b4d0 100644
--- a/gr-trellis/CMakeLists.txt
+++ b/gr-trellis/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright 2012 Free Software Foundation, Inc.
+# Copyright 2012,2019 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -32,16 +32,7 @@ GR_REGISTER_COMPONENT("gr-trellis" ENABLE_GR_TRELLIS
ENABLE_GR_ANALOG
ENABLE_GR_BLOCKS
ENABLE_GR_DIGITAL
-)
-
-GR_SET_GLOBAL(GR_TRELLIS_INCLUDE_DIRS
- ${CMAKE_CURRENT_SOURCE_DIR}/include
- ${CMAKE_CURRENT_BINARY_DIR}/include
-)
-
-GR_SET_GLOBAL(GR_TRELLIS_SWIG_INCLUDE_DIRS
- ${CMAKE_CURRENT_SOURCE_DIR}/swig
-)
+ )
SET(GR_PKG_TRELLIS_EXAMPLES_DIR ${GR_PKG_DATA_DIR}/examples/trellis)
diff --git a/gr-trellis/lib/CMakeLists.txt b/gr-trellis/lib/CMakeLists.txt
index dc892da949..6afafc1a59 100644
--- a/gr-trellis/lib/CMakeLists.txt
+++ b/gr-trellis/lib/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright 2012,2014,2018 Free Software Foundation, Inc.
+# Copyright 2012,2014,2018-2019 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -18,26 +18,9 @@
# Boston, MA 02110-1301, USA.
########################################################################
-# Setup the include and linker paths
-########################################################################
-include_directories(
- ${CMAKE_CURRENT_BINARY_DIR}/../include
- ${GR_TRELLIS_INCLUDE_DIRS}
- ${GR_DIGITAL_INCLUDE_DIRS}
- ${GNURADIO_RUNTIME_INCLUDE_DIRS}
- ${Boost_INCLUDE_DIRS}
-)
-
-link_directories(${Boost_LIBRARY_DIRS})
-
-if(ENABLE_GR_CTRLPORT)
- ADD_DEFINITIONS(-DGR_CTRLPORT)
-endif(ENABLE_GR_CTRLPORT)
-
-########################################################################
# Setup library
########################################################################
-list(APPEND trellis_sources
+add_library(gnuradio-trellis
base.cc
calc_metric.cc
core_algorithms.cc
@@ -60,12 +43,17 @@ list(APPEND trellis_sources
viterbi_combined_impl.cc
)
-list(APPEND trellis_libs
+target_link_libraries(gnuradio-trellis PUBLIC
gnuradio-runtime
gnuradio-digital
- ${Boost_LIBRARIES}
)
+target_include_directories(gnuradio-trellis
+ PUBLIC
+ $<INSTALL_INTERFACE:include>
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../include>
+ )
+
#Add Windows DLL resource file if using MSVC
IF(MSVC)
include(${CMAKE_SOURCE_DIR}/cmake/Modules/GrVersion.cmake)
@@ -75,41 +63,11 @@ IF(MSVC)
${CMAKE_CURRENT_BINARY_DIR}/gnuradio-trellis.rc
@ONLY)
- list(APPEND trellis_sources
+ target_sources(gnuradio-trellis PRIVATE
${CMAKE_CURRENT_BINARY_DIR}/gnuradio-trellis.rc
)
ENDIF(MSVC)
-add_library(gnuradio-trellis SHARED ${trellis_sources})
-target_link_libraries(gnuradio-trellis ${trellis_libs})
-GR_LIBRARY_FOO(gnuradio-trellis)
-add_dependencies(gnuradio-trellis
- gnuradio-runtime gnuradio-digital)
-
-if(ENABLE_STATIC_LIBS)
- if(ENABLE_GR_CTRLPORT)
- # Remove GR_CTRLPORT set this target's definitions.
- # Makes sure we don't try to use ControlPort stuff in source files
- GET_DIRECTORY_PROPERTY(STATIC_DEFS COMPILE_DEFINITIONS)
- list(REMOVE_ITEM STATIC_DEFS "GR_CTRLPORT")
- SET_PROPERTY(DIRECTORY PROPERTY COMPILE_DEFINITIONS "${STATIC_DEFS}")
-
- # readd it to the target since we removed it from the directory-wide list.
- SET_PROPERTY(TARGET gnuradio-trellis APPEND PROPERTY COMPILE_DEFINITIONS "GR_CTRLPORT")
- endif(ENABLE_GR_CTRLPORT)
-
- add_library(gnuradio-trellis_static STATIC ${trellis_sources})
-
- add_dependencies(gnuradio-trellis_static
- gnuradio-runtime_static gnuradio-digital_static
- )
-
- if(NOT WIN32)
- set_target_properties(gnuradio-trellis_static
- PROPERTIES OUTPUT_NAME gnuradio-trellis)
- endif(NOT WIN32)
-
- install(TARGETS gnuradio-trellis_static
- ARCHIVE DESTINATION lib${LIB_SUFFIX} # .lib file
- )
-endif(ENABLE_STATIC_LIBS)
+if(BUILD_SHARED_LIBS)
+ GR_LIBRARY_FOO(gnuradio-trellis)
+endif()
diff --git a/gr-trellis/swig/CMakeLists.txt b/gr-trellis/swig/CMakeLists.txt
index 1f9b7679df..46685c38a1 100644
--- a/gr-trellis/swig/CMakeLists.txt
+++ b/gr-trellis/swig/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright 2012,2016 Free Software Foundation, Inc.
+# Copyright 2012,2016,2019 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -23,19 +23,11 @@
include(GrPython)
include(GrSwig)
-set(GR_SWIG_INCLUDE_DIRS
- ${GR_TRELLIS_INCLUDE_DIRS}
- ${GR_DIGITAL_INCLUDE_DIRS}
- ${GNURADIO_RUNTIME_SWIG_INCLUDE_DIRS}
- ${Boost_INCLUDE_DIRS}
-)
+set(GR_SWIG_INCLUDE_DIRS $<TARGET_PROPERTY:runtime_swig,INCLUDE_DIRECTORIES>)
+set(GR_SWIG_TARGET_DEPS runtime_swig)
set(GR_SWIG_LIBRARIES gnuradio-trellis gnuradio-digital)
-if(ENABLE_GR_CTRLPORT)
- list(APPEND GR_SWIG_FLAGS "-DGR_CTRLPORT")
-endif(ENABLE_GR_CTRLPORT)
-
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/trellis_swig.py.in
${CMAKE_CURRENT_BINARY_DIR}/trellis_swig.py
diff --git a/gr-uhd/CMakeLists.txt b/gr-uhd/CMakeLists.txt
index e136d4f97f..0ce9299d02 100644
--- a/gr-uhd/CMakeLists.txt
+++ b/gr-uhd/CMakeLists.txt
@@ -38,10 +38,6 @@ GR_REGISTER_COMPONENT("gr-uhd" ENABLE_GR_UHD
)
message(STATUS " UHD Version: ${UHD_VERSION}")
-GR_SET_GLOBAL(GR_UHD_INCLUDE_DIRS
- ${CMAKE_CURRENT_SOURCE_DIR}/include
-)
-
SET(GR_PKG_UHD_EXAMPLES_DIR ${GR_PKG_DATA_DIR}/examples/uhd)
########################################################################
diff --git a/gr-uhd/examples/c++/CMakeLists.txt b/gr-uhd/examples/c++/CMakeLists.txt
index 66bf01c3e1..466642de1b 100644
--- a/gr-uhd/examples/c++/CMakeLists.txt
+++ b/gr-uhd/examples/c++/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright 2011 Free Software Foundation, Inc.
+# Copyright 2011,2019 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -18,24 +18,10 @@
# Boston, MA 02110-1301, USA.
########################################################################
-# Setup the include and linker paths
-########################################################################
-include_directories(
- ${CMAKE_CURRENT_SOURCE_DIR}
- ${GR_UHD_INCLUDE_DIRS}
- ${GNURADIO_RUNTIME_INCLUDE_DIRS}
- ${Boost_INCLUDE_DIRS}
- ${UHD_INCLUDE_DIRS}
-)
-
-link_directories(${UHD_LIBRARY_DIRS})
-link_directories(${Boost_LIBRARY_DIRS})
-
-########################################################################
# Build executable
########################################################################
add_executable(tags_demo tags_demo.cc)
-target_link_libraries(tags_demo gnuradio-uhd ${CMAKE_THREAD_LIBS_INIT})
+target_link_libraries(tags_demo gnuradio-uhd)
INSTALL(TARGETS
tags_demo
diff --git a/gr-uhd/lib/CMakeLists.txt b/gr-uhd/lib/CMakeLists.txt
index 35e9dfc5e9..683aa5832d 100644
--- a/gr-uhd/lib/CMakeLists.txt
+++ b/gr-uhd/lib/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright 2011-2013 Free Software Foundation, Inc.
+# Copyright 2011-2013,2019 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -18,35 +18,28 @@
# Boston, MA 02110-1301, USA.
########################################################################
-# Setup the include and linker paths
-########################################################################
-include_directories(
- ${CMAKE_CURRENT_BINARY_DIR}
- ${GR_UHD_INCLUDE_DIRS}
- ${GNURADIO_RUNTIME_INCLUDE_DIRS}
- ${UHD_INCLUDE_DIRS}
- ${Boost_INCLUDE_DIRS}
-)
-
-link_directories(
- ${UHD_LIBRARY_DIRS}
- ${Boost_LIBRARY_DIRS}
-)
-
-if(ENABLE_GR_CTRLPORT)
- ADD_DEFINITIONS(-DGR_CTRLPORT)
-endif(ENABLE_GR_CTRLPORT)
-
-########################################################################
# Setup library
########################################################################
-list(APPEND gr_uhd_sources
+add_library(gnuradio-uhd
usrp_block_impl.cc
usrp_source_impl.cc
usrp_sink_impl.cc
amsg_source_impl.cc
)
+target_link_libraries(gnuradio-uhd
+ gnuradio-runtime
+ UHD::UHD
+)
+
+target_include_directories(gnuradio-uhd
+ PUBLIC
+ $<INSTALL_INTERFACE:include>
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../include>
+ )
+
+
+
#Add Windows DLL resource file if using MSVC
if(MSVC)
include(${CMAKE_SOURCE_DIR}/cmake/Modules/GrVersion.cmake)
@@ -56,38 +49,11 @@ if(MSVC)
${CMAKE_CURRENT_BINARY_DIR}/gnuradio-uhd.rc
@ONLY)
- list(APPEND gr_uhd_sources
+ target_sources(gnuradio-uhd PRIVATE
${CMAKE_CURRENT_BINARY_DIR}/gnuradio-uhd.rc
)
endif(MSVC)
-list(APPEND uhd_libs
- gnuradio-runtime
- ${Boost_LIBRARIES}
- ${UHD_LIBRARIES}
-)
-
-add_library(gnuradio-uhd SHARED ${gr_uhd_sources})
-target_link_libraries(gnuradio-uhd ${uhd_libs})
-GR_LIBRARY_FOO(gnuradio-uhd)
-
-########################################################################
-# Build static libraries if enabled
-########################################################################
-if(ENABLE_STATIC_LIBS)
- if(UHD_VERSION VERSION_GREATER "3.8.1")
-
- add_library(gnuradio-uhd_static STATIC ${gr_uhd_sources})
-
- if(NOT WIN32)
- set_target_properties(gnuradio-uhd_static
- PROPERTIES OUTPUT_NAME gnuradio-uhd)
- endif(NOT WIN32)
-
- install(TARGETS gnuradio-uhd_static
- ARCHIVE DESTINATION lib${LIB_SUFFIX} # .lib file
- )
- else(UHD_VERSION VERSION_GREATER "3.8.1")
- message(STATUS "Not building gr-uhd static library; requires UHD >= 3.8.2")
- endif(UHD_VERSION VERSION_GREATER "3.8.1")
-endif(ENABLE_STATIC_LIBS)
+if(BUILD_SHARED_LIBS)
+ GR_LIBRARY_FOO(gnuradio-uhd UHD)
+endif()
diff --git a/gr-uhd/swig/CMakeLists.txt b/gr-uhd/swig/CMakeLists.txt
index 866e5f1f12..facfacffe9 100644
--- a/gr-uhd/swig/CMakeLists.txt
+++ b/gr-uhd/swig/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright 2011 Free Software Foundation, Inc.
+# Copyright 2011,2019 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -25,16 +25,8 @@ include(GrSwig)
set(GR_SWIG_FLAGS -DGR_HAVE_UHD) #needed to parse uhd_swig.i
-set(GR_SWIG_INCLUDE_DIRS
- ${GR_UHD_INCLUDE_DIRS}
- ${GNURADIO_RUNTIME_SWIG_INCLUDE_DIRS}
- ${UHD_INCLUDE_DIRS}
- ${Boost_INCLUDE_DIRS}
-)
-
-if(ENABLE_GR_CTRLPORT)
- list(APPEND GR_SWIG_FLAGS "-DGR_CTRLPORT")
-endif(ENABLE_GR_CTRLPORT)
+set(GR_SWIG_INCLUDE_DIRS $<TARGET_PROPERTY:runtime_swig,INCLUDE_DIRECTORIES>)
+set(GR_SWIG_TARGET_DEPS runtime_swig)
set(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/uhd_swig_doc.i)
set(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../include/gnuradio/uhd)
diff --git a/gr-utils/python/modtool/templates/gr-newmod/CMakeLists.txt b/gr-utils/python/modtool/templates/gr-newmod/CMakeLists.txt
index e03d787828..2b7e541354 100644
--- a/gr-utils/python/modtool/templates/gr-newmod/CMakeLists.txt
+++ b/gr-utils/python/modtool/templates/gr-newmod/CMakeLists.txt
@@ -21,7 +21,7 @@
########################################################################
# Project setup
########################################################################
-cmake_minimum_required(VERSION 2.6)
+cmake_minimum_required(VERSION 3.8)
project(gr-howto CXX C)
enable_testing()
@@ -47,22 +47,7 @@ set(VERSION_INFO_API_COMPAT 0)
set(VERSION_INFO_MINOR_VERSION 0)
set(VERSION_INFO_MAINT_VERSION git)
-# Set cmake policies.
-# This will suppress developer warnings during the cmake process that can occur
-# if a newer cmake version than the minimum is used.
-
-if(POLICY CMP0026)
- cmake_policy(SET CMP0026 OLD)
-endif()
-if(POLICY CMP0043)
- cmake_policy(SET CMP0043 OLD)
-endif()
-if(POLICY CMP0045)
- cmake_policy(SET CMP0045 OLD)
-endif()
-if(POLICY CMP0046)
- cmake_policy(SET CMP0046 OLD)
-endif()
+cmake_policy(SET CMP0011 NEW)
########################################################################
# Compiler specific setup
@@ -75,30 +60,21 @@ if((CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR
endif()
########################################################################
-# Find boost
-########################################################################
-if(UNIX AND EXISTS "/usr/lib64")
- list(APPEND BOOST_LIBRARYDIR "/usr/lib64") #fedora 64-bit fix
-endif(UNIX AND EXISTS "/usr/lib64")
-set(Boost_ADDITIONAL_VERSIONS
- "1.50.0" "1.50" "1.51.0" "1.51" "1.52.0" "1.52" "1.53.0" "1.53" "1.54.0" "1.54"
- "1.55.0" "1.55" "1.56.0" "1.56" "1.57.0" "1.57" "1.58.0" "1.58" "1.59.0" "1.59"
- "1.60.0" "1.60" "1.61.0" "1.61" "1.62.0" "1.62" "1.63.0" "1.63" "1.64.0" "1.64"
- "1.65.0" "1.65" "1.66.0" "1.66" "1.67.0" "1.67" "1.68.0" "1.68" "1.69.0" "1.69"
-)
-find_package(Boost "1.54" COMPONENTS filesystem system unit_test_framework)
-
-if(NOT Boost_FOUND)
- message(FATAL_ERROR "Boost required to compile howto")
-endif()
-
-########################################################################
# Install directories
########################################################################
+find_package(Gnuradio "3.8" REQUIRED)
+include(GrVersion)
+
include(GrPlatform) #define LIB_SUFFIX
+
+if(NOT CMAKE_MODULES_DIR)
+ set(CMAKE_MODULES_DIR lib${LIB_SUFFIX}/cmake)
+endif(NOT CMAKE_MODULES_DIR)
+
set(GR_RUNTIME_DIR bin)
set(GR_LIBRARY_DIR lib${LIB_SUFFIX})
set(GR_INCLUDE_DIR include/howto)
+SET(GR_CMAKE_DIR ${CMAKE_MODULES_DIR}/howto)
set(GR_DATA_DIR share)
set(GR_PKG_DATA_DIR ${GR_DATA_DIR}/${CMAKE_PROJECT_NAME})
set(GR_DOC_DIR ${GR_DATA_DIR}/doc)
@@ -134,15 +110,6 @@ endif(APPLE)
########################################################################
find_package(Doxygen)
-# Search for GNU Radio and its components and versions. Add any
-# components required to the list of GR_REQUIRED_COMPONENTS (in all
-# caps such as FILTER or FFT) and change the version to the minimum
-# API compatible version required.
-set(GR_REQUIRED_COMPONENTS RUNTIME)
-find_package(Gnuradio "3.7.2" REQUIRED)
-list(INSERT CMAKE_MODULE_PATH 0 ${CMAKE_SOURCE_DIR}/cmake/Modules)
-include(GrVersion)
-
########################################################################
# Setup doxygen option
########################################################################
@@ -153,27 +120,6 @@ else(DOXYGEN_FOUND)
endif(DOXYGEN_FOUND)
########################################################################
-# Setup the include and linker paths
-########################################################################
-include_directories(
- ${CMAKE_SOURCE_DIR}/lib
- ${CMAKE_SOURCE_DIR}/include
- ${CMAKE_BINARY_DIR}/lib
- ${CMAKE_BINARY_DIR}/include
- ${Boost_INCLUDE_DIRS}
- ${GNURADIO_ALL_INCLUDE_DIRS}
-)
-
-link_directories(
- ${Boost_LIBRARY_DIRS}
- ${GNURADIO_RUNTIME_LIBRARY_DIRS}
-)
-
-# Set component parameters
-set(GR_HOWTO_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/include CACHE INTERNAL "" FORCE)
-set(GR_HOWTO_SWIG_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/swig CACHE INTERNAL "" FORCE)
-
-########################################################################
# Create uninstall target
########################################################################
configure_file(
@@ -183,7 +129,8 @@ configure_file(
add_custom_target(uninstall
${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake
-)
+ )
+
########################################################################
# Add subdirectories
@@ -201,9 +148,6 @@ endif(ENABLE_GRC)
########################################################################
# Install cmake search helper for this library
########################################################################
-if(NOT CMAKE_MODULES_DIR)
- set(CMAKE_MODULES_DIR lib${LIB_SUFFIX}/cmake)
-endif(NOT CMAKE_MODULES_DIR)
install(FILES cmake/Modules/howtoConfig.cmake
DESTINATION ${CMAKE_MODULES_DIR}/howto
diff --git a/gr-utils/python/modtool/templates/gr-newmod/cmake/Modules/FindCppUnit.cmake b/gr-utils/python/modtool/templates/gr-newmod/cmake/Modules/FindCppUnit.cmake
deleted file mode 100644
index f93ade3412..0000000000
--- a/gr-utils/python/modtool/templates/gr-newmod/cmake/Modules/FindCppUnit.cmake
+++ /dev/null
@@ -1,39 +0,0 @@
-# http://www.cmake.org/pipermail/cmake/2006-October/011446.html
-# Modified to use pkg config and use standard var names
-
-#
-# Find the CppUnit includes and library
-#
-# This module defines
-# CPPUNIT_INCLUDE_DIR, where to find tiff.h, etc.
-# CPPUNIT_LIBRARIES, the libraries to link against to use CppUnit.
-# CPPUNIT_FOUND, If false, do not try to use CppUnit.
-
-INCLUDE(FindPkgConfig)
-PKG_CHECK_MODULES(PC_CPPUNIT "cppunit")
-
-FIND_PATH(CPPUNIT_INCLUDE_DIRS
- NAMES cppunit/TestCase.h
- HINTS ${PC_CPPUNIT_INCLUDE_DIR}
- ${CMAKE_INSTALL_PREFIX}/include
- PATHS
- /usr/local/include
- /usr/include
-)
-
-FIND_LIBRARY(CPPUNIT_LIBRARIES
- NAMES cppunit
- HINTS ${PC_CPPUNIT_LIBDIR}
- ${CMAKE_INSTALL_PREFIX}/lib
- ${CMAKE_INSTALL_PREFIX}/lib64
- PATHS
- ${CPPUNIT_INCLUDE_DIRS}/../lib
- /usr/local/lib
- /usr/lib
-)
-
-LIST(APPEND CPPUNIT_LIBRARIES ${CMAKE_DL_LIBS})
-
-INCLUDE(FindPackageHandleStandardArgs)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(CPPUNIT DEFAULT_MSG CPPUNIT_LIBRARIES CPPUNIT_INCLUDE_DIRS)
-MARK_AS_ADVANCED(CPPUNIT_LIBRARIES CPPUNIT_INCLUDE_DIRS)
diff --git a/gr-utils/python/modtool/templates/gr-newmod/cmake/Modules/FindGnuradioRuntime.cmake b/gr-utils/python/modtool/templates/gr-newmod/cmake/Modules/FindGnuradioRuntime.cmake
deleted file mode 100644
index 86044e52a3..0000000000
--- a/gr-utils/python/modtool/templates/gr-newmod/cmake/Modules/FindGnuradioRuntime.cmake
+++ /dev/null
@@ -1,36 +0,0 @@
-INCLUDE(FindPkgConfig)
-PKG_CHECK_MODULES(PC_GNURADIO_RUNTIME gnuradio-runtime)
-
-if(PC_GNURADIO_RUNTIME_FOUND)
- # look for include files
- FIND_PATH(
- GNURADIO_RUNTIME_INCLUDE_DIRS
- NAMES gnuradio/top_block.h
- HINTS $ENV{GNURADIO_RUNTIME_DIR}/include
- ${PC_GNURADIO_RUNTIME_INCLUDE_DIRS}
- ${CMAKE_INSTALL_PREFIX}/include
- PATHS /usr/local/include
- /usr/include
- )
-
- # look for libs
- FIND_LIBRARY(
- GNURADIO_RUNTIME_LIBRARIES
- NAMES gnuradio-runtime
- HINTS $ENV{GNURADIO_RUNTIME_DIR}/lib
- ${PC_GNURADIO_RUNTIME_LIBDIR}
- ${CMAKE_INSTALL_PREFIX}/lib/
- ${CMAKE_INSTALL_PREFIX}/lib64/
- PATHS /usr/local/lib
- /usr/local/lib64
- /usr/lib
- /usr/lib64
- )
-
- set(GNURADIO_RUNTIME_FOUND ${PC_GNURADIO_RUNTIME_FOUND})
-endif(PC_GNURADIO_RUNTIME_FOUND)
-
-INCLUDE(FindPackageHandleStandardArgs)
-# do not check GNURADIO_RUNTIME_INCLUDE_DIRS, is not set when default include path is used.
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(GNURADIO_RUNTIME DEFAULT_MSG GNURADIO_RUNTIME_LIBRARIES)
-MARK_AS_ADVANCED(GNURADIO_RUNTIME_LIBRARIES GNURADIO_RUNTIME_INCLUDE_DIRS)
diff --git a/gr-utils/python/modtool/templates/gr-newmod/cmake/Modules/GrMiscUtils.cmake b/gr-utils/python/modtool/templates/gr-newmod/cmake/Modules/GrMiscUtils.cmake
deleted file mode 100644
index 6b7bbc9d20..0000000000
--- a/gr-utils/python/modtool/templates/gr-newmod/cmake/Modules/GrMiscUtils.cmake
+++ /dev/null
@@ -1,306 +0,0 @@
-# Copyright 2010-2011,2014 Free Software Foundation, Inc.
-#
-# This file was generated by gr_modtool, a tool from the GNU Radio framework
-# This file is a part of gr-howto
-#
-# GNU Radio is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3, or (at your option)
-# any later version.
-#
-# GNU Radio is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with GNU Radio; see the file COPYING. If not, write to
-# the Free Software Foundation, Inc., 51 Franklin Street,
-# Boston, MA 02110-1301, USA.
-
-if(DEFINED __INCLUDED_GR_MISC_UTILS_CMAKE)
- return()
-endif()
-set(__INCLUDED_GR_MISC_UTILS_CMAKE TRUE)
-
-########################################################################
-# Set global variable macro.
-# Used for subdirectories to export settings.
-# Example: include and library paths.
-########################################################################
-function(GR_SET_GLOBAL var)
- set(${var} ${ARGN} CACHE INTERNAL "" FORCE)
-endfunction(GR_SET_GLOBAL)
-
-########################################################################
-# Set the pre-processor definition if the condition is true.
-# - def the pre-processor definition to set and condition name
-########################################################################
-function(GR_ADD_COND_DEF def)
- if(${def})
- add_definitions(-D${def})
- endif(${def})
-endfunction(GR_ADD_COND_DEF)
-
-########################################################################
-# Check for a header and conditionally set a compile define.
-# - hdr the relative path to the header file
-# - def the pre-processor definition to set
-########################################################################
-function(GR_CHECK_HDR_N_DEF hdr def)
- include(CheckIncludeFileCXX)
- CHECK_INCLUDE_FILE_CXX(${hdr} ${def})
- GR_ADD_COND_DEF(${def})
-endfunction(GR_CHECK_HDR_N_DEF)
-
-########################################################################
-# Include subdirectory macro.
-# Sets the CMake directory variables,
-# includes the subdirectory CMakeLists.txt,
-# resets the CMake directory variables.
-#
-# This macro includes subdirectories rather than adding them
-# so that the subdirectory can affect variables in the level above.
-# This provides a work-around for the lack of convenience libraries.
-# This way a subdirectory can append to the list of library sources.
-########################################################################
-macro(GR_INCLUDE_SUBDIRECTORY subdir)
- #insert the current directories on the front of the list
- list(INSERT _cmake_source_dirs 0 ${CMAKE_CURRENT_SOURCE_DIR})
- list(INSERT _cmake_binary_dirs 0 ${CMAKE_CURRENT_BINARY_DIR})
-
- #set the current directories to the names of the subdirs
- set(CMAKE_CURRENT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/${subdir})
- set(CMAKE_CURRENT_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/${subdir})
-
- #include the subdirectory CMakeLists to run it
- file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
- include(${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt)
-
- #reset the value of the current directories
- list(GET _cmake_source_dirs 0 CMAKE_CURRENT_SOURCE_DIR)
- list(GET _cmake_binary_dirs 0 CMAKE_CURRENT_BINARY_DIR)
-
- #pop the subdir names of the front of the list
- list(REMOVE_AT _cmake_source_dirs 0)
- list(REMOVE_AT _cmake_binary_dirs 0)
-endmacro(GR_INCLUDE_SUBDIRECTORY)
-
-########################################################################
-# Check if a compiler flag works and conditionally set a compile define.
-# - flag the compiler flag to check for
-# - have the variable to set with result
-########################################################################
-macro(GR_ADD_CXX_COMPILER_FLAG_IF_AVAILABLE flag have)
- include(CheckCXXCompilerFlag)
- CHECK_CXX_COMPILER_FLAG(${flag} ${have})
- if(${have})
- if(${CMAKE_VERSION} VERSION_GREATER "2.8.4")
- STRING(FIND "${CMAKE_CXX_FLAGS}" "${flag}" flag_dup)
- if(${flag_dup} EQUAL -1)
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}")
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${flag}")
- endif(${flag_dup} EQUAL -1)
- endif(${CMAKE_VERSION} VERSION_GREATER "2.8.4")
- endif(${have})
-endmacro(GR_ADD_CXX_COMPILER_FLAG_IF_AVAILABLE)
-
-########################################################################
-# Generates the .la libtool file
-# This appears to generate libtool files that cannot be used by auto*.
-# Usage GR_LIBTOOL(TARGET [target] DESTINATION [dest])
-# Notice: there is not COMPONENT option, these will not get distributed.
-########################################################################
-function(GR_LIBTOOL)
- if(NOT DEFINED GENERATE_LIBTOOL)
- set(GENERATE_LIBTOOL OFF) #disabled by default
- endif()
-
- if(GENERATE_LIBTOOL)
- include(CMakeParseArgumentsCopy)
- CMAKE_PARSE_ARGUMENTS(GR_LIBTOOL "" "TARGET;DESTINATION" "" ${ARGN})
-
- find_program(LIBTOOL libtool)
- if(LIBTOOL)
- include(CMakeMacroLibtoolFile)
- CREATE_LIBTOOL_FILE(${GR_LIBTOOL_TARGET} /${GR_LIBTOOL_DESTINATION})
- endif(LIBTOOL)
- endif(GENERATE_LIBTOOL)
-
-endfunction(GR_LIBTOOL)
-
-########################################################################
-# Do standard things to the library target
-# - set target properties
-# - make install rules
-# Also handle gnuradio custom naming conventions w/ extras mode.
-########################################################################
-function(GR_LIBRARY_FOO target)
- #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} # .so/.dylib file
- ARCHIVE DESTINATION ${GR_LIBRARY_DIR} # .lib file
- RUNTIME DESTINATION ${GR_RUNTIME_DIR} # .dll file
- )
-
- #extras mode enabled automatically on linux
- if(NOT DEFINED LIBRARY_EXTRAS)
- set(LIBRARY_EXTRAS ${LINUX})
- endif()
-
- #special extras mode to enable alternative naming conventions
- if(LIBRARY_EXTRAS)
-
- #create .la file before changing props
- GR_LIBTOOL(TARGET ${target} DESTINATION ${GR_LIBRARY_DIR})
-
- #give the library a special name with ultra-zero soversion
- set_target_properties(${target} PROPERTIES OUTPUT_NAME ${target}-${LIBVER} SOVERSION "0.0.0")
- set(target_name lib${target}-${LIBVER}.so.0.0.0)
-
- #custom command to generate symlinks
- add_custom_command(
- TARGET ${target}
- POST_BUILD
- COMMAND ${CMAKE_COMMAND} -E create_symlink ${target_name} ${CMAKE_CURRENT_BINARY_DIR}/lib${target}.so
- COMMAND ${CMAKE_COMMAND} -E create_symlink ${target_name} ${CMAKE_CURRENT_BINARY_DIR}/lib${target}-${LIBVER}.so.0
- COMMAND ${CMAKE_COMMAND} -E touch ${target_name} #so the symlinks point to something valid so cmake 2.6 will install
- )
-
- #and install the extra symlinks
- install(
- FILES
- ${CMAKE_CURRENT_BINARY_DIR}/lib${target}.so
- ${CMAKE_CURRENT_BINARY_DIR}/lib${target}-${LIBVER}.so.0
- DESTINATION ${GR_LIBRARY_DIR}
- )
-
- endif(LIBRARY_EXTRAS)
-endfunction(GR_LIBRARY_FOO)
-
-########################################################################
-# Create a dummy custom command that depends on other targets.
-# Usage:
-# GR_GEN_TARGET_DEPS(unique_name target_deps <target1> <target2> ...)
-# ADD_CUSTOM_COMMAND(<the usual args> ${target_deps})
-#
-# Custom command can't depend on targets, but can depend on executables,
-# and executables can depend on targets. So this is the process:
-########################################################################
-function(GR_GEN_TARGET_DEPS name var)
- file(
- WRITE ${CMAKE_CURRENT_BINARY_DIR}/${name}.cpp.in
- "int main(void){return 0;}\n"
- )
- execute_process(
- COMMAND ${CMAKE_COMMAND} -E copy_if_different
- ${CMAKE_CURRENT_BINARY_DIR}/${name}.cpp.in
- ${CMAKE_CURRENT_BINARY_DIR}/${name}.cpp
- )
- add_executable(${name} ${CMAKE_CURRENT_BINARY_DIR}/${name}.cpp)
- if(ARGN)
- add_dependencies(${name} ${ARGN})
- endif(ARGN)
-
- if(CMAKE_CROSSCOMPILING)
- set(${var} "DEPENDS;${name}" PARENT_SCOPE) #can't call command when cross
- else()
- set(${var} "DEPENDS;${name};COMMAND;${name}" PARENT_SCOPE)
- endif()
-endfunction(GR_GEN_TARGET_DEPS)
-
-########################################################################
-# Run GRCC to compile .grc files into .py files.
-#
-# Usage: GRCC(filename, directory)
-# - filenames: List of file name of .grc file
-# - directory: directory of built .py file - usually in
-# ${CMAKE_CURRENT_BINARY_DIR}
-# - Sets PYFILES: output converted GRC file names to Python files.
-########################################################################
-function(GRCC)
- # Extract directory from list of args, remove it for the list of filenames.
- list(GET ARGV -1 directory)
- list(REMOVE_AT ARGV -1)
- set(filenames ${ARGV})
- file(MAKE_DIRECTORY ${directory})
-
- SET(GRCC_COMMAND ${CMAKE_SOURCE_DIR}/gr-utils/python/grcc)
-
- # GRCC uses some stuff in grc and gnuradio-runtime, so we force
- # the known paths here
- list(APPEND PYTHONPATHS
- ${CMAKE_SOURCE_DIR}
- ${CMAKE_SOURCE_DIR}/gnuradio-runtime/python
- ${CMAKE_SOURCE_DIR}/gnuradio-runtime/lib/swig
- ${CMAKE_BINARY_DIR}/gnuradio-runtime/lib/swig
- )
-
- if(WIN32)
- #SWIG generates the python library files into a subdirectory.
- #Therefore, we must append this subdirectory into PYTHONPATH.
- #Only do this for the python directories matching the following:
- foreach(pydir ${PYTHONPATHS})
- get_filename_component(name ${pydir} NAME)
- if(name MATCHES "^(swig|lib|src)$")
- list(APPEND PYTHONPATHS ${pydir}/${CMAKE_BUILD_TYPE})
- endif()
- endforeach(pydir)
- endif(WIN32)
-
- file(TO_NATIVE_PATH "${PYTHONPATHS}" pypath)
-
- if(UNIX)
- list(APPEND pypath "$PYTHONPATH")
- string(REPLACE ";" ":" pypath "${pypath}")
- set(ENV{PYTHONPATH} ${pypath})
- endif(UNIX)
-
- if(WIN32)
- list(APPEND pypath "%PYTHONPATH%")
- string(REPLACE ";" "\\;" pypath "${pypath}")
- #list(APPEND environs "PYTHONPATH=${pypath}")
- set(ENV{PYTHONPATH} ${pypath})
- endif(WIN32)
-
- foreach(f ${filenames})
- execute_process(
- COMMAND ${GRCC_COMMAND} -d ${directory} ${f}
- )
- string(REPLACE ".grc" ".py" pyfile "${f}")
- string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_BINARY_DIR}" pyfile "${pyfile}")
- list(APPEND pyfiles ${pyfile})
- endforeach(f)
-
- set(PYFILES ${pyfiles} PARENT_SCOPE)
-endfunction(GRCC)
-
-########################################################################
-# Check if HAVE_PTHREAD_SETSCHEDPARAM and HAVE_SCHED_SETSCHEDULER
-# should be defined
-########################################################################
-macro(GR_CHECK_LINUX_SCHED_AVAIL)
-set(CMAKE_REQUIRED_LIBRARIES -lpthread)
- CHECK_CXX_SOURCE_COMPILES("
- #include <pthread.h>
- int main(){
- pthread_t pthread;
- pthread_setschedparam(pthread, 0, 0);
- return 0;
- } " HAVE_PTHREAD_SETSCHEDPARAM
- )
- GR_ADD_COND_DEF(HAVE_PTHREAD_SETSCHEDPARAM)
-
- CHECK_CXX_SOURCE_COMPILES("
- #include <sched.h>
- int main(){
- pid_t pid;
- sched_setscheduler(pid, 0, 0);
- return 0;
- } " HAVE_SCHED_SETSCHEDULER
- )
- GR_ADD_COND_DEF(HAVE_SCHED_SETSCHEDULER)
-endmacro(GR_CHECK_LINUX_SCHED_AVAIL)
diff --git a/gr-utils/python/modtool/templates/gr-newmod/cmake/Modules/GrPlatform.cmake b/gr-utils/python/modtool/templates/gr-newmod/cmake/Modules/GrPlatform.cmake
deleted file mode 100644
index ed9fc82580..0000000000
--- a/gr-utils/python/modtool/templates/gr-newmod/cmake/Modules/GrPlatform.cmake
+++ /dev/null
@@ -1,63 +0,0 @@
-# Copyright 2011 Free Software Foundation, Inc.
-#
-# This file was generated by gr_modtool, a tool from the GNU Radio framework
-# This file is a part of gr-howto
-#
-# GNU Radio is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3, or (at your option)
-# any later version.
-#
-# GNU Radio is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with GNU Radio; see the file COPYING. If not, write to
-# the Free Software Foundation, Inc., 51 Franklin Street,
-# Boston, MA 02110-1301, USA.
-
-if(DEFINED __INCLUDED_GR_PLATFORM_CMAKE)
- return()
-endif()
-set(__INCLUDED_GR_PLATFORM_CMAKE TRUE)
-
-########################################################################
-# Setup additional defines for OS types
-########################################################################
-if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
- set(LINUX TRUE)
-endif()
-
-if(NOT CMAKE_CROSSCOMPILING AND LINUX AND EXISTS "/etc/debian_version")
- set(DEBIAN TRUE)
-endif()
-
-if(NOT CMAKE_CROSSCOMPILING AND LINUX AND EXISTS "/etc/redhat-release")
- set(REDHAT TRUE)
-endif()
-
-if(NOT CMAKE_CROSSCOMPILING AND LINUX AND EXISTS "/etc/slackware-version")
- set(SLACKWARE TRUE)
-endif()
-
-########################################################################
-# when the library suffix should be 64 (applies to redhat linux family)
-########################################################################
-if (REDHAT OR SLACKWARE)
- set(LIB64_CONVENTION TRUE)
-endif()
-
-if(NOT DEFINED LIB_SUFFIX AND LIB64_CONVENTION AND CMAKE_SYSTEM_PROCESSOR MATCHES "64$")
- set(LIB_SUFFIX 64)
-endif()
-
-########################################################################
-# Detect /lib versus /lib64
-########################################################################
-if (CMAKE_INSTALL_LIBDIR MATCHES lib64)
- set(LIB_SUFFIX 64)
-endif()
-
-set(LIB_SUFFIX ${LIB_SUFFIX} CACHE STRING "lib directory suffix")
diff --git a/gr-utils/python/modtool/templates/gr-newmod/cmake/Modules/GrPython.cmake b/gr-utils/python/modtool/templates/gr-newmod/cmake/Modules/GrPython.cmake
deleted file mode 100644
index 588236e8b8..0000000000
--- a/gr-utils/python/modtool/templates/gr-newmod/cmake/Modules/GrPython.cmake
+++ /dev/null
@@ -1,241 +0,0 @@
-# Copyright 2010-2011 Free Software Foundation, Inc.
-#
-# This file was generated by gr_modtool, a tool from the GNU Radio framework
-# This file is a part of gr-howto
-#
-# GNU Radio is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3, or (at your option)
-# any later version.
-#
-# GNU Radio is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with GNU Radio; see the file COPYING. If not, write to
-# the Free Software Foundation, Inc., 51 Franklin Street,
-# Boston, MA 02110-1301, USA.
-
-if(DEFINED __INCLUDED_GR_PYTHON_CMAKE)
- return()
-endif()
-set(__INCLUDED_GR_PYTHON_CMAKE TRUE)
-
-########################################################################
-# Setup the python interpreter:
-# This allows the user to specify a specific interpreter,
-# or finds the interpreter via the built-in cmake module.
-########################################################################
-#this allows the user to override PYTHON_EXECUTABLE
-if(PYTHON_EXECUTABLE)
-
- set(PYTHONINTERP_FOUND TRUE)
-
-#otherwise if not set, try to automatically find it
-else(PYTHON_EXECUTABLE)
-
- #use the built-in find script
- set(Python_ADDITIONAL_VERSIONS 3.4 3.5 3.6)
- find_package(PythonInterp 2)
-
- #and if that fails use the find program routine
- if(NOT PYTHONINTERP_FOUND)
- find_program(PYTHON_EXECUTABLE NAMES python python2 python2.7)
- if(PYTHON_EXECUTABLE)
- set(PYTHONINTERP_FOUND TRUE)
- endif(PYTHON_EXECUTABLE)
- endif(NOT PYTHONINTERP_FOUND)
-
-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
-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)
-if(PYTHON_EXECUTABLE)
- execute_process(
- COMMAND ${PYTHON_EXECUTABLE} -B -c ""
- OUTPUT_QUIET ERROR_QUIET
- RESULT_VARIABLE PYTHON_HAS_DASH_B_RESULT
- )
- if(PYTHON_HAS_DASH_B_RESULT EQUAL 0)
- set(PYTHON_DASH_B "-B")
- endif()
-endif(PYTHON_EXECUTABLE)
-
-########################################################################
-# Check for the existence of a python module:
-# - desc a string description of the check
-# - mod the name of the module to import
-# - cmd an additional command to run
-# - have the result variable to set
-########################################################################
-macro(GR_PYTHON_CHECK_MODULE desc mod cmd have)
- message(STATUS "")
- message(STATUS "Python checking for ${desc}")
- execute_process(
- COMMAND ${PYTHON_EXECUTABLE} -c "
-#########################################
-try:
- import ${mod}
- assert ${cmd}
-except (ImportError, AssertionError): exit(-1)
-except: pass
-#########################################"
- RESULT_VARIABLE ${have}
- )
- if(${have} EQUAL 0)
- message(STATUS "Python checking for ${desc} - found")
- set(${have} TRUE)
- else(${have} EQUAL 0)
- message(STATUS "Python checking for ${desc} - not found")
- set(${have} FALSE)
- endif(${have} EQUAL 0)
-endmacro(GR_PYTHON_CHECK_MODULE)
-
-########################################################################
-# Sets the python installation directory GR_PYTHON_DIR
-########################################################################
-if(NOT DEFINED GR_PYTHON_DIR)
-execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "
-from distutils import sysconfig
-print(sysconfig.get_python_lib(plat_specific=True, prefix=''))
-" OUTPUT_VARIABLE GR_PYTHON_DIR OUTPUT_STRIP_TRAILING_WHITESPACE
-)
-endif()
-file(TO_CMAKE_PATH ${GR_PYTHON_DIR} GR_PYTHON_DIR)
-
-########################################################################
-# Create an always-built target with a unique name
-# Usage: GR_UNIQUE_TARGET(<description> <dependencies list>)
-########################################################################
-function(GR_UNIQUE_TARGET desc)
- file(RELATIVE_PATH reldir ${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR})
- execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "import re, hashlib
-unique = hashlib.md5(b'${reldir}${ARGN}').hexdigest()[:5]
-print(re.sub('\\W', '_', '${desc} ${reldir} ' + unique))"
- OUTPUT_VARIABLE _target OUTPUT_STRIP_TRAILING_WHITESPACE)
- add_custom_target(${_target} ALL DEPENDS ${ARGN})
-endfunction(GR_UNIQUE_TARGET)
-
-########################################################################
-# Install python sources (also builds and installs byte-compiled python)
-########################################################################
-function(GR_PYTHON_INSTALL)
- include(CMakeParseArgumentsCopy)
- CMAKE_PARSE_ARGUMENTS(GR_PYTHON_INSTALL "" "DESTINATION" "FILES;PROGRAMS" ${ARGN})
-
- ####################################################################
- if(GR_PYTHON_INSTALL_FILES)
- ####################################################################
- install(${ARGN}) #installs regular python files
-
- #create a list of all generated files
- unset(pysrcfiles)
- unset(pycfiles)
- unset(pyofiles)
- foreach(pyfile ${GR_PYTHON_INSTALL_FILES})
- get_filename_component(pyfile ${pyfile} ABSOLUTE)
- list(APPEND pysrcfiles ${pyfile})
-
- #determine if this file is in the source or binary directory
- file(RELATIVE_PATH source_rel_path ${CMAKE_CURRENT_SOURCE_DIR} ${pyfile})
- string(LENGTH "${source_rel_path}" source_rel_path_len)
- file(RELATIVE_PATH binary_rel_path ${CMAKE_CURRENT_BINARY_DIR} ${pyfile})
- string(LENGTH "${binary_rel_path}" binary_rel_path_len)
-
- #and set the generated path appropriately
- if(${source_rel_path_len} GREATER ${binary_rel_path_len})
- set(pygenfile ${CMAKE_CURRENT_BINARY_DIR}/${binary_rel_path})
- else()
- set(pygenfile ${CMAKE_CURRENT_BINARY_DIR}/${source_rel_path})
- endif()
- list(APPEND pycfiles ${pygenfile}c)
- list(APPEND pyofiles ${pygenfile}o)
-
- #ensure generation path exists
- get_filename_component(pygen_path ${pygenfile} PATH)
- file(MAKE_DIRECTORY ${pygen_path})
-
- endforeach(pyfile)
-
- #the command to generate the pyc files
- add_custom_command(
- DEPENDS ${pysrcfiles} OUTPUT ${pycfiles}
- COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_BINARY_DIR}/python_compile_helper.py ${pysrcfiles} ${pycfiles}
- )
-
- #the command to generate the pyo files
- add_custom_command(
- DEPENDS ${pysrcfiles} OUTPUT ${pyofiles}
- COMMAND ${PYTHON_EXECUTABLE} -O ${CMAKE_BINARY_DIR}/python_compile_helper.py ${pysrcfiles} ${pyofiles}
- )
-
- #create install rule and add generated files to target list
- set(python_install_gen_targets ${pycfiles} ${pyofiles})
- install(FILES ${python_install_gen_targets}
- DESTINATION ${GR_PYTHON_INSTALL_DESTINATION}
- )
-
- ####################################################################
- elseif(GR_PYTHON_INSTALL_PROGRAMS)
- ####################################################################
- file(TO_NATIVE_PATH ${PYTHON_EXECUTABLE} pyexe_native)
-
- if (CMAKE_CROSSCOMPILING)
- set(pyexe_native "/usr/bin/env python")
- endif()
-
- foreach(pyfile ${GR_PYTHON_INSTALL_PROGRAMS})
- get_filename_component(pyfile_name ${pyfile} NAME)
- get_filename_component(pyfile ${pyfile} ABSOLUTE)
- string(REPLACE "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" pyexefile "${pyfile}.exe")
- list(APPEND python_install_gen_targets ${pyexefile})
-
- get_filename_component(pyexefile_path ${pyexefile} PATH)
- file(MAKE_DIRECTORY ${pyexefile_path})
-
- add_custom_command(
- OUTPUT ${pyexefile} DEPENDS ${pyfile}
- COMMAND ${PYTHON_EXECUTABLE} -c
- "import re; R=re.compile('^\#!.*$\\n',flags=re.MULTILINE); open('${pyexefile}','w').write('\#!${pyexe_native}\\n'+R.sub('',open('${pyfile}','r').read()))"
- COMMENT "Shebangin ${pyfile_name}"
- VERBATIM
- )
-
- #on windows, python files need an extension to execute
- get_filename_component(pyfile_ext ${pyfile} EXT)
- if(WIN32 AND NOT pyfile_ext)
- set(pyfile_name "${pyfile_name}.py")
- endif()
-
- install(PROGRAMS ${pyexefile} RENAME ${pyfile_name}
- DESTINATION ${GR_PYTHON_INSTALL_DESTINATION}
- )
- endforeach(pyfile)
-
- endif()
-
- GR_UNIQUE_TARGET("pygen" ${python_install_gen_targets})
-
-endfunction(GR_PYTHON_INSTALL)
-
-########################################################################
-# Write the python helper script that generates byte code files
-########################################################################
-file(WRITE ${CMAKE_BINARY_DIR}/python_compile_helper.py "
-import sys, py_compile
-files = sys.argv[1:]
-srcs, gens = files[:len(files)//2], files[len(files)//2:]
-for src, gen in zip(srcs, gens):
- py_compile.compile(file=src, cfile=gen, doraise=True)
-")
diff --git a/gr-utils/python/modtool/templates/gr-newmod/cmake/Modules/GrSwig.cmake b/gr-utils/python/modtool/templates/gr-newmod/cmake/Modules/GrSwig.cmake
deleted file mode 100644
index bd9fc8cb62..0000000000
--- a/gr-utils/python/modtool/templates/gr-newmod/cmake/Modules/GrSwig.cmake
+++ /dev/null
@@ -1,247 +0,0 @@
-# Copyright 2010-2011 Free Software Foundation, Inc.
-#
-# This file was generated by gr_modtool, a tool from the GNU Radio framework
-# This file is a part of gr-howto
-#
-# GNU Radio is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3, or (at your option)
-# any later version.
-#
-# GNU Radio is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with GNU Radio; see the file COPYING. If not, write to
-# the Free Software Foundation, Inc., 51 Franklin Street,
-# Boston, MA 02110-1301, USA.
-
-if(DEFINED __INCLUDED_GR_SWIG_CMAKE)
- return()
-endif()
-set(__INCLUDED_GR_SWIG_CMAKE TRUE)
-
-include(GrPython)
-
-########################################################################
-# Builds a swig documentation file to be generated into python docstrings
-# Usage: GR_SWIG_MAKE_DOCS(output_file input_path input_path....)
-#
-# Set the following variable to specify extra dependent targets:
-# - GR_SWIG_DOCS_SOURCE_DEPS
-# - GR_SWIG_DOCS_TARGET_DEPS
-########################################################################
-function(GR_SWIG_MAKE_DOCS output_file)
- if(ENABLE_DOXYGEN)
-
- #setup the input files variable list, quote formatted
- set(input_files)
- unset(INPUT_PATHS)
- foreach(input_path ${ARGN})
- if(IS_DIRECTORY ${input_path}) #when input path is a directory
- file(GLOB input_path_h_files ${input_path}/*.h)
- else() #otherwise its just a file, no glob
- set(input_path_h_files ${input_path})
- endif()
- list(APPEND input_files ${input_path_h_files})
- set(INPUT_PATHS "${INPUT_PATHS} \"${input_path}\"")
- endforeach(input_path)
-
- #determine the output directory
- get_filename_component(name ${output_file} NAME_WE)
- get_filename_component(OUTPUT_DIRECTORY ${output_file} PATH)
- set(OUTPUT_DIRECTORY ${OUTPUT_DIRECTORY}/${name}_swig_docs)
- make_directory(${OUTPUT_DIRECTORY})
-
- #generate the Doxyfile used by doxygen
- configure_file(
- ${CMAKE_SOURCE_DIR}/docs/doxygen/Doxyfile.swig_doc.in
- ${OUTPUT_DIRECTORY}/Doxyfile
- @ONLY)
-
- #Create a dummy custom command that depends on other targets
- include(GrMiscUtils)
- GR_GEN_TARGET_DEPS(_${name}_tag tag_deps ${GR_SWIG_DOCS_TARGET_DEPS})
-
- #call doxygen on the Doxyfile + input headers
- add_custom_command(
- OUTPUT ${OUTPUT_DIRECTORY}/xml/index.xml
- DEPENDS ${input_files} ${GR_SWIG_DOCS_SOURCE_DEPS} ${tag_deps}
- COMMAND ${DOXYGEN_EXECUTABLE} ${OUTPUT_DIRECTORY}/Doxyfile
- COMMENT "Generating doxygen xml for ${name} docs"
- )
-
- #call the swig_doc script on the xml files
- add_custom_command(
- OUTPUT ${output_file}
- DEPENDS ${input_files} ${stamp-file} ${OUTPUT_DIRECTORY}/xml/index.xml
- COMMAND ${PYTHON_EXECUTABLE} -B
- ${CMAKE_SOURCE_DIR}/docs/doxygen/swig_doc.py
- ${OUTPUT_DIRECTORY}/xml
- ${output_file}
- COMMENT "Generating python docstrings for ${name}"
- WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/docs/doxygen
- )
-
- else(ENABLE_DOXYGEN)
- file(WRITE ${output_file} "\n") #no doxygen -> empty file
- endif(ENABLE_DOXYGEN)
-endfunction(GR_SWIG_MAKE_DOCS)
-
-########################################################################
-# Build a swig target for the common gnuradio use case. Usage:
-# GR_SWIG_MAKE(target ifile ifile ifile...)
-#
-# Set the following variables before calling:
-# - GR_SWIG_FLAGS
-# - GR_SWIG_INCLUDE_DIRS
-# - GR_SWIG_LIBRARIES
-# - GR_SWIG_SOURCE_DEPS
-# - GR_SWIG_TARGET_DEPS
-# - GR_SWIG_DOC_FILE
-# - GR_SWIG_DOC_DIRS
-########################################################################
-macro(GR_SWIG_MAKE name)
- set(ifiles ${ARGN})
-
-
- #do swig doc generation if specified
- if(GR_SWIG_DOC_FILE)
- set(GR_SWIG_DOCS_SOURCE_DEPS ${GR_SWIG_SOURCE_DEPS})
- list(APPEND GR_SWIG_DOCS_TARGET_DEPS ${GR_SWIG_TARGET_DEPS})
- GR_SWIG_MAKE_DOCS(${GR_SWIG_DOC_FILE} ${GR_SWIG_DOC_DIRS})
- add_custom_target(${name}_swig_doc DEPENDS ${GR_SWIG_DOC_FILE})
- list(APPEND GR_SWIG_TARGET_DEPS ${name}_swig_doc ${GR_RUNTIME_SWIG_DOC_FILE})
- endif()
-
- #append additional include directories
- find_package(PythonLibs 2)
- list(APPEND GR_SWIG_INCLUDE_DIRS ${PYTHON_INCLUDE_PATH}) #deprecated name (now dirs)
- list(APPEND GR_SWIG_INCLUDE_DIRS ${PYTHON_INCLUDE_DIRS})
-
- #prepend local swig directories
- list(INSERT GR_SWIG_INCLUDE_DIRS 0 ${CMAKE_CURRENT_SOURCE_DIR})
- list(INSERT GR_SWIG_INCLUDE_DIRS 0 ${CMAKE_CURRENT_BINARY_DIR})
-
- #determine include dependencies for swig file
- execute_process(
- COMMAND ${PYTHON_EXECUTABLE}
- ${CMAKE_BINARY_DIR}/get_swig_deps.py
- "${ifiles}" "${GR_SWIG_INCLUDE_DIRS}"
- OUTPUT_STRIP_TRAILING_WHITESPACE
- OUTPUT_VARIABLE SWIG_MODULE_${name}_EXTRA_DEPS
- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
- )
-
- #Create a dummy custom command that depends on other targets
- include(GrMiscUtils)
- GR_GEN_TARGET_DEPS(_${name}_swig_tag tag_deps ${GR_SWIG_TARGET_DEPS})
- set(tag_file ${CMAKE_CURRENT_BINARY_DIR}/${name}.tag)
- add_custom_command(
- OUTPUT ${tag_file}
- DEPENDS ${GR_SWIG_SOURCE_DEPS} ${tag_deps}
- COMMAND ${CMAKE_COMMAND} -E touch ${tag_file}
- )
-
- #append the specified include directories
- include_directories(${GR_SWIG_INCLUDE_DIRS})
- list(APPEND SWIG_MODULE_${name}_EXTRA_DEPS ${tag_file})
-
- if (PYTHON3)
- set(py3 "-py3")
- endif (PYTHON3)
-
- #setup the swig flags with flags and include directories
- set(CMAKE_SWIG_FLAGS -fvirtual -modern -keyword -w511 -w314 -relativeimport ${py3} -module ${name} ${GR_SWIG_FLAGS})
- foreach(dir ${GR_SWIG_INCLUDE_DIRS})
- list(APPEND CMAKE_SWIG_FLAGS "-I${dir}")
- endforeach(dir)
-
- #set the C++ property on the swig .i file so it builds
- set_source_files_properties(${ifiles} PROPERTIES CPLUSPLUS ON)
-
- #setup the actual swig library target to be built
- include(UseSWIG)
- SWIG_ADD_MODULE(${name} python ${ifiles})
- if(APPLE)
- set(PYTHON_LINK_OPTIONS "-undefined dynamic_lookup")
- else()
- set(PYTHON_LINK_OPTIONS ${PYTHON_LIBRARIES})
- endif(APPLE)
- SWIG_LINK_LIBRARIES(${name} ${PYTHON_LINK_OPTIONS} ${GR_SWIG_LIBRARIES})
- if(${name} STREQUAL "runtime_swig")
- SET_TARGET_PROPERTIES(${SWIG_MODULE_runtime_swig_REAL_NAME} PROPERTIES DEFINE_SYMBOL "gnuradio_runtime_EXPORTS")
- endif(${name} STREQUAL "runtime_swig")
-
-endmacro(GR_SWIG_MAKE)
-
-########################################################################
-# Install swig targets generated by GR_SWIG_MAKE. Usage:
-# GR_SWIG_INSTALL(
-# TARGETS target target target...
-# [DESTINATION destination]
-# )
-########################################################################
-macro(GR_SWIG_INSTALL)
-
- include(CMakeParseArgumentsCopy)
- 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}
- )
-
- include(GrPython)
- GR_PYTHON_INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${name}.py
- DESTINATION ${GR_SWIG_INSTALL_DESTINATION}
- )
-
- GR_LIBTOOL(
- TARGET ${SWIG_MODULE_${name}_REAL_NAME}
- DESTINATION ${GR_SWIG_INSTALL_DESTINATION}
- )
-
- endforeach(name)
-
-endmacro(GR_SWIG_INSTALL)
-
-########################################################################
-# Generate a python file that can determine swig dependencies.
-# Used by the make macro above to determine extra dependencies.
-# When you build C++, CMake figures out the header dependencies.
-# This code essentially performs that logic for swig includes.
-########################################################################
-file(WRITE ${CMAKE_BINARY_DIR}/get_swig_deps.py "
-
-import os, sys, re, io
-
-i_include_matcher = re.compile('%(include|import)\\s*[<|\"](.*)[>|\"]')
-h_include_matcher = re.compile('#(include)\\s*[<|\"](.*)[>|\"]')
-include_dirs = sys.argv[2].split(';')
-
-def get_swig_incs(file_path):
- if file_path.endswith('.i'): matcher = i_include_matcher
- else: matcher = h_include_matcher
- file_contents = io.open(file_path, 'r', encoding='utf-8').read()
- return matcher.findall(file_contents, re.MULTILINE)
-
-def get_swig_deps(file_path, level):
- deps = [file_path]
- if level == 0: return deps
- for keyword, inc_file in get_swig_incs(file_path):
- for inc_dir in include_dirs:
- inc_path = os.path.join(inc_dir, inc_file)
- if not os.path.exists(inc_path): continue
- deps.extend(get_swig_deps(inc_path, level-1))
- break #found, we don't search in lower prio inc dirs
- return deps
-
-if __name__ == '__main__':
- ifiles = sys.argv[1].split(';')
- deps = sum([get_swig_deps(ifile, 3) for ifile in ifiles], [])
- #sys.stderr.write(';'.join(set(deps)) + '\\n\\n')
- print(';'.join(set(deps)))
-")
diff --git a/gr-utils/python/modtool/templates/gr-newmod/cmake/Modules/GrTest.cmake b/gr-utils/python/modtool/templates/gr-newmod/cmake/Modules/GrTest.cmake
deleted file mode 100644
index eee601a791..0000000000
--- a/gr-utils/python/modtool/templates/gr-newmod/cmake/Modules/GrTest.cmake
+++ /dev/null
@@ -1,163 +0,0 @@
-# Copyright 2010-2011 Free Software Foundation, Inc.
-#
-# This file was generated by gr_modtool, a tool from the GNU Radio framework
-# This file is a part of gr-howto
-#
-# GNU Radio is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3, or (at your option)
-# any later version.
-#
-# GNU Radio is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with GNU Radio; see the file COPYING. If not, write to
-# the Free Software Foundation, Inc., 51 Franklin Street,
-# Boston, MA 02110-1301, USA.
-
-if(DEFINED __INCLUDED_GR_TEST_CMAKE)
- return()
-endif()
-set(__INCLUDED_GR_TEST_CMAKE TRUE)
-
-########################################################################
-# Add a unit test and setup the environment for a unit test.
-# Takes the same arguments as the ADD_TEST function.
-#
-# Before calling set the following variables:
-# GR_TEST_TARGET_DEPS - built targets for the library path
-# GR_TEST_LIBRARY_DIRS - directories for the library path
-# GR_TEST_PYTHON_DIRS - directories for the python path
-# GR_TEST_ENVIRONS - other environment key/value pairs
-########################################################################
-function(GR_ADD_TEST test_name)
-
- #Ensure that the build exe also appears in the PATH.
- list(APPEND GR_TEST_TARGET_DEPS ${ARGN})
-
- #In the land of windows, all libraries must be in the PATH.
- #Since the dependent libraries are not yet installed,
- #we must manually set them in the PATH to run tests.
- #The following appends the path of a target dependency.
- foreach(target ${GR_TEST_TARGET_DEPS})
- get_filename_component(path $<TARGET_FILE:$target> PATH)
- string(REGEX REPLACE "\\$\\(.*\\)" "${CMAKE_BUILD_TYPE}" path "${path}")
- list(APPEND GR_TEST_LIBRARY_DIRS ${path})
- endforeach(target)
-
- if(WIN32)
- #SWIG generates the python library files into a subdirectory.
- #Therefore, we must append this subdirectory into PYTHONPATH.
- #Only do this for the python directories matching the following:
- foreach(pydir ${GR_TEST_PYTHON_DIRS})
- get_filename_component(name ${pydir} NAME)
- if(name MATCHES "^(swig|lib|src)$")
- list(APPEND GR_TEST_PYTHON_DIRS ${pydir}/${CMAKE_BUILD_TYPE})
- endif()
- endforeach(pydir)
- endif(WIN32)
-
- file(TO_NATIVE_PATH ${CMAKE_CURRENT_SOURCE_DIR} srcdir)
- 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 "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
- #Replaced this add test + set environs code with the shell script generation.
- #Its nicer to be able to manually run the shell script to diagnose problems.
- #ADD_TEST(${ARGV})
- #SET_TESTS_PROPERTIES(${test_name} PROPERTIES ENVIRONMENT "${environs}")
-
- if(UNIX)
- set(LD_PATH_VAR "LD_LIBRARY_PATH")
- if(APPLE)
- set(LD_PATH_VAR "DYLD_LIBRARY_PATH")
- endif()
-
- set(binpath "${CMAKE_CURRENT_BINARY_DIR}:$PATH")
- list(APPEND libpath "$${LD_PATH_VAR}")
- list(APPEND pypath "$PYTHONPATH")
-
- #replace list separator with the path separator
- string(REPLACE ";" ":" libpath "${libpath}")
- string(REPLACE ";" ":" pypath "${pypath}")
- list(APPEND environs "PATH=${binpath}" "${LD_PATH_VAR}=${libpath}" "PYTHONPATH=${pypath}")
-
- #generate a bat file that sets the environment and runs the test
- 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)
- file(WRITE ${sh_file} "#!${SHELL}\n")
- #each line sets an environment variable
- foreach(environ ${environs})
- file(APPEND ${sh_file} "export ${environ}\n")
- endforeach(environ)
- #load the command to run with its arguments
- foreach(arg ${ARGN})
- file(APPEND ${sh_file} "${arg} ")
- endforeach(arg)
- file(APPEND ${sh_file} "\n")
-
- #make the shell file executable
- execute_process(COMMAND chmod +x ${sh_file})
-
- add_test(${test_name} ${SHELL} ${sh_file})
- endif(UNIX)
-
- if(WIN32)
- list(APPEND libpath ${DLL_PATHS} "%PATH%")
- list(APPEND pypath "%PYTHONPATH%")
-
- #replace list separator with the path separator (escaped)
- string(REPLACE ";" "\\;" libpath "${libpath}")
- string(REPLACE ";" "\\;" pypath "${pypath}")
- list(APPEND environs "PATH=${libpath}" "PYTHONPATH=${pypath}")
-
- #generate a bat file that sets the environment and runs the test
- set(bat_file ${CMAKE_CURRENT_BINARY_DIR}/${test_name}_test.bat)
- file(WRITE ${bat_file} "@echo off\n")
- #each line sets an environment variable
- foreach(environ ${environs})
- file(APPEND ${bat_file} "SET ${environ}\n")
- endforeach(environ)
- #load the command to run with its arguments
- foreach(arg ${ARGN})
- file(APPEND ${bat_file} "${arg} ")
- endforeach(arg)
- file(APPEND ${bat_file} "\n")
-
- add_test(${test_name} ${bat_file})
- endif(WIN32)
-
-endfunction(GR_ADD_TEST)
-
-########################################################################
-# Add a C++ unit test and setup the environment for a unit test.
-# Takes the same arguments as the ADD_TEST function.
-#
-# test_name -- An identifier for your test, for usage with ctest -R
-# test_source -- Path to the .cc file
-#
-# Before calling set the following variables:
-# GR_TEST_TARGET_DEPS - built targets for the library path
-########################################################################
-function(GR_ADD_CPP_TEST test_name test_source)
- add_executable(${test_name} ${test_source})
- target_link_libraries(
- ${test_name}
- ${GR_TEST_TARGET_DEPS}
- )
- set_target_properties(${test_name}
- PROPERTIES COMPILE_DEFINITIONS "BOOST_TEST_DYN_LINK;BOOST_TEST_MAIN"
- )
- GR_ADD_TEST(${test_name} ${test_name})
-endfunction(GR_ADD_CPP_TEST)
-
diff --git a/gr-utils/python/modtool/templates/gr-newmod/cmake/Modules/UseSWIG.cmake b/gr-utils/python/modtool/templates/gr-newmod/cmake/Modules/UseSWIG.cmake
deleted file mode 100644
index a37cc41ae4..0000000000
--- a/gr-utils/python/modtool/templates/gr-newmod/cmake/Modules/UseSWIG.cmake
+++ /dev/null
@@ -1,305 +0,0 @@
-# - SWIG module for CMake
-# Defines the following macros:
-# SWIG_ADD_MODULE(name language [ files ])
-# - Define swig module with given name and specified language
-# SWIG_LINK_LIBRARIES(name [ libraries ])
-# - Link libraries to swig module
-# All other macros are for internal use only.
-# To get the actual name of the swig module,
-# use: ${SWIG_MODULE_${name}_REAL_NAME}.
-# Set Source files properties such as CPLUSPLUS and SWIG_FLAGS to specify
-# special behavior of SWIG. Also global CMAKE_SWIG_FLAGS can be used to add
-# special flags to all swig calls.
-# Another special variable is CMAKE_SWIG_OUTDIR, it allows one to specify
-# where to write all the swig generated module (swig -outdir option)
-# The name-specific variable SWIG_MODULE_<name>_EXTRA_DEPS may be used
-# to specify extra dependencies for the generated modules.
-# If the source file generated by swig need some special flag you can use
-# set_source_files_properties( ${swig_generated_file_fullname}
-# PROPERTIES COMPILE_FLAGS "-bla")
-
-
-#=============================================================================
-# Copyright 2004-2009 Kitware, Inc.
-# Copyright 2009 Mathieu Malaterre <mathieu.malaterre@gmail.com>
-#
-# Distributed under the OSI-approved BSD License (the "License");
-# see accompanying file Copyright.txt for details.
-#
-# This software is distributed WITHOUT ANY WARRANTY; without even the
-# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-# See the License for more information.
-#=============================================================================
-# (To distribute this file outside of CMake, substitute the full
-# License text for the above reference.)
-
-set(SWIG_CXX_EXTENSION "cxx")
-set(SWIG_EXTRA_LIBRARIES "")
-
-set(SWIG_PYTHON_EXTRA_FILE_EXTENSION "py")
-
-#
-# For given swig module initialize variables associated with it
-#
-macro(SWIG_MODULE_INITIALIZE name language)
- string(TOUPPER "${language}" swig_uppercase_language)
- string(TOLOWER "${language}" swig_lowercase_language)
- set(SWIG_MODULE_${name}_LANGUAGE "${swig_uppercase_language}")
- set(SWIG_MODULE_${name}_SWIG_LANGUAGE_FLAG "${swig_lowercase_language}")
-
- set(SWIG_MODULE_${name}_REAL_NAME "${name}")
- if("${SWIG_MODULE_${name}_LANGUAGE}" STREQUAL "UNKNOWN")
- message(FATAL_ERROR "SWIG Error: Language \"${language}\" not found")
- elseif("${SWIG_MODULE_${name}_LANGUAGE}" STREQUAL "PYTHON")
- # when swig is used without the -interface it will produce in the module.py
- # a 'import _modulename' statement, which implies having a corresponding
- # _modulename.so (*NIX), _modulename.pyd (Win32).
- set(SWIG_MODULE_${name}_REAL_NAME "_${name}")
- elseif("${SWIG_MODULE_${name}_LANGUAGE}" STREQUAL "PERL")
- set(SWIG_MODULE_${name}_EXTRA_FLAGS "-shadow")
- endif()
-endmacro()
-
-#
-# For a given language, input file, and output file, determine extra files that
-# will be generated. This is internal swig macro.
-#
-
-macro(SWIG_GET_EXTRA_OUTPUT_FILES language outfiles generatedpath infile)
- set(${outfiles} "")
- get_source_file_property(SWIG_GET_EXTRA_OUTPUT_FILES_module_basename
- ${infile} SWIG_MODULE_NAME)
- if(SWIG_GET_EXTRA_OUTPUT_FILES_module_basename STREQUAL "NOTFOUND")
- get_filename_component(SWIG_GET_EXTRA_OUTPUT_FILES_module_basename "${infile}" NAME_WE)
- endif()
- foreach(it ${SWIG_${language}_EXTRA_FILE_EXTENSION})
- set(${outfiles} ${${outfiles}}
- "${generatedpath}/${SWIG_GET_EXTRA_OUTPUT_FILES_module_basename}.${it}")
- endforeach()
-endmacro()
-
-#
-# Take swig (*.i) file and add proper custom commands for it
-#
-macro(SWIG_ADD_SOURCE_TO_MODULE name outfiles infile)
- set(swig_full_infile ${infile})
- get_filename_component(swig_source_file_path "${infile}" PATH)
- get_filename_component(swig_source_file_name_we "${infile}" NAME_WE)
- get_source_file_property(swig_source_file_generated ${infile} GENERATED)
- get_source_file_property(swig_source_file_cplusplus ${infile} CPLUSPLUS)
- get_source_file_property(swig_source_file_flags ${infile} SWIG_FLAGS)
- if("${swig_source_file_flags}" STREQUAL "NOTFOUND")
- set(swig_source_file_flags "")
- endif()
- set(swig_source_file_fullname "${infile}")
- if(${swig_source_file_path} MATCHES "^${CMAKE_CURRENT_SOURCE_DIR}")
- string(REGEX REPLACE
- "^${CMAKE_CURRENT_SOURCE_DIR}" ""
- swig_source_file_relative_path
- "${swig_source_file_path}")
- else()
- if(${swig_source_file_path} MATCHES "^${CMAKE_CURRENT_BINARY_DIR}")
- string(REGEX REPLACE
- "^${CMAKE_CURRENT_BINARY_DIR}" ""
- swig_source_file_relative_path
- "${swig_source_file_path}")
- set(swig_source_file_generated 1)
- else()
- set(swig_source_file_relative_path "${swig_source_file_path}")
- if(swig_source_file_generated)
- set(swig_source_file_fullname "${CMAKE_CURRENT_BINARY_DIR}/${infile}")
- else()
- set(swig_source_file_fullname "${CMAKE_CURRENT_SOURCE_DIR}/${infile}")
- endif()
- endif()
- endif()
-
- set(swig_generated_file_fullname
- "${CMAKE_CURRENT_BINARY_DIR}")
- if(swig_source_file_relative_path)
- set(swig_generated_file_fullname
- "${swig_generated_file_fullname}/${swig_source_file_relative_path}")
- endif()
- # If CMAKE_SWIG_OUTDIR was specified then pass it to -outdir
- if(CMAKE_SWIG_OUTDIR)
- set(swig_outdir ${CMAKE_SWIG_OUTDIR})
- else()
- set(swig_outdir ${CMAKE_CURRENT_BINARY_DIR})
- endif()
- SWIG_GET_EXTRA_OUTPUT_FILES(${SWIG_MODULE_${name}_LANGUAGE}
- swig_extra_generated_files
- "${swig_outdir}"
- "${infile}")
- set(swig_generated_file_fullname
- "${swig_generated_file_fullname}/${swig_source_file_name_we}")
- # add the language into the name of the file (i.e. TCL_wrap)
- # this allows for the same .i file to be wrapped into different languages
- set(swig_generated_file_fullname
- "${swig_generated_file_fullname}${SWIG_MODULE_${name}_LANGUAGE}_wrap")
-
- if(swig_source_file_cplusplus)
- set(swig_generated_file_fullname
- "${swig_generated_file_fullname}.${SWIG_CXX_EXTENSION}")
- else()
- set(swig_generated_file_fullname
- "${swig_generated_file_fullname}.c")
- endif()
-
- # Shut up some warnings from poor SWIG code generation that we
- # can do nothing about, when this flag is available
- include(CheckCXXCompilerFlag)
- check_cxx_compiler_flag("-Wno-unused-but-set-variable" HAVE_WNO_UNUSED_BUT_SET_VARIABLE)
- if(HAVE_WNO_UNUSED_BUT_SET_VARIABLE)
- set_source_files_properties(${swig_generated_file_fullname}
- PROPERTIES COMPILE_FLAGS "-Wno-unused-but-set-variable")
- endif(HAVE_WNO_UNUSED_BUT_SET_VARIABLE)
-
- get_directory_property(cmake_include_directories INCLUDE_DIRECTORIES)
- list(REMOVE_DUPLICATES cmake_include_directories)
- set(swig_include_dirs)
- foreach(it ${cmake_include_directories})
- set(swig_include_dirs ${swig_include_dirs} "-I${it}")
- endforeach()
-
- set(swig_special_flags)
- # default is c, so add c++ flag if it is c++
- if(swig_source_file_cplusplus)
- set(swig_special_flags ${swig_special_flags} "-c++")
- endif()
- set(swig_extra_flags)
- if(SWIG_MODULE_${name}_EXTRA_FLAGS)
- set(swig_extra_flags ${swig_extra_flags} ${SWIG_MODULE_${name}_EXTRA_FLAGS})
- endif()
-
- # hack to work around CMake bug in add_custom_command with multiple OUTPUT files
-
- file(RELATIVE_PATH reldir ${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR})
- execute_process(
- COMMAND ${PYTHON_EXECUTABLE} -c "import re, hashlib
-unique = hashlib.md5(b'${reldir}${ARGN}').hexdigest()[:5]
-print(re.sub('\\W', '_', '${name} ${reldir} ' + unique))"
- OUTPUT_VARIABLE _target OUTPUT_STRIP_TRAILING_WHITESPACE
- )
-
- file(
- WRITE ${CMAKE_CURRENT_BINARY_DIR}/${_target}.cpp.in
- "int main(void){return 0;}\n"
- )
-
- # create dummy dependencies
- add_custom_command(
- OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_target}.cpp
- COMMAND ${CMAKE_COMMAND} -E copy
- ${CMAKE_CURRENT_BINARY_DIR}/${_target}.cpp.in
- ${CMAKE_CURRENT_BINARY_DIR}/${_target}.cpp
- DEPENDS "${swig_source_file_fullname}" ${SWIG_MODULE_${name}_EXTRA_DEPS}
- COMMENT ""
- )
-
- # create the dummy target
- add_executable(${_target} ${CMAKE_CURRENT_BINARY_DIR}/${_target}.cpp)
-
- # add a custom command to the dummy target
- add_custom_command(
- TARGET ${_target}
- # Let's create the ${swig_outdir} at execution time, in case dir contains $(OutDir)
- COMMAND ${CMAKE_COMMAND} -E make_directory ${swig_outdir}
- COMMAND "${SWIG_EXECUTABLE}"
- ARGS "-${SWIG_MODULE_${name}_SWIG_LANGUAGE_FLAG}"
- ${swig_source_file_flags}
- ${CMAKE_SWIG_FLAGS}
- -outdir ${swig_outdir}
- ${swig_special_flags}
- ${swig_extra_flags}
- ${swig_include_dirs}
- -o "${swig_generated_file_fullname}"
- "${swig_source_file_fullname}"
- COMMENT "Swig source"
- )
-
- #add dummy independent dependencies from the _target to each file
- #that will be generated by the SWIG command above
-
- set(${outfiles} "${swig_generated_file_fullname}" ${swig_extra_generated_files})
-
- foreach(swig_gen_file ${${outfiles}})
- add_custom_command(
- OUTPUT ${swig_gen_file}
- COMMAND "${CMAKE_COMMAND}" -E touch_nocreate "${swig_gen_file}"
- DEPENDS ${_target}
- COMMENT "dummy command to show ${_target} dependency of ${swig_gen_file}"
- )
- endforeach()
-
- set_source_files_properties(
- ${outfiles} PROPERTIES GENERATED 1
- )
-
-endmacro()
-
-#
-# Create Swig module
-#
-macro(SWIG_ADD_MODULE name language)
- SWIG_MODULE_INITIALIZE(${name} ${language})
- set(swig_dot_i_sources)
- set(swig_other_sources)
- foreach(it ${ARGN})
- if(${it} MATCHES ".*\\.i$")
- set(swig_dot_i_sources ${swig_dot_i_sources} "${it}")
- else()
- set(swig_other_sources ${swig_other_sources} "${it}")
- endif()
- endforeach()
-
- set(swig_generated_sources)
- foreach(it ${swig_dot_i_sources})
- SWIG_ADD_SOURCE_TO_MODULE(${name} swig_generated_source ${it})
- set(swig_generated_sources ${swig_generated_sources} "${swig_generated_source}")
- endforeach()
- get_directory_property(swig_extra_clean_files ADDITIONAL_MAKE_CLEAN_FILES)
- set_directory_properties(PROPERTIES
- ADDITIONAL_MAKE_CLEAN_FILES "${swig_extra_clean_files};${swig_generated_sources}")
- add_library(${SWIG_MODULE_${name}_REAL_NAME}
- MODULE
- ${swig_generated_sources}
- ${swig_other_sources})
- string(TOLOWER "${language}" swig_lowercase_language)
- if ("${swig_lowercase_language}" STREQUAL "java")
- if (APPLE)
- # In java you want:
- # System.loadLibrary("LIBRARY");
- # then JNI will look for a library whose name is platform dependent, namely
- # MacOS : libLIBRARY.jnilib
- # Windows: LIBRARY.dll
- # Linux : libLIBRARY.so
- set_target_properties (${SWIG_MODULE_${name}_REAL_NAME} PROPERTIES SUFFIX ".jnilib")
- endif ()
- endif ()
- if ("${swig_lowercase_language}" STREQUAL "python")
- # this is only needed for the python case where a _modulename.so is generated
- set_target_properties(${SWIG_MODULE_${name}_REAL_NAME} PROPERTIES PREFIX "")
- # Python extension modules on Windows must have the extension ".pyd"
- # instead of ".dll" as of Python 2.5. Older python versions do support
- # this suffix.
- # http://docs.python.org/whatsnew/ports.html#SECTION0001510000000000000000
- # <quote>
- # Windows: .dll is no longer supported as a filename extension for extension modules.
- # .pyd is now the only filename extension that will be searched for.
- # </quote>
- if(WIN32 AND NOT CYGWIN)
- set_target_properties(${SWIG_MODULE_${name}_REAL_NAME} PROPERTIES SUFFIX ".pyd")
- endif()
- endif ()
-endmacro()
-
-#
-# Like TARGET_LINK_LIBRARIES but for swig modules
-#
-macro(SWIG_LINK_LIBRARIES name)
- if(SWIG_MODULE_${name}_REAL_NAME)
- target_link_libraries(${SWIG_MODULE_${name}_REAL_NAME} ${ARGN})
- else()
- message(SEND_ERROR "Cannot find Swig library \"${name}\".")
- endif()
-endmacro()
diff --git a/gr-utils/python/modtool/templates/gr-newmod/cmake/Modules/howtoConfig.cmake b/gr-utils/python/modtool/templates/gr-newmod/cmake/Modules/howtoConfig.cmake
index 88fbcad238..786d8242b4 100644
--- a/gr-utils/python/modtool/templates/gr-newmod/cmake/Modules/howtoConfig.cmake
+++ b/gr-utils/python/modtool/templates/gr-newmod/cmake/Modules/howtoConfig.cmake
@@ -22,9 +22,10 @@ FIND_LIBRARY(
/usr/local/lib64
/usr/lib
/usr/lib64
-)
+ )
+
+include("${CMAKE_CURRENT_LIST_DIR}/howtoTarget.cmake")
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(HOWTO DEFAULT_MSG HOWTO_LIBRARIES HOWTO_INCLUDE_DIRS)
MARK_AS_ADVANCED(HOWTO_LIBRARIES HOWTO_INCLUDE_DIRS)
-
diff --git a/gnuradio-runtime/lib/thread/CMakeLists.txt b/gr-utils/python/modtool/templates/gr-newmod/cmake/Modules/targetConfig.cmake.in
index de46dd8932..79e4a2830b 100644
--- a/gnuradio-runtime/lib/thread/CMakeLists.txt
+++ b/gr-utils/python/modtool/templates/gr-newmod/cmake/Modules/targetConfig.cmake.in
@@ -1,4 +1,4 @@
-# Copyright 2010,2013 Free Software Foundation, Inc.
+# Copyright 2018 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -17,12 +17,10 @@
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.
-########################################################################
-# This file included, use CMake directory variables
-########################################################################
+include(CMakeFindDependencyMacro)
-list(APPEND gnuradio_runtime_sources
- ${CMAKE_CURRENT_SOURCE_DIR}/thread.cc
- ${CMAKE_CURRENT_SOURCE_DIR}/thread_body_wrapper.cc
- ${CMAKE_CURRENT_SOURCE_DIR}/thread_group.cc
-)
+set(target_deps "@TARGET_DEPENDENCIES@")
+foreach(dep IN LISTS target_deps)
+ find_dependency(${dep})
+endforeach()
+include("${CMAKE_CURRENT_LIST_DIR}/@TARGET@Targets.cmake")
diff --git a/gr-utils/python/modtool/templates/gr-newmod/docs/doxygen/swig_doc.py b/gr-utils/python/modtool/templates/gr-newmod/docs/doxygen/swig_doc.py
index 07c5b75401..c2f35c87d3 100644
--- a/gr-utils/python/modtool/templates/gr-newmod/docs/doxygen/swig_doc.py
+++ b/gr-utils/python/modtool/templates/gr-newmod/docs/doxygen/swig_doc.py
@@ -81,13 +81,15 @@ class Block2(object):
def utoascii(text):
"""
- Convert unicode text into ascii and escape quotes.
+ Convert unicode text into ascii and escape quotes and backslashes.
"""
if text is None:
return ''
out = text.encode('ascii', 'replace')
- out = out.replace('"', '\\"')
- return out
+ # swig will require us to replace blackslash with 4 backslashes
+ out = out.replace(b'\\', b'\\\\\\\\')
+ out = out.replace(b'"', b'\\"').decode('ascii')
+ return str(out)
def combine_descriptions(obj):
@@ -137,7 +139,7 @@ def make_entry(obj, name=None, templ="{description}", description=None, params=[
return entry_templ.format(
name=name,
docstring=docstring,
- )
+ )
def make_func_entry(func, name=None, description=None, params=None):
@@ -228,12 +230,12 @@ def make_block2_entry(di, block):
# the make function.
output = []
output.append(make_class_entry(
- block, description=description,
- ignored_methods=['make'], params=make_func.params))
+ block, description=description,
+ ignored_methods=['make'], params=make_func.params))
makename = block.name() + '::make'
output.append(make_func_entry(
- make_func, name=makename, description=description,
- params=make_func.params))
+ make_func, name=makename, description=description,
+ params=make_func.params))
return "\n\n".join(output)
def make_swig_interface_file(di, swigdocfilename, custom_output=None):
@@ -303,7 +305,7 @@ def make_swig_interface_file(di, swigdocfilename, custom_output=None):
output = "\n\n".join(output)
- swig_doc = file(swigdocfilename, 'w')
+ swig_doc = open(swigdocfilename, 'w')
swig_doc.write(output)
swig_doc.close()
diff --git a/gr-utils/python/modtool/templates/gr-newmod/lib/CMakeLists.txt b/gr-utils/python/modtool/templates/gr-newmod/lib/CMakeLists.txt
index 2460b930f6..e72283d943 100644
--- a/gr-utils/python/modtool/templates/gr-newmod/lib/CMakeLists.txt
+++ b/gr-utils/python/modtool/templates/gr-newmod/lib/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright 2011,2012,2016,2018 Free Software Foundation, Inc.
+# Copyright 2011,2012,2016,2018,2019 Free Software Foundation, Inc.
#
# This file was generated by gr_modtool, a tool from the GNU Radio framework
# This file is a part of gr-howto
@@ -23,9 +23,6 @@
########################################################################
include(GrPlatform) #define LIB_SUFFIX
-include_directories(${Boost_INCLUDE_DIR})
-link_directories(${Boost_LIBRARY_DIRS})
-
list(APPEND howto_sources
)
@@ -36,7 +33,11 @@ if(NOT howto_sources)
endif(NOT howto_sources)
add_library(gnuradio-howto SHARED ${howto_sources})
-target_link_libraries(gnuradio-howto ${Boost_LIBRARIES} ${GNURADIO_ALL_LIBRARIES})
+target_link_libraries(gnuradio-howto gnuradio::gnuradio-runtime)
+target_include_directories(gnuradio-howto
+ PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../include>
+ PUBLIC $<INSTALL_INTERFACE:include>
+ )
set_target_properties(gnuradio-howto PROPERTIES DEFINE_SYMBOL "gnuradio_howto_EXPORTS")
if(APPLE)
@@ -80,4 +81,3 @@ foreach(qa_file ${test_howto_sources})
${CMAKE_CURRENT_SOURCE_DIR}/${qa_file}
)
endforeach(qa_file)
-
diff --git a/gr-utils/python/modtool/templates/gr-newmod/swig/CMakeLists.txt b/gr-utils/python/modtool/templates/gr-newmod/swig/CMakeLists.txt
index bc11347447..2be8324983 100644
--- a/gr-utils/python/modtool/templates/gr-newmod/swig/CMakeLists.txt
+++ b/gr-utils/python/modtool/templates/gr-newmod/swig/CMakeLists.txt
@@ -30,7 +30,7 @@ endif(NOT howto_sources)
# Include swig generation macros
########################################################################
find_package(SWIG)
-find_package(PythonLibs 2)
+find_package(PythonLibs)
if(NOT SWIG_FOUND OR NOT PYTHONLIBS_FOUND)
return()
endif()
@@ -40,11 +40,11 @@ include(GrPython)
########################################################################
# Setup swig generation
########################################################################
-foreach(incdir ${GNURADIO_RUNTIME_INCLUDE_DIRS})
- list(APPEND GR_SWIG_INCLUDE_DIRS ${incdir}/gnuradio/swig)
-endforeach(incdir)
+set(GR_SWIG_INCLUDE_DIRS $<TARGET_PROPERTY:gnuradio::runtime_swig,INTERFACE_INCLUDE_DIRECTORIES>)
+set(GR_SWIG_TARGET_DEPS gnuradio::runtime_swig)
set(GR_SWIG_LIBRARIES gnuradio-howto)
+
set(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/howto_swig_doc.i)
set(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../include)
diff --git a/gr-utils/python/modtool/tools/grc_yaml_generator.py b/gr-utils/python/modtool/tools/grc_yaml_generator.py
index ce61f46069..5bb0b64047 100644
--- a/gr-utils/python/modtool/tools/grc_yaml_generator.py
+++ b/gr-utils/python/modtool/tools/grc_yaml_generator.py
@@ -27,7 +27,10 @@ from __future__ import unicode_literals
from collections import OrderedDict
import yaml
-from yaml import CLoader as Loader, CDumper as Dumper
+try:
+ from yaml import CLoader as Loader, CDumper as Dumper
+except:
+ from yaml import Loader, Dumper
from .util_functions import is_number
diff --git a/gr-video-sdl/CMakeLists.txt b/gr-video-sdl/CMakeLists.txt
index 4067006dfe..d913aca113 100644
--- a/gr-video-sdl/CMakeLists.txt
+++ b/gr-video-sdl/CMakeLists.txt
@@ -34,11 +34,6 @@ GR_REGISTER_COMPONENT("gr-video-sdl" ENABLE_GR_VIDEO_SDL
ENABLE_GNURADIO_RUNTIME
)
-GR_SET_GLOBAL(GR_VIDEO_SDL_INCLUDE_DIRS
- ${CMAKE_CURRENT_SOURCE_DIR}/include
- ${CMAKE_CURRENT_BINARY_DIR}/include
-)
-
########################################################################
# Begin conditional configuration
########################################################################
diff --git a/gr-video-sdl/lib/CMakeLists.txt b/gr-video-sdl/lib/CMakeLists.txt
index 004c958476..9387360120 100644
--- a/gr-video-sdl/lib/CMakeLists.txt
+++ b/gr-video-sdl/lib/CMakeLists.txt
@@ -18,35 +18,26 @@
# Boston, MA 02110-1301, USA.
########################################################################
-# Setup the include and linker paths
-########################################################################
-include_directories(
- ${GR_VIDEO_SDL_INCLUDE_DIRS}
- ${GNURADIO_RUNTIME_INCLUDE_DIRS}
- ${Boost_INCLUDE_DIRS}
- ${SDL_INCLUDE_DIR}
-)
-
-link_directories(${Boost_LIBRARY_DIRS})
-
-if(ENABLE_GR_CTRLPORT)
- ADD_DEFINITIONS(-DGR_CTRLPORT)
-endif(ENABLE_GR_CTRLPORT)
-
-########################################################################
# Setup library
########################################################################
-list(APPEND video_sdl_sources
+add_library(gnuradio-video-sdl
sink_s_impl.cc
sink_uc_impl.cc
)
-list(APPEND video_sdl_libs
+target_link_libraries(gnuradio-video-sdl PUBLIC
gnuradio-runtime
- ${Boost_LIBRARIES}
${SDL_LIBRARY}
)
+target_include_directories(gnuradio-video-sdl
+ PUBLIC
+ $<INSTALL_INTERFACE:include>
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../include>
+ ${SDL_INCLUDE_DIR}
+ )
+
+
#Add Windows DLL resource file if using MSVC
IF(MSVC)
include(${CMAKE_SOURCE_DIR}/cmake/Modules/GrVersion.cmake)
@@ -56,38 +47,11 @@ IF(MSVC)
${CMAKE_CURRENT_BINARY_DIR}/gnuradio-video-sdl.rc
@ONLY)
- list(APPEND video_sdl_sources
+ target_sources(gnuradio-videos-sdl PRIVATE
${CMAKE_CURRENT_BINARY_DIR}/gnuradio-video-sdl.rc
)
ENDIF(MSVC)
-add_library(gnuradio-video-sdl SHARED ${video_sdl_sources})
-target_link_libraries(gnuradio-video-sdl ${video_sdl_libs})
-GR_LIBRARY_FOO(gnuradio-video-sdl)
-add_dependencies(gnuradio-video-sdl gnuradio-runtime)
-
-if(ENABLE_STATIC_LIBS)
- if(ENABLE_GR_CTRLPORT)
- # Remove GR_CTRLPORT set this target's definitions.
- # Makes sure we don't try to use ControlPort stuff in source files
- GET_DIRECTORY_PROPERTY(STATIC_DEFS COMPILE_DEFINITIONS)
- list(REMOVE_ITEM STATIC_DEFS "GR_CTRLPORT")
- SET_PROPERTY(DIRECTORY PROPERTY COMPILE_DEFINITIONS "${STATIC_DEFS}")
-
- # readd it to the target since we removed it from the directory-wide list.
- SET_PROPERTY(TARGET gnuradio-video-sdl APPEND PROPERTY COMPILE_DEFINITIONS "GR_CTRLPORT")
- endif(ENABLE_GR_CTRLPORT)
-
- add_library(gnuradio-video-sdl_static STATIC ${video_sdl_sources})
-
- add_dependencies(gnuradio-video-sdl_static gnuradio-runtime_static)
-
- if(NOT WIN32)
- set_target_properties(gnuradio-video-sdl_static
- PROPERTIES OUTPUT_NAME gnuradio-video-sdl)
- endif(NOT WIN32)
-
- install(TARGETS gnuradio-video-sdl_static
- ARCHIVE DESTINATION lib${LIB_SUFFIX} # .lib file
- )
-endif(ENABLE_STATIC_LIBS)
+if(BUILD_SHARED_LIBS)
+ GR_LIBRARY_FOO(gnuradio-video-sdl)
+endif()
diff --git a/gr-video-sdl/swig/CMakeLists.txt b/gr-video-sdl/swig/CMakeLists.txt
index a39ace4565..9aeba85c15 100644
--- a/gr-video-sdl/swig/CMakeLists.txt
+++ b/gr-video-sdl/swig/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright 2012 Free Software Foundation, Inc.
+# Copyright 2012,2019 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -23,18 +23,11 @@
include(GrPython)
include(GrSwig)
-set(GR_SWIG_INCLUDE_DIRS
- ${GR_VIDEO_SDL_INCLUDE_DIRS}
- ${GNURADIO_RUNTIME_SWIG_INCLUDE_DIRS}
- ${Boost_INCLUDE_DIRS}
-)
+set(GR_SWIG_INCLUDE_DIRS $<TARGET_PROPERTY:runtime_swig,INCLUDE_DIRECTORIES>)
+set(GR_SWIG_TARGET_DEPS runtime_swig)
set(GR_SWIG_LIBRARIES gnuradio-video-sdl)
-if(ENABLE_GR_CTRLPORT)
- list(APPEND GR_SWIG_FLAGS "-DGR_CTRLPORT")
-endif(ENABLE_GR_CTRLPORT)
-
# Setup swig docs to depend on includes and pull in from build directory
set(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/video_sdl_swig_doc.i)
set(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../include/gnuradio/video_sdl)
diff --git a/gr-vocoder/CMakeLists.txt b/gr-vocoder/CMakeLists.txt
index cab10fdf84..81a92eb060 100644
--- a/gr-vocoder/CMakeLists.txt
+++ b/gr-vocoder/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright 2011,2016 Free Software Foundation, Inc.
+# Copyright 2011,2016,2019 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -35,11 +35,6 @@ GR_REGISTER_COMPONENT("gr-vocoder" ENABLE_GR_VOCODER
ENABLE_GR_ANALOG
)
-GR_SET_GLOBAL(GR_VOCODER_INCLUDE_DIRS
- ${CMAKE_CURRENT_SOURCE_DIR}/include
- ${CMAKE_CURRENT_BINARY_DIR}/include
-)
-
SET(GR_PKG_VOCODER_EXAMPLES_DIR ${GR_PKG_DATA_DIR}/examples/vocoder)
########################################################################
diff --git a/gr-vocoder/lib/CMakeLists.txt b/gr-vocoder/lib/CMakeLists.txt
index ca5647ae31..3890bb2d99 100644
--- a/gr-vocoder/lib/CMakeLists.txt
+++ b/gr-vocoder/lib/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright 2011,2013,2016 Free Software Foundation, Inc.
+# Copyright 2011,2013,2016,2019 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -18,24 +18,9 @@
# Boston, MA 02110-1301, USA.
########################################################################
-# Setup the include and linker paths
-########################################################################
-include_directories(
- ${GR_VOCODER_INCLUDE_DIRS}
- ${GNURADIO_RUNTIME_INCLUDE_DIRS}
- ${Boost_INCLUDE_DIRS}
-)
-
-link_directories(${Boost_LIBRARY_DIRS})
-
-if(ENABLE_GR_CTRLPORT)
- ADD_DEFINITIONS(-DGR_CTRLPORT)
-endif(ENABLE_GR_CTRLPORT)
-
-########################################################################
# Setup library
########################################################################
-list(APPEND gr_vocoder_sources
+add_library(gnuradio-vocoder
alaw_decode_bs_impl.cc
alaw_encode_sb_impl.cc
cvsd_decode_bs_impl.cc
@@ -49,22 +34,30 @@ list(APPEND gr_vocoder_sources
ulaw_decode_bs_impl.cc
ulaw_encode_sb_impl.cc
)
+target_include_directories(gnuradio-vocoder
+ PUBLIC $<INSTALL_INTERFACE:include>
+ PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../include>
+)
+target_link_libraries(gnuradio-vocoder PUBLIC
+ gnuradio-runtime
+)
+
if(LIBCODEC2_FOUND)
- list(APPEND gr_vocoder_sources
+ target_sources(gnuradio-vocoder PRIVATE
codec2.cc
codec2_decode_ps_impl.cc
codec2_encode_sp_impl.cc
)
endif(LIBCODEC2_FOUND)
if(LIBCODEC2_HAS_FREEDV_API)
- list(APPEND gr_vocoder_sources
+ target_sources(gnuradio-vocoder PRIVATE
freedv_api.cc
freedv_rx_ss_impl.cc
freedv_tx_ss_impl.cc
)
endif(LIBCODEC2_HAS_FREEDV_API)
if(LIBGSM_FOUND)
- list(APPEND gr_vocoder_sources
+ target_sources(gnuradio-vocoder PRIVATE
gsm_fr_decode_ps_impl.cc
gsm_fr_encode_sp_impl.cc
)
@@ -87,45 +80,25 @@ endif(MSVC)
########################################################################
# Include subdirs rather to populate to the sources lists.
########################################################################
-GR_INCLUDE_SUBDIRECTORY(g7xx)
-
-list(APPEND vocoder_libs
- gnuradio-runtime
- ${Boost_LIBRARIES}
+target_sources(gnuradio-vocoder PRIVATE
+ ${CMAKE_CURRENT_SOURCE_DIR}/g7xx/g711.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/g7xx/g72x.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/g7xx/g721.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/g7xx/g723_24.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/g7xx/g723_40.c
)
+set(external_deps "")
if(LIBCODEC2_LIBRARIES)
- list(APPEND vocoder_libs ${LIBCODEC2_LIBRARIES})
+ target_link_libraries(gnuradio-vocoder PUBLIC CODEC2::CODEC2)
+ list(APPEND external_deps Codec2)
endif(LIBCODEC2_LIBRARIES)
if(LIBGSM_LIBRARIES)
- list(APPEND vocoder_libs ${LIBGSM_LIBRARIES})
+ target_link_libraries(gnuradio-vocoder PUBLIC GSM::GSM)
+ list(APPEND external_deps GSM)
endif(LIBGSM_LIBRARIES)
-add_library(gnuradio-vocoder SHARED ${gr_vocoder_sources})
-target_link_libraries(gnuradio-vocoder ${vocoder_libs})
-GR_LIBRARY_FOO(gnuradio-vocoder)
-
-if(ENABLE_STATIC_LIBS)
- if(ENABLE_GR_CTRLPORT)
- # Remove GR_CTRLPORT set this target's definitions.
- # Makes sure we don't try to use ControlPort stuff in source files
- GET_DIRECTORY_PROPERTY(STATIC_DEFS COMPILE_DEFINITIONS)
- list(REMOVE_ITEM STATIC_DEFS "GR_CTRLPORT")
- SET_PROPERTY(DIRECTORY PROPERTY COMPILE_DEFINITIONS "${STATIC_DEFS}")
-
- # readd it to the target since we removed it from the directory-wide list.
- SET_PROPERTY(TARGET gnuradio-vocoder APPEND PROPERTY COMPILE_DEFINITIONS "GR_CTRLPORT")
- endif(ENABLE_GR_CTRLPORT)
-
- add_library(gnuradio-vocoder_static STATIC ${gr_vocoder_sources})
-
- if(NOT WIN32)
- set_target_properties(gnuradio-vocoder_static
- PROPERTIES OUTPUT_NAME gnuradio-vocoder)
- endif(NOT WIN32)
-
- install(TARGETS gnuradio-vocoder_static
- ARCHIVE DESTINATION lib${LIB_SUFFIX} # .lib file
- )
-endif(ENABLE_STATIC_LIBS)
+if (BUILD_SHARED_LIBS)
+ GR_LIBRARY_FOO(gnuradio-vocoder ${external_deps})
+endif()
diff --git a/gr-vocoder/lib/g7xx/CMakeLists.txt b/gr-vocoder/lib/g7xx/CMakeLists.txt
deleted file mode 100644
index 246af0e9fa..0000000000
--- a/gr-vocoder/lib/g7xx/CMakeLists.txt
+++ /dev/null
@@ -1,30 +0,0 @@
-# Copyright 2011 Free Software Foundation, Inc.
-#
-# This file is part of GNU Radio
-#
-# GNU Radio is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3, or (at your option)
-# any later version.
-#
-# GNU Radio is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with GNU Radio; see the file COPYING. If not, write to
-# the Free Software Foundation, Inc., 51 Franklin Street,
-# Boston, MA 02110-1301, USA.
-
-########################################################################
-# Append all sources in this dir
-########################################################################
-include_directories(BEFORE ${CMAKE_CURRENT_SOURCE_DIR})
-list(APPEND gr_vocoder_sources
- ${CMAKE_CURRENT_SOURCE_DIR}/g711.c
- ${CMAKE_CURRENT_SOURCE_DIR}/g72x.c
- ${CMAKE_CURRENT_SOURCE_DIR}/g721.c
- ${CMAKE_CURRENT_SOURCE_DIR}/g723_24.c
- ${CMAKE_CURRENT_SOURCE_DIR}/g723_40.c
-)
diff --git a/gr-vocoder/swig/CMakeLists.txt b/gr-vocoder/swig/CMakeLists.txt
index 60f2f47329..4177114f07 100644
--- a/gr-vocoder/swig/CMakeLists.txt
+++ b/gr-vocoder/swig/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright 2011,2016 Free Software Foundation, Inc.
+# Copyright 2011,2016,2019 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -23,15 +23,8 @@
include(GrPython)
include(GrSwig)
-set(GR_SWIG_INCLUDE_DIRS
- ${GR_VOCODER_INCLUDE_DIRS}
- ${GNURADIO_RUNTIME_SWIG_INCLUDE_DIRS}
- ${Boost_INCLUDE_DIRS}
-)
-
-if(ENABLE_GR_CTRLPORT)
- list(APPEND GR_SWIG_FLAGS "-DGR_CTRLPORT")
-endif(ENABLE_GR_CTRLPORT)
+set(GR_SWIG_INCLUDE_DIRS $<TARGET_PROPERTY:runtime_swig,INCLUDE_DIRECTORIES>)
+set(GR_SWIG_TARGET_DEPS runtime_swig)
if(LIBCODEC2_FOUND)
list(APPEND GR_SWIG_FLAGS "-DLIBCODEC2_FOUND")
diff --git a/gr-wavelet/CMakeLists.txt b/gr-wavelet/CMakeLists.txt
index 76f454746a..b09ed89bd3 100644
--- a/gr-wavelet/CMakeLists.txt
+++ b/gr-wavelet/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright 2012 Free Software Foundation, Inc.
+# Copyright 2012,2019 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -37,11 +37,6 @@ GR_REGISTER_COMPONENT("gr-wavelet" ENABLE_GR_WAVELET
GSL_FOUND
)
-GR_SET_GLOBAL(GR_WAVELET_INCLUDE_DIRS
- ${CMAKE_CURRENT_SOURCE_DIR}/lib
- ${CMAKE_CURRENT_SOURCE_DIR}/include
-)
-
########################################################################
# Begin conditional configuration
########################################################################
diff --git a/gr-wavelet/lib/CMakeLists.txt b/gr-wavelet/lib/CMakeLists.txt
index 20dc8d9943..ddb28a2c4a 100644
--- a/gr-wavelet/lib/CMakeLists.txt
+++ b/gr-wavelet/lib/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright 2012,2014 Free Software Foundation, Inc.
+# Copyright 2012,2014,2019 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -18,31 +18,9 @@
# Boston, MA 02110-1301, USA.
########################################################################
-# Setup the include and linker paths
-########################################################################
-include_directories(
- ${CMAKE_CURRENT_SOURCE_DIR}
- ${CMAKE_CURRENT_BINARY_DIR}
- ${GR_WAVELET_INCLUDE_DIRS}
- ${GR_BLOCKS_INCLUDE_DIRS}
- ${GNURADIO_RUNTIME_INCLUDE_DIRS}
- ${Boost_INCLUDE_DIRS}
- ${GSL_INCLUDE_DIRS}
-)
-
-link_directories(${GR_WAVELET_LIBRARY_DIRS})
-link_directories(${Boost_LIBRARY_DIRS})
-link_directories(${GSL_LIBRARY_DIRS})
-add_definitions(${GSL_DEFINITIONS})
-
-if(ENABLE_GR_CTRLPORT)
- ADD_DEFINITIONS(-DGR_CTRLPORT)
-endif(ENABLE_GR_CTRLPORT)
-
-########################################################################
# Setup library
########################################################################
-list(APPEND gr_wavelet_sources
+add_library(gnuradio-wavelet
squash_ff_impl.cc
wavelet_ff_impl.cc
wvps_ff_impl.cc
@@ -57,54 +35,28 @@ if(MSVC)
${CMAKE_CURRENT_BINARY_DIR}/gnuradio-wavelet.rc
@ONLY)
- list(APPEND gr_wavelet_sources
+ target_sources(gnuradio-wavelet PRIVATE
${CMAKE_CURRENT_BINARY_DIR}/gnuradio-wavelet.rc
)
endif(MSVC)
-list(APPEND wavelet_libs
+target_link_libraries(gnuradio-wavelet PUBLIC
gnuradio-runtime
gnuradio-blocks
- ${Boost_LIBRARIES}
- ${WAVELET_LIBRARIES}
- ${GSL_LIBRARIES}
+ gsl::gsl
)
-add_library(gnuradio-wavelet SHARED ${gr_wavelet_sources})
-target_link_libraries(gnuradio-wavelet ${wavelet_libs})
+target_include_directories(gnuradio-wavelet
+ PUBLIC $<INSTALL_INTERFACE:include>
+ PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../include>
+ )
+
# we need -no-as-needed or else -lgslcblas gets stripped out on newer version of gcc
if(CMAKE_COMPILER_IS_GNUCC AND NOT APPLE)
SET_TARGET_PROPERTIES(gnuradio-wavelet PROPERTIES LINK_FLAGS "-Wl,--no-as-needed")
endif()
-GR_LIBRARY_FOO(gnuradio-wavelet)
-add_dependencies(gnuradio-wavelet
- gnuradio-runtime)
-
-if(ENABLE_STATIC_LIBS)
- if(ENABLE_GR_CTRLPORT)
- # Remove GR_CTRLPORT set this target's definitions.
- # Makes sure we don't try to use ControlPort stuff in source files
- GET_DIRECTORY_PROPERTY(STATIC_DEFS COMPILE_DEFINITIONS)
- list(REMOVE_ITEM STATIC_DEFS "GR_CTRLPORT")
- SET_PROPERTY(DIRECTORY PROPERTY COMPILE_DEFINITIONS "${STATIC_DEFS}")
-
- # readd it to the target since we removed it from the directory-wide list.
- SET_PROPERTY(TARGET gnuradio-wavelet APPEND PROPERTY COMPILE_DEFINITIONS "GR_CTRLPORT")
- endif(ENABLE_GR_CTRLPORT)
-
- add_library(gnuradio-wavelet_static STATIC ${gr_wavelet_sources})
-
- add_dependencies(gnuradio-wavelet_static
- gnuradio-runtime_static)
-
- if(NOT WIN32)
- set_target_properties(gnuradio-wavelet_static
- PROPERTIES OUTPUT_NAME gnuradio-wavelet)
- endif(NOT WIN32)
-
- install(TARGETS gnuradio-wavelet_static
- ARCHIVE DESTINATION lib${LIB_SUFFIX} # .lib file
- )
-endif(ENABLE_STATIC_LIBS)
+if(BUILD_SHARED_LIBS)
+ GR_LIBRARY_FOO(gnuradio-wavelet)
+endif()
diff --git a/gr-wavelet/swig/CMakeLists.txt b/gr-wavelet/swig/CMakeLists.txt
index d9bc02edab..a54ca4fb7d 100644
--- a/gr-wavelet/swig/CMakeLists.txt
+++ b/gr-wavelet/swig/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright 2012 Free Software Foundation, Inc.
+# Copyright 2012,2019 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -23,17 +23,8 @@
include(GrPython)
include(GrSwig)
-set(GR_SWIG_INCLUDE_DIRS
- ${GR_WAVELET_INCLUDE_DIRS}
- ${GR_BLOCKS_INCLUDE_DIRS}
- ${GNURADIO_RUNTIME_SWIG_INCLUDE_DIRS}
- ${Boost_INCLUDE_DIRS}
- ${GSL_INCLUDE_DIRS}
-)
-
-if(ENABLE_GR_CTRLPORT)
- list(APPEND GR_SWIG_FLAGS "-DGR_CTRLPORT")
-endif(ENABLE_GR_CTRLPORT)
+set(GR_SWIG_INCLUDE_DIRS $<TARGET_PROPERTY:runtime_swig,INCLUDE_DIRECTORIES>)
+set(GR_SWIG_TARGET_DEPS runtime_swig)
set(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/wavelet_swig_doc.i)
set(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../include/gnuradio/wavelet)
diff --git a/gr-zeromq/CMakeLists.txt b/gr-zeromq/CMakeLists.txt
index 39977ce45e..d81d498346 100644
--- a/gr-zeromq/CMakeLists.txt
+++ b/gr-zeromq/CMakeLists.txt
@@ -35,11 +35,6 @@ GR_REGISTER_COMPONENT("gr-zeromq" ENABLE_GR_ZEROMQ
ZEROMQ_FOUND
)
-GR_SET_GLOBAL(GR_ZEROMQ_INCLUDE_DIRS
- ${CMAKE_CURRENT_SOURCE_DIR}/lib
- ${CMAKE_CURRENT_SOURCE_DIR}/include
-)
-
SET(GR_PKG_ZEROMQ_EXAMPLES_DIR ${GR_PKG_DATA_DIR}/examples/zeromq)
########################################################################
diff --git a/gr-zeromq/lib/CMakeLists.txt b/gr-zeromq/lib/CMakeLists.txt
index 880a6522a9..f39ec7fe07 100644
--- a/gr-zeromq/lib/CMakeLists.txt
+++ b/gr-zeromq/lib/CMakeLists.txt
@@ -18,25 +18,9 @@
# Boston, MA 02110-1301, USA.
########################################################################
-# Setup the include and linker paths
-########################################################################
-include_directories(
- ${GR_ZEROMQ_INCLUDE_DIRS}
- ${GNURADIO_RUNTIME_INCLUDE_DIRS}
- ${Boost_INCLUDE_DIRS}
- ${ZEROMQ_INCLUDE_DIRS}
-)
-
-link_directories(${Boost_LIBRARY_DIRS})
-
-if(ENABLE_GR_CTRLPORT)
- ADD_DEFINITIONS(-DGR_CTRLPORT)
-endif(ENABLE_GR_CTRLPORT)
-
-########################################################################
# Setup library
########################################################################
-list(APPEND zeromq_sources
+add_library(gnuradio-zeromq
base_impl.cc
pub_sink_impl.cc
pub_msg_sink_impl.cc
@@ -51,8 +35,21 @@ list(APPEND zeromq_sources
req_source_impl.cc
req_msg_source_impl.cc
tag_headers.cc
+ )
+
+target_link_libraries(gnuradio-zeromq PUBLIC
+ gnuradio-runtime
+ Boost::boost
+ Boost::thread
+ ZeroMQ::ZeroMQ
)
+target_include_directories(gnuradio-zeromq
+ PUBLIC
+ $<INSTALL_INTERFACE:include>
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../include>
+ )
+
#Add Windows DLL resource file if using MSVC
if(MSVC)
include(${CMAKE_SOURCE_DIR}/cmake/Modules/GrVersion.cmake)
@@ -62,41 +59,13 @@ if(MSVC)
${CMAKE_CURRENT_BINARY_DIR}/gnuradio-zeromq.rc
@ONLY)
- list(APPEND gr_zeromq_sources
+ target_sources(gnuradio-zeromq PRIVATE
${CMAKE_CURRENT_BINARY_DIR}/gnuradio-zeromq.rc
)
endif(MSVC)
-list(APPEND zeromq_libs
- gnuradio-runtime
- ${Boost_LIBRARIES}
- ${ZEROMQ_LIBRARIES}
-)
-
-add_library(gnuradio-zeromq SHARED ${zeromq_sources})
-target_link_libraries(gnuradio-zeromq ${zeromq_libs})
-GR_LIBRARY_FOO(gnuradio-zeromq)
-
-if(ENABLE_STATIC_LIBS)
- if(ENABLE_GR_CTRLPORT)
- # Remove GR_CTRLPORT set this target's definitions.
- # Makes sure we don't try to use ControlPort stuff in source files
- GET_DIRECTORY_PROPERTY(STATIC_DEFS COMPILE_DEFINITIONS)
- list(REMOVE_ITEM STATIC_DEFS "GR_CTRLPORT")
- SET_PROPERTY(DIRECTORY PROPERTY COMPILE_DEFINITIONS "${STATIC_DEFS}")
- # readd it to the target since we removed it from the directory-wide list.
- SET_PROPERTY(TARGET gnuradio-zeromq APPEND PROPERTY COMPILE_DEFINITIONS "GR_CTRLPORT")
- endif(ENABLE_GR_CTRLPORT)
- add_library(gnuradio-zeromq_static STATIC ${zeromq_sources})
-
- if(NOT WIN32)
- set_target_properties(gnuradio-zeromq_static
- PROPERTIES OUTPUT_NAME gnuradio-zeromq)
- endif(NOT WIN32)
-
- install(TARGETS gnuradio-zeromq_static
- ARCHIVE DESTINATION lib${LIB_SUFFIX} # .lib file
- )
-endif(ENABLE_STATIC_LIBS)
+if(BUILD_SHARED_LIBS)
+ GR_LIBRARY_FOO(gnuradio-zeromq ZeroMQ)
+endif()
diff --git a/gr-zeromq/swig/CMakeLists.txt b/gr-zeromq/swig/CMakeLists.txt
index 0c557a3ffa..f264e1efdd 100644
--- a/gr-zeromq/swig/CMakeLists.txt
+++ b/gr-zeromq/swig/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright 2013 Free Software Foundation, Inc.
+# Copyright 2013,2019 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -23,16 +23,8 @@
include(GrPython)
include(GrSwig)
-set(GR_SWIG_INCLUDE_DIRS
- ${GR_ZEROMQ_INCLUDE_DIRS}
- ${GNURADIO_RUNTIME_SWIG_INCLUDE_DIRS}
- ${Boost_INCLUDE_DIRS}
- ${ZEROMQ_INCLUDE_DIRS}
-)
-
-if(ENABLE_GR_CTRLPORT)
- list(APPEND GR_SWIG_FLAGS "-DGR_CTRLPORT")
-endif(ENABLE_GR_CTRLPORT)
+set(GR_SWIG_INCLUDE_DIRS $<TARGET_PROPERTY:runtime_swig,INCLUDE_DIRECTORIES>)
+set(GR_SWIG_TARGET_DEPS runtime_swig)
set(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/zeromq_swig_doc.i)
set(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../include/gnuradio/zeromq)
diff --git a/volk b/volk
-Subproject 3f3c91ee3ce51a31d8c23398124df74d3aa4295
+Subproject d250816c6e5cebd7a668e273c8964baddf1a9b0