summaryrefslogtreecommitdiff
path: root/gr-vocoder/lib
diff options
context:
space:
mode:
authorAndrej Rode <mail@andrejro.de>2019-03-02 19:59:00 +0100
committerMarcus Müller <marcus.mueller@ettus.com>2019-03-04 22:30:37 +0100
commitab2fb35677e38a384df3f9503d1f45f64bbc0374 (patch)
treec59965a71d4951e9bcae9efcf9a6005df2f340a1 /gr-vocoder/lib
parent4e777f1c0ee28011255e3b6b703463cef0f207e0 (diff)
cmake: Update to modern CMake usage
This includes using target based setting of includes and link libraries. This will transitively add the includes and linking flags to dependent targets. This is still a work in progress since only the dynamic libraries have been touched and not all of include_directories directives are gone yet. cmake: remove GR_INCLUDE_SUBDIRECTORY macro Previously this macro was used to inject subdirectories in the current CMake namespace. This is generally undesired and pollutes the current context. previously GNU Radio CMake had a non-default option ENABLE_STATIC_LIBS to build both, shared libraries and static libraries. This seems to be a construction taken over from autotools and serves no purpuose in CMake and complicates the library building. cmake: remove GR_LIBTOOL and la generation support This looks like it was primarily used to support projects using autotools, but comments state that the generated .la files aren't compatible with autotools anyway. cmake: Bump required CMake version to 3.8 UseSWIG cmake uses syntax which requires at least CMake 3.8 and is non-trivial to change
Diffstat (limited to 'gr-vocoder/lib')
-rw-r--r--gr-vocoder/lib/CMakeLists.txt81
-rw-r--r--gr-vocoder/lib/g7xx/CMakeLists.txt30
2 files changed, 27 insertions, 84 deletions
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
-)