[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] [gnuradio] 03/04: vocoder: use system libraries for li
From: |
git |
Subject: |
[Commit-gnuradio] [gnuradio] 03/04: vocoder: use system libraries for libgsm and codec2, if found |
Date: |
Fri, 18 Apr 2014 18:06:00 +0000 (UTC) |
This is an automated email from the git hooks/post-receive script.
jcorgan pushed a commit to branch master
in repository gnuradio.
commit 0dfb7bc4a4aa51654db08f6b35ecde2fa7da962e
Author: A. Maitland Bottoms <address@hidden>
Date: Tue Apr 15 19:57:12 2014 -0400
vocoder: use system libraries for libgsm and codec2, if found
---
gr-vocoder/lib/CMakeLists.txt | 74 +++++++++++++++++++++++++++++++++++++++++--
1 file changed, 72 insertions(+), 2 deletions(-)
diff --git a/gr-vocoder/lib/CMakeLists.txt b/gr-vocoder/lib/CMakeLists.txt
index 08ff410..67271ee 100644
--- a/gr-vocoder/lib/CMakeLists.txt
+++ b/gr-vocoder/lib/CMakeLists.txt
@@ -18,6 +18,62 @@
# Boston, MA 02110-1301, USA.
########################################################################
+# Check for system libgsm....
+########################################################################
+if(NOT GR_USE_SYSTEM_LIBGSM)
+ find_path(LIBGSM_INCLUDE_DIR NAMES gsm.h
+ PATHS
+ ${LIBGSM_PKG_INCLUDE_DIRS}
+ /usr/include/gsm
+ /usr/include
+ )
+
+ find_library(LIBGSM_LIBRARIES NAMES gsm
+ PATHS
+ ${LIBGSM_PKG_LIBRARY_DIRS}
+ /usr/lib
+ )
+
+if(LIBGSM_INCLUDE_DIR AND LIBGSM_LIBRARIES)
+ set(GR_USE_SYSTEM_LIBGSM TRUE CACHE INTERNAL "system libgsm found")
+ message(STATUS "Found libgsm: ${LIBGSM_INCLUDE_DIR}, ${LIBGSM_LIBRARIES}")
+else(LIBGSM_INCLUDE_DIR AND LIBGSM_LIBRARIES)
+ set(GR_USE_SYSTEM_LIBGSM FALSE CACHE INTERNAL "system libgsm found")
+ message(STATUS "system libgsm not found.")
+endif(LIBGSM_INCLUDE_DIR AND LIBGSM_LIBRARIES)
+
+mark_as_advanced(LIBGSM_INCLUDE_DIR LIBGSM_LIBRARIES)
+endif(NOT GR_USE_SYSTEM_LIBGSM)
+
+########################################################################
+# Check for system libcodec2....
+########################################################################
+if(NOT GR_USE_SYSTEM_LIBCODEC2)
+ find_path(LIBCODEC2_INCLUDE_DIR NAMES codec2.h
+ PATHS
+ ${LIBCODEC2_PKG_INCLUDE_DIRS}
+ /usr/include/codec2
+ /usr/include
+ )
+
+ find_library(LIBCODEC2_LIBRARIES NAMES codec2
+ PATHS
+ ${LIBCODEC2_PKG_LIBRARY_DIRS}
+ /usr/lib
+ )
+
+if(LIBCODEC2_INCLUDE_DIR AND LIBCODEC2_LIBRARIES)
+ set(GR_USE_SYSTEM_LIBCODEC2 TRUE CACHE INTERNAL "system libcodec2 found")
+ message(STATUS "Found libcodec2: ${LIBCODEC2_INCLUDE_DIR},
${LIBCODEC2_LIBRARIES}")
+else(LIBCODEC2_INCLUDE_DIR AND LIBCODEC2_LIBRARIES)
+ set(GR_USE_SYSTEM_LIBCODEC2 FALSE CACHE INTERNAL "system libcodec2 found")
+ message(STATUS "system libcodec2 not found.")
+endif(LIBCODEC2_INCLUDE_DIR AND LIBCODEC2_LIBRARIES)
+
+mark_as_advanced(LIBCODEC2_INCLUDE_DIR LIBCODEC2_LIBRARIES)
+endif(NOT GR_USE_SYSTEM_LIBCODEC2)
+
+########################################################################
# Setup the include and linker paths
########################################################################
include_directories(
@@ -77,9 +133,15 @@ endif(MSVC)
########################################################################
# Include subdirs rather to populate to the sources lists.
########################################################################
-GR_INCLUDE_SUBDIRECTORY(codec2)
GR_INCLUDE_SUBDIRECTORY(g7xx)
-GR_INCLUDE_SUBDIRECTORY(gsm)
+
+if(NOT GR_USE_SYSTEM_LIBCODEC2)
+ GR_INCLUDE_SUBDIRECTORY(codec2)
+endif(NOT GR_USE_SYSTEM_LIBCODEC2)
+
+if(NOT GR_USE_SYSTEM_LIBGSM)
+ GR_INCLUDE_SUBDIRECTORY(gsm)
+endif(NOT GR_USE_SYSTEM_LIBGSM)
list(APPEND vocoder_libs
gnuradio-runtime
@@ -87,6 +149,14 @@ list(APPEND vocoder_libs
${LOG4CPP_LIBRARIES}
)
+if(GR_USE_SYSTEM_LIBCODEC2)
+ list(APPEND vocoder_libs ${LIBCODEC2_LIBRARIES})
+endif(GR_USE_SYSTEM_LIBCODEC2)
+
+if(GR_USE_SYSTEM_LIBGSM)
+ list(APPEND vocoder_libs ${LIBGSM_LIBRARIES})
+endif(GR_USE_SYSTEM_LIBGSM)
+
add_library(gnuradio-vocoder SHARED ${gr_vocoder_sources})
target_link_libraries(gnuradio-vocoder ${vocoder_libs})
GR_LIBRARY_FOO(gnuradio-vocoder RUNTIME_COMPONENT "vocoder_runtime"
DEVEL_COMPONENT "vocoder_devel")