Skip to content

Commit

Permalink
gr-lora: augment with variants for different sources
Browse files Browse the repository at this point in the history
Allow for installing the version from BastilleResearch of rpp0.
Default to +rpp0, since it is being actively maintained.
  • Loading branch information
michaelld committed Sep 7, 2017
1 parent 14dbfe6 commit f113c50
Show file tree
Hide file tree
Showing 2 changed files with 260 additions and 17 deletions.
88 changes: 71 additions & 17 deletions science/gr-lora/Portfile
@@ -1,15 +1,68 @@
# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4

PortSystem 1.0
PortGroup cmake 1.0
PortGroup github 1.0
PortGroup active_variants 1.1
PortGroup cxx11 1.1
PortSystem 1.0
PortGroup cmake 1.0
PortGroup github 1.0
PortGroup active_variants 1.1
PortGroup cxx11 1.1

github.setup BastilleResearch gr-lora d587169a9676ad0f9ebf85e6a840f3955b3976d7
version 20170713
checksums rmd160 99f82eb4e57eb59c863598b6a5e58f3632edc769 \
sha256 e1958cfe15e5ff3542e4df3dc7e626751321957cd2ff0122723d6a86d845cf6c
name gr-lora

variant BastilleResearch conflicts rpp0 description "Install gr-lora from BastilleResearch" {}
variant rpp0 description conflicts BastilleResearch "Install gr-lora from rpp0" {}

# set default variant if none selected
if {![variant_isset BastilleResearch] && ![variant_isset rpp0]} {
default_variants +rpp0
}

# make sure -${default_variant} is not set
if {![variant_isset BastilleResearch] && ![variant_isset rpp0]} {
ui_msg "\nError: ${name} requires selection of variant +BastilleResearch or +rpp0.\n"
return -code error "Invalid variant."
}

if {[variant_isset BastilleResearch]} {

github.setup BastilleResearch gr-lora d587169a9676ad0f9ebf85e6a840f3955b3976d7
version 20170713
checksums rmd160 99f82eb4e57eb59c863598b6a5e58f3632edc769 \
sha256 e1958cfe15e5ff3542e4df3dc7e626751321957cd2ff0122723d6a86d845cf6c

} elseif {[variant_isset rpp0]} {

github.setup rpp0 gr-lora 2605fa1772ff8943a2133ad3b06f58153a1ef163
version 20170907
checksums rmd160 96848e1c601798b85b7890d873ae74036ab2f1d7 \
sha256 a5c89e967685d3b509f557865d60ac2e59b3b2e416b55bd311983286515a3ce3

depends_lib-append \
port:liquid-dsp \
port:wireshark

# temporary patch to fix configuration and building

patchfiles-append patch-build-fixes.diff
patch.pre_args -p1

default_variants +mongodb

variant mongodb description "Include support for storing data to MongoDB" {}

if {[variant_isset mongodb]} {

configure.args-append \
-DHAS_MONGODB=TRUE

depends_lib-append port:py27-pymongo

} else {

configure.args-append \
-DHAS_MONGODB=FALSE

}
}

# allow gr-lora to work with both gnuradio and gnuradio-devel ...

Expand All @@ -21,16 +74,16 @@ pre-fetch {
if {![catch {set installed [lindex [registry_active gnuradio-next] 0]}]} {
# gnuradio-next is installed; this version of gr-lora does not work with gnuradio-next
ui_msg "\nError: ${name} requires the gnuradio or gnuradio-devel port, and will not work with the gnuradio-next port. deactivate gnuradio-next, and then install or activate gnuradio or gnuradio-devel.\n"
return -code error "Invalid port dependency: gnuradio-next"
return -code error "Invalid port dependency: gnuradio-next"
}
}

categories science comms
maintainers michaelld openmaintainer
description Provides augmented functionality (blocks, GRC definitions, apps, etc) for GNU Radio.
long_description ${description}
license GPL-3
platforms darwin
categories science comms
maintainers michaelld openmaintainer
description Provides augmented functionality (blocks, GRC definitions, apps, etc) for GNU Radio.
long_description ${description}
license GPL-3
platforms darwin

depends_build-append \
port:pkgconfig \
Expand Down Expand Up @@ -62,7 +115,8 @@ configure.args-append \
-DPYTHON_EXECUTABLE=${frameworks_dir}/Python.framework/Versions/2.7/bin/python2.7 \
-DPYTHON_INCLUDE_DIR=${frameworks_dir}/Python.framework/Versions/2.7/Headers \
-DPYTHON_LIBRARY=${frameworks_dir}/Python.framework/Versions/2.7/Python \
-DGR_PYTHON_DIR=${frameworks_dir}/Python.framework/Versions/2.7/lib/python2.7/site-packages
-DGR_PYTHON_DIR=${frameworks_dir}/Python.framework/Versions/2.7/lib/python2.7/site-packages \
-DCMAKE_MODULES_DIR=${prefix}/share/cmake

# use C++11

Expand Down
189 changes: 189 additions & 0 deletions science/gr-lora/files/patch-build-fixes.diff
@@ -0,0 +1,189 @@
commit b0654dc630a8c5150c4ea2cfdefaf68d71db7037
Author: Michael Dickens <mlk@alum.mit.edu>
Date: Thu Sep 7 09:15:15 2017 -0400

commit

diff --git a/CMakeLists.txt b/CMakeLists.txt
index d4b6305..56136ec 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -117,8 +117,6 @@ endif(APPLE)
########################################################################
# Find gnuradio build dependencies
########################################################################
-find_package(CppUnit)
-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
@@ -127,13 +125,25 @@ find_package(Doxygen)
set(GR_REQUIRED_COMPONENTS RUNTIME FILTER)
find_package(Gnuradio "3.7.2" REQUIRED)

+find_package(CppUnit)
if(NOT CPPUNIT_FOUND)
- message(FATAL_ERROR "CppUnit required to compile lora")
+ message(FATAL_ERROR "CppUnit required to compile gr-lora")
+endif()
+
+find_package(Volk)
+if(NOT VOLK_FOUND)
+ message(FATAL_ERROR "Volk required to compile gr-lora")
+endif()
+
+find_package(Liquid-DSP)
+if(NOT LIQUID_DSP_FOUND)
+ message(FATAL_ERROR "Liquid-DSP required to compile gr-lora")
endif()

########################################################################
# Setup doxygen option
########################################################################
+find_package(Doxygen)
if(DOXYGEN_FOUND)
option(ENABLE_DOXYGEN "Build docs using Doxygen" ON)
else(DOXYGEN_FOUND)
@@ -151,12 +161,16 @@ include_directories(
${Boost_INCLUDE_DIRS}
${CPPUNIT_INCLUDE_DIRS}
${GNURADIO_ALL_INCLUDE_DIRS}
+ ${VOLK_INCLUDE_DIRS}
+ ${LIQUID_DSP_INCLUDE_DIRS}
)

link_directories(
${Boost_LIBRARY_DIRS}
${CPPUNIT_LIBRARY_DIRS}
${GNURADIO_RUNTIME_LIBRARY_DIRS}
+ ${VOLK_LIBRARY_DIRS}
+ ${LIQUID_DSP_LIBRARY_DIRS}
)

# Set component parameters
diff --git a/cmake/Modules/FindLiquid-DSP.cmake b/cmake/Modules/FindLiquid-DSP.cmake
new file mode 100644
index 0000000..921bfbe
--- /dev/null
+++ b/cmake/Modules/FindLiquid-DSP.cmake
@@ -0,0 +1,33 @@
+#
+# Find the Liquid-DSP includes and library
+#
+# This module defines
+# LIQUID_DSP_INCLUDE_DIR, where to find the main Liquid-DSP header
+# LIQUID_DSP_LIBRARIES, the libraries to link against to use Liquid-DSP.
+# LIQUID_DSP_FOUND, If false, do not try to use Liquid-DSP.
+
+FIND_PATH(LIQUID_DSP_INCLUDE_DIRS
+ NAMES liquid/liquid.h
+ HINTS ${LIQUID_DIR}/include
+ ${CMAKE_INSTALL_PREFIX}/include
+ PATHS
+ /usr/local/include
+ /usr/include
+ /opt/local/include
+)
+
+FIND_LIBRARY(LIQUID_DSP_LIBRARIES
+ NAMES liquid
+ HINTS ${LIQUID_DIR}/lib
+ ${LIQUID_DSP_INCLUDE_DIRS}/../lib
+ ${CMAKE_INSTALL_PREFIX}/lib
+ ${CMAKE_INSTALL_PREFIX}/lib64
+ PATHS
+ /usr/local/lib
+ /usr/lib
+ /opt/local/lib
+)
+
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(LIQUID_DSP DEFAULT_MSG LIQUID_DSP_LIBRARIES LIQUID_DSP_INCLUDE_DIRS)
+MARK_AS_ADVANCED(LIQUID_DSP_LIBRARIES LIQUID_DSP_INCLUDE_DIRS)
diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt
index 8659c0f..877145a 100644
--- a/lib/CMakeLists.txt
+++ b/lib/CMakeLists.txt
@@ -22,9 +22,6 @@
########################################################################
include(GrPlatform) #define LIB_SUFFIX

-include_directories(${Boost_INCLUDE_DIR})
-link_directories(${Boost_LIBRARY_DIRS})
-
list(APPEND lora_sources
decoder_impl.cc
message_file_sink_impl.cc
@@ -34,22 +31,17 @@ list(APPEND lora_sources
debugger.cc
)

-set(lora_sources "${lora_sources}" PARENT_SCOPE)
-if(NOT lora_sources)
- MESSAGE(STATUS "No C++ sources... skipping lib/")
- return()
-endif(NOT lora_sources)
+list(APPEND lora_libs
+ ${Boost_LIBRARIES}
+ ${GNURADIO_ALL_LIBRARIES}
+ ${VOLK_LIBRARIES}
+ ${LIQUID_DSP_LIBRARIES}
+)

add_library(gnuradio-lora SHARED ${lora_sources})
-target_link_libraries(gnuradio-lora ${Boost_LIBRARIES} ${GNURADIO_ALL_LIBRARIES} liquid)
+target_link_libraries(gnuradio-lora ${lora_libs})
set_target_properties(gnuradio-lora PROPERTIES DEFINE_SYMBOL "gnuradio_lora_EXPORTS")

-if(APPLE)
- set_target_properties(gnuradio-lora PROPERTIES
- INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib"
- )
-endif(APPLE)
-
########################################################################
# Install built library files
########################################################################
@@ -76,11 +68,9 @@ add_executable(test-lora ${test_lora_sources})

target_link_libraries(
test-lora
- ${GNURADIO_RUNTIME_LIBRARIES}
- ${Boost_LIBRARIES}
- ${CPPUNIT_LIBRARIES}
gnuradio-lora
- liquid
+ ${lora_libs}
+ ${CPPUNIT_LIBRARIES}
)

GR_ADD_TEST(test_lora test-lora)
diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt
index 2f2a0d2..9bbfb71 100644
--- a/python/CMakeLists.txt
+++ b/python/CMakeLists.txt
@@ -53,4 +53,4 @@ set(GR_TEST_TARGET_DEPS gnuradio-lora)
set(GR_TEST_PYTHON_DIRS ${CMAKE_BINARY_DIR}/swig)
GR_ADD_TEST(qa_receiver ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_receiver.py)
# GR_ADD_TEST(qa_BasicTest ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_BasicTest.py)
-GR_ADD_TEST(qa_BasicTest_XML ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_BasicTest_XML.py)
+# GR_ADD_TEST(qa_BasicTest_XML ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_BasicTest_XML.py)
diff --git a/swig/CMakeLists.txt b/swig/CMakeLists.txt
index 9c120fc..a507c92 100644
--- a/swig/CMakeLists.txt
+++ b/swig/CMakeLists.txt
@@ -17,14 +17,6 @@
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.

-########################################################################
-# Check if there is C++ code at all
-########################################################################
-if(NOT lora_sources)
- MESSAGE(STATUS "No C++ sources... skipping swig/")
- return()
-endif(NOT lora_sources)
-
########################################################################
# Include swig generation macros
########################################################################

0 comments on commit f113c50

Please sign in to comment.