Skip to content

Commit df0c042

Browse files
committed
added all files
1 parent 3ad50d5 commit df0c042

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+18065
-0
lines changed

CMakeLists.txt

+184
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,184 @@
1+
# Copyright 2011,2012,2014 Free Software Foundation, Inc.
2+
#
3+
# This file is part of GNU Radio
4+
#
5+
# GNU Radio is free software; you can redistribute it and/or modify
6+
# it under the terms of the GNU General Public License as published by
7+
# the Free Software Foundation; either version 3, or (at your option)
8+
# any later version.
9+
#
10+
# GNU Radio is distributed in the hope that it will be useful,
11+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
# GNU General Public License for more details.
14+
#
15+
# You should have received a copy of the GNU General Public License
16+
# along with GNU Radio; see the file COPYING. If not, write to
17+
# the Free Software Foundation, Inc., 51 Franklin Street,
18+
# Boston, MA 02110-1301, USA.
19+
20+
########################################################################
21+
# Project setup
22+
########################################################################
23+
cmake_minimum_required(VERSION 2.6)
24+
project(gr-matlab CXX C)
25+
enable_testing()
26+
27+
#select the release build type by default to get optimization flags
28+
if(NOT CMAKE_BUILD_TYPE)
29+
set(CMAKE_BUILD_TYPE "Release")
30+
message(STATUS "Build type not specified: defaulting to release.")
31+
endif(NOT CMAKE_BUILD_TYPE)
32+
set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "")
33+
34+
#make sure our local CMake Modules path comes first
35+
list(INSERT CMAKE_MODULE_PATH 0 ${CMAKE_SOURCE_DIR}/cmake/Modules)
36+
37+
########################################################################
38+
# Compiler specific setup
39+
########################################################################
40+
if(CMAKE_COMPILER_IS_GNUCXX AND NOT WIN32)
41+
#http://gcc.gnu.org/wiki/Visibility
42+
add_definitions(-fvisibility=hidden)
43+
endif()
44+
45+
########################################################################
46+
# Find boost
47+
########################################################################
48+
if(UNIX AND EXISTS "/usr/lib64")
49+
list(APPEND BOOST_LIBRARYDIR "/usr/lib64") #fedora 64-bit fix
50+
endif(UNIX AND EXISTS "/usr/lib64")
51+
set(Boost_ADDITIONAL_VERSIONS
52+
"1.35.0" "1.35" "1.36.0" "1.36" "1.37.0" "1.37" "1.38.0" "1.38" "1.39.0" "1.39"
53+
"1.40.0" "1.40" "1.41.0" "1.41" "1.42.0" "1.42" "1.43.0" "1.43" "1.44.0" "1.44"
54+
"1.45.0" "1.45" "1.46.0" "1.46" "1.47.0" "1.47" "1.48.0" "1.48" "1.49.0" "1.49"
55+
"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"
56+
"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"
57+
"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"
58+
"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"
59+
)
60+
find_package(Boost "1.35" COMPONENTS filesystem system)
61+
62+
if(NOT Boost_FOUND)
63+
message(FATAL_ERROR "Boost required to compile matlab")
64+
endif()
65+
66+
########################################################################
67+
# Install directories
68+
########################################################################
69+
include(GrPlatform) #define LIB_SUFFIX
70+
set(GR_RUNTIME_DIR bin)
71+
set(GR_LIBRARY_DIR lib${LIB_SUFFIX})
72+
set(GR_INCLUDE_DIR include/matlab)
73+
set(GR_DATA_DIR share)
74+
set(GR_PKG_DATA_DIR ${GR_DATA_DIR}/${CMAKE_PROJECT_NAME})
75+
set(GR_DOC_DIR ${GR_DATA_DIR}/doc)
76+
set(GR_PKG_DOC_DIR ${GR_DOC_DIR}/${CMAKE_PROJECT_NAME})
77+
set(GR_CONF_DIR etc)
78+
set(GR_PKG_CONF_DIR ${GR_CONF_DIR}/${CMAKE_PROJECT_NAME}/conf.d)
79+
set(GR_LIBEXEC_DIR libexec)
80+
set(GR_PKG_LIBEXEC_DIR ${GR_LIBEXEC_DIR}/${CMAKE_PROJECT_NAME})
81+
set(GRC_BLOCKS_DIR ${GR_PKG_DATA_DIR}/grc/blocks)
82+
83+
########################################################################
84+
# On Apple only, set install name and use rpath correctly, if not already set
85+
########################################################################
86+
if(APPLE)
87+
if(NOT CMAKE_INSTALL_NAME_DIR)
88+
set(CMAKE_INSTALL_NAME_DIR
89+
${CMAKE_INSTALL_PREFIX}/${GR_LIBRARY_DIR} CACHE
90+
PATH "Library Install Name Destination Directory" FORCE)
91+
endif(NOT CMAKE_INSTALL_NAME_DIR)
92+
if(NOT CMAKE_INSTALL_RPATH)
93+
set(CMAKE_INSTALL_RPATH
94+
${CMAKE_INSTALL_PREFIX}/${GR_LIBRARY_DIR} CACHE
95+
PATH "Library Install RPath" FORCE)
96+
endif(NOT CMAKE_INSTALL_RPATH)
97+
if(NOT CMAKE_BUILD_WITH_INSTALL_RPATH)
98+
set(CMAKE_BUILD_WITH_INSTALL_RPATH ON CACHE
99+
BOOL "Do Build Using Library Install RPath" FORCE)
100+
endif(NOT CMAKE_BUILD_WITH_INSTALL_RPATH)
101+
endif(APPLE)
102+
103+
########################################################################
104+
# Find gnuradio build dependencies
105+
########################################################################
106+
find_package(CppUnit)
107+
find_package(Doxygen)
108+
109+
# Search for GNU Radio and its components and versions. Add any
110+
# components required to the list of GR_REQUIRED_COMPONENTS (in all
111+
# caps such as FILTER or FFT) and change the version to the minimum
112+
# API compatible version required.
113+
set(GR_REQUIRED_COMPONENTS RUNTIME)
114+
find_package(Gnuradio "3.7.2" REQUIRED)
115+
116+
if(NOT CPPUNIT_FOUND)
117+
message(FATAL_ERROR "CppUnit required to compile matlab")
118+
endif()
119+
120+
########################################################################
121+
# Setup doxygen option
122+
########################################################################
123+
if(DOXYGEN_FOUND)
124+
option(ENABLE_DOXYGEN "Build docs using Doxygen" ON)
125+
else(DOXYGEN_FOUND)
126+
option(ENABLE_DOXYGEN "Build docs using Doxygen" OFF)
127+
endif(DOXYGEN_FOUND)
128+
129+
########################################################################
130+
# Setup the include and linker paths
131+
########################################################################
132+
include_directories(
133+
${CMAKE_SOURCE_DIR}/lib
134+
${CMAKE_SOURCE_DIR}/include
135+
${CMAKE_BINARY_DIR}/lib
136+
${CMAKE_BINARY_DIR}/include
137+
${Boost_INCLUDE_DIRS}
138+
${CPPUNIT_INCLUDE_DIRS}
139+
${GNURADIO_ALL_INCLUDE_DIRS}
140+
)
141+
142+
link_directories(
143+
${Boost_LIBRARY_DIRS}
144+
${CPPUNIT_LIBRARY_DIRS}
145+
${GNURADIO_RUNTIME_LIBRARY_DIRS}
146+
)
147+
148+
# Set component parameters
149+
set(GR_MATLAB_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/include CACHE INTERNAL "" FORCE)
150+
set(GR_MATLAB_SWIG_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/swig CACHE INTERNAL "" FORCE)
151+
152+
########################################################################
153+
# Create uninstall target
154+
########################################################################
155+
configure_file(
156+
${CMAKE_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in
157+
${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake
158+
@ONLY)
159+
160+
add_custom_target(uninstall
161+
${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake
162+
)
163+
164+
########################################################################
165+
# Add subdirectories
166+
########################################################################
167+
add_subdirectory(include/matlab)
168+
add_subdirectory(lib)
169+
add_subdirectory(swig)
170+
add_subdirectory(python)
171+
add_subdirectory(grc)
172+
add_subdirectory(apps)
173+
add_subdirectory(docs)
174+
175+
########################################################################
176+
# Install cmake search helper for this library
177+
########################################################################
178+
if(NOT CMAKE_MODULES_DIR)
179+
set(CMAKE_MODULES_DIR lib${LIB_SUFFIX}/cmake)
180+
endif(NOT CMAKE_MODULES_DIR)
181+
182+
install(FILES cmake/Modules/matlabConfig.cmake
183+
DESTINATION ${CMAKE_MODULES_DIR}/matlab
184+
)

apps/CMakeLists.txt

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Copyright 2011 Free Software Foundation, Inc.
2+
#
3+
# This file is part of GNU Radio
4+
#
5+
# GNU Radio is free software; you can redistribute it and/or modify
6+
# it under the terms of the GNU General Public License as published by
7+
# the Free Software Foundation; either version 3, or (at your option)
8+
# any later version.
9+
#
10+
# GNU Radio is distributed in the hope that it will be useful,
11+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
# GNU General Public License for more details.
14+
#
15+
# You should have received a copy of the GNU General Public License
16+
# along with GNU Radio; see the file COPYING. If not, write to
17+
# the Free Software Foundation, Inc., 51 Franklin Street,
18+
# Boston, MA 02110-1301, USA.
19+
20+
include(GrPython)
21+
22+
GR_PYTHON_INSTALL(
23+
PROGRAMS
24+
DESTINATION bin
25+
)
+138
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
# CMAKE_PARSE_ARGUMENTS(<prefix> <options> <one_value_keywords> <multi_value_keywords> args...)
2+
#
3+
# CMAKE_PARSE_ARGUMENTS() is intended to be used in macros or functions for
4+
# parsing the arguments given to that macro or function.
5+
# It processes the arguments and defines a set of variables which hold the
6+
# values of the respective options.
7+
#
8+
# The <options> argument contains all options for the respective macro,
9+
# i.e. keywords which can be used when calling the macro without any value
10+
# following, like e.g. the OPTIONAL keyword of the install() command.
11+
#
12+
# The <one_value_keywords> argument contains all keywords for this macro
13+
# which are followed by one value, like e.g. DESTINATION keyword of the
14+
# install() command.
15+
#
16+
# The <multi_value_keywords> argument contains all keywords for this macro
17+
# which can be followed by more than one value, like e.g. the TARGETS or
18+
# FILES keywords of the install() command.
19+
#
20+
# When done, CMAKE_PARSE_ARGUMENTS() will have defined for each of the
21+
# keywords listed in <options>, <one_value_keywords> and
22+
# <multi_value_keywords> a variable composed of the given <prefix>
23+
# followed by "_" and the name of the respective keyword.
24+
# These variables will then hold the respective value from the argument list.
25+
# For the <options> keywords this will be TRUE or FALSE.
26+
#
27+
# All remaining arguments are collected in a variable
28+
# <prefix>_UNPARSED_ARGUMENTS, this can be checked afterwards to see whether
29+
# your macro was called with unrecognized parameters.
30+
#
31+
# As an example here a my_install() macro, which takes similar arguments as the
32+
# real install() command:
33+
#
34+
# function(MY_INSTALL)
35+
# set(options OPTIONAL FAST)
36+
# set(oneValueArgs DESTINATION RENAME)
37+
# set(multiValueArgs TARGETS CONFIGURATIONS)
38+
# cmake_parse_arguments(MY_INSTALL "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
39+
# ...
40+
#
41+
# Assume my_install() has been called like this:
42+
# my_install(TARGETS foo bar DESTINATION bin OPTIONAL blub)
43+
#
44+
# After the cmake_parse_arguments() call the macro will have set the following
45+
# variables:
46+
# MY_INSTALL_OPTIONAL = TRUE
47+
# MY_INSTALL_FAST = FALSE (this option was not used when calling my_install()
48+
# MY_INSTALL_DESTINATION = "bin"
49+
# MY_INSTALL_RENAME = "" (was not used)
50+
# MY_INSTALL_TARGETS = "foo;bar"
51+
# MY_INSTALL_CONFIGURATIONS = "" (was not used)
52+
# MY_INSTALL_UNPARSED_ARGUMENTS = "blub" (no value expected after "OPTIONAL"
53+
#
54+
# You can the continue and process these variables.
55+
#
56+
# Keywords terminate lists of values, e.g. if directly after a one_value_keyword
57+
# another recognized keyword follows, this is interpreted as the beginning of
58+
# the new option.
59+
# E.g. my_install(TARGETS foo DESTINATION OPTIONAL) would result in
60+
# MY_INSTALL_DESTINATION set to "OPTIONAL", but MY_INSTALL_DESTINATION would
61+
# be empty and MY_INSTALL_OPTIONAL would be set to TRUE therefor.
62+
63+
#=============================================================================
64+
# Copyright 2010 Alexander Neundorf <[email protected]>
65+
#
66+
# Distributed under the OSI-approved BSD License (the "License");
67+
# see accompanying file Copyright.txt for details.
68+
#
69+
# This software is distributed WITHOUT ANY WARRANTY; without even the
70+
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
71+
# See the License for more information.
72+
#=============================================================================
73+
# (To distribute this file outside of CMake, substitute the full
74+
# License text for the above reference.)
75+
76+
77+
if(__CMAKE_PARSE_ARGUMENTS_INCLUDED)
78+
return()
79+
endif()
80+
set(__CMAKE_PARSE_ARGUMENTS_INCLUDED TRUE)
81+
82+
83+
function(CMAKE_PARSE_ARGUMENTS prefix _optionNames _singleArgNames _multiArgNames)
84+
# first set all result variables to empty/FALSE
85+
foreach(arg_name ${_singleArgNames} ${_multiArgNames})
86+
set(${prefix}_${arg_name})
87+
endforeach(arg_name)
88+
89+
foreach(option ${_optionNames})
90+
set(${prefix}_${option} FALSE)
91+
endforeach(option)
92+
93+
set(${prefix}_UNPARSED_ARGUMENTS)
94+
95+
set(insideValues FALSE)
96+
set(currentArgName)
97+
98+
# now iterate over all arguments and fill the result variables
99+
foreach(currentArg ${ARGN})
100+
list(FIND _optionNames "${currentArg}" optionIndex) # ... then this marks the end of the arguments belonging to this keyword
101+
list(FIND _singleArgNames "${currentArg}" singleArgIndex) # ... then this marks the end of the arguments belonging to this keyword
102+
list(FIND _multiArgNames "${currentArg}" multiArgIndex) # ... then this marks the end of the arguments belonging to this keyword
103+
104+
if(${optionIndex} EQUAL -1 AND ${singleArgIndex} EQUAL -1 AND ${multiArgIndex} EQUAL -1)
105+
if(insideValues)
106+
if("${insideValues}" STREQUAL "SINGLE")
107+
set(${prefix}_${currentArgName} ${currentArg})
108+
set(insideValues FALSE)
109+
elseif("${insideValues}" STREQUAL "MULTI")
110+
list(APPEND ${prefix}_${currentArgName} ${currentArg})
111+
endif()
112+
else(insideValues)
113+
list(APPEND ${prefix}_UNPARSED_ARGUMENTS ${currentArg})
114+
endif(insideValues)
115+
else()
116+
if(NOT ${optionIndex} EQUAL -1)
117+
set(${prefix}_${currentArg} TRUE)
118+
set(insideValues FALSE)
119+
elseif(NOT ${singleArgIndex} EQUAL -1)
120+
set(currentArgName ${currentArg})
121+
set(${prefix}_${currentArgName})
122+
set(insideValues "SINGLE")
123+
elseif(NOT ${multiArgIndex} EQUAL -1)
124+
set(currentArgName ${currentArg})
125+
set(${prefix}_${currentArgName})
126+
set(insideValues "MULTI")
127+
endif()
128+
endif()
129+
130+
endforeach(currentArg)
131+
132+
# propagate the result variables to the caller:
133+
foreach(arg_name ${_singleArgNames} ${_multiArgNames} ${_optionNames})
134+
set(${prefix}_${arg_name} ${${prefix}_${arg_name}} PARENT_SCOPE)
135+
endforeach(arg_name)
136+
set(${prefix}_UNPARSED_ARGUMENTS ${${prefix}_UNPARSED_ARGUMENTS} PARENT_SCOPE)
137+
138+
endfunction(CMAKE_PARSE_ARGUMENTS _options _singleArgs _multiArgs)

cmake/Modules/FindCppUnit.cmake

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# http://www.cmake.org/pipermail/cmake/2006-October/011446.html
2+
# Modified to use pkg config and use standard var names
3+
4+
#
5+
# Find the CppUnit includes and library
6+
#
7+
# This module defines
8+
# CPPUNIT_INCLUDE_DIR, where to find tiff.h, etc.
9+
# CPPUNIT_LIBRARIES, the libraries to link against to use CppUnit.
10+
# CPPUNIT_FOUND, If false, do not try to use CppUnit.
11+
12+
INCLUDE(FindPkgConfig)
13+
PKG_CHECK_MODULES(PC_CPPUNIT "cppunit")
14+
15+
FIND_PATH(CPPUNIT_INCLUDE_DIRS
16+
NAMES cppunit/TestCase.h
17+
HINTS ${PC_CPPUNIT_INCLUDE_DIR}
18+
${CMAKE_INSTALL_PREFIX}/include
19+
PATHS
20+
/usr/local/include
21+
/usr/include
22+
)
23+
24+
FIND_LIBRARY(CPPUNIT_LIBRARIES
25+
NAMES cppunit
26+
HINTS ${PC_CPPUNIT_LIBDIR}
27+
${CMAKE_INSTALL_PREFIX}/lib
28+
${CMAKE_INSTALL_PREFIX}/lib64
29+
PATHS
30+
${CPPUNIT_INCLUDE_DIRS}/../lib
31+
/usr/local/lib
32+
/usr/lib
33+
)
34+
35+
LIST(APPEND CPPUNIT_LIBRARIES ${CMAKE_DL_LIBS})
36+
37+
INCLUDE(FindPackageHandleStandardArgs)
38+
FIND_PACKAGE_HANDLE_STANDARD_ARGS(CPPUNIT DEFAULT_MSG CPPUNIT_LIBRARIES CPPUNIT_INCLUDE_DIRS)
39+
MARK_AS_ADVANCED(CPPUNIT_LIBRARIES CPPUNIT_INCLUDE_DIRS)

0 commit comments

Comments
 (0)