forked from sdr/gr-osmosdr
update build system to check for component dependencies
this will only enable components if the dependencies were met.
This commit is contained in:
parent
afac8e8c42
commit
514b806d0a
|
@ -1,4 +1,4 @@
|
|||
# Copyright 2011 Free Software Foundation, Inc.
|
||||
# Copyright 2012 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is part of GNU Radio
|
||||
#
|
||||
|
@ -17,7 +17,6 @@
|
|||
# the Free Software Foundation, Inc., 51 Franklin Street,
|
||||
# Boston, MA 02110-1301, USA.
|
||||
|
||||
|
||||
########################################################################
|
||||
# Project setup
|
||||
########################################################################
|
||||
|
@ -25,6 +24,8 @@ cmake_minimum_required(VERSION 2.6)
|
|||
project(gr-osmosdr CXX C)
|
||||
enable_testing()
|
||||
|
||||
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules)
|
||||
|
||||
#select the release build type by default to get optimization flags
|
||||
if(NOT CMAKE_BUILD_TYPE)
|
||||
set(CMAKE_BUILD_TYPE "Release")
|
||||
|
@ -32,22 +33,44 @@ if(NOT CMAKE_BUILD_TYPE)
|
|||
endif(NOT CMAKE_BUILD_TYPE)
|
||||
set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "")
|
||||
|
||||
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules)
|
||||
# Set the version information here
|
||||
set(VERSION_INFO_MAJOR_VERSION 0)
|
||||
set(VERSION_INFO_API_COMPAT 0)
|
||||
set(VERSION_INFO_MINOR_VERSION 1)
|
||||
set(VERSION_INFO_MAINT_VERSION git)
|
||||
include(GrVersion) #setup version info
|
||||
|
||||
########################################################################
|
||||
# Compiler specific setup
|
||||
########################################################################
|
||||
if(CMAKE_COMPILER_IS_GNUCXX AND NOT WIN32)
|
||||
#http://gcc.gnu.org/wiki/Visibility
|
||||
add_definitions(-fvisibility=hidden)
|
||||
endif()
|
||||
IF(CMAKE_COMPILER_IS_GNUCXX)
|
||||
ADD_DEFINITIONS(-Wall)
|
||||
ADD_DEFINITIONS(-Wextra)
|
||||
ADD_DEFINITIONS(-Wno-unused)
|
||||
ADD_DEFINITIONS(-Wsign-compare)
|
||||
#ADD_DEFINITIONS(-Wconversion)
|
||||
#ADD_DEFINITIONS(-pedantic)
|
||||
#ADD_DEFINITIONS(-ansi)
|
||||
IF(NOT WIN32)
|
||||
#only export symbols that are declared to be part of the api (non dll platforms)
|
||||
ADD_DEFINITIONS(-fvisibility=hidden)
|
||||
ADD_DEFINITIONS(-fvisibility-inlines-hidden)
|
||||
ENDIF(NOT WIN32)
|
||||
ENDIF(CMAKE_COMPILER_IS_GNUCXX)
|
||||
|
||||
########################################################################
|
||||
# Find boost
|
||||
# Setup boost
|
||||
########################################################################
|
||||
MESSAGE(STATUS "Configuring Boost C++ Libraries...")
|
||||
|
||||
SET(BOOST_REQUIRED_COMPONENTS
|
||||
thread
|
||||
)
|
||||
|
||||
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.35.0" "1.35" "1.36.0" "1.36" "1.37.0" "1.37" "1.38.0" "1.38" "1.39.0" "1.39"
|
||||
"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"
|
||||
|
@ -57,7 +80,7 @@ set(Boost_ADDITIONAL_VERSIONS
|
|||
"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.35 COMPONENTS thread )
|
||||
find_package(Boost 1.35 COMPONENTS ${BOOST_REQUIRED_COMPONENTS})
|
||||
|
||||
if(NOT Boost_FOUND)
|
||||
message(FATAL_ERROR "Boost required to compile osmosdr")
|
||||
|
@ -85,7 +108,9 @@ set(GRC_BLOCKS_DIR ${GR_PKG_DATA_DIR}/grc/blocks)
|
|||
########################################################################
|
||||
find_package(Gruel)
|
||||
find_package(GnuradioCore)
|
||||
#find_package(GnuradioAudio)
|
||||
find_package(GnuradioAudio)
|
||||
find_package(GnuradioUHD)
|
||||
find_package(GnuradioFCD)
|
||||
#find_package(LibUSB)
|
||||
find_package(LibRTLSDR)
|
||||
|
||||
|
@ -97,18 +122,14 @@ if(NOT GNURADIO_CORE_FOUND)
|
|||
message(FATAL_ERROR "GnuRadio Core required to compile osmosdr")
|
||||
endif()
|
||||
|
||||
#if(NOT GNURADIO_AUDIO_FOUND)
|
||||
# message(FATAL_ERROR "GnuRadio Audio required to compile osmosdr")
|
||||
#endif()
|
||||
if(NOT GNURADIO_AUDIO_FOUND)
|
||||
message(FATAL_ERROR "GnuRadio Audio required to compile osmosdr")
|
||||
endif()
|
||||
|
||||
#if(NOT LIBUSB_FOUND)
|
||||
# message(FATAL_ERROR "LibUSB 1.0 required to compile osmosdr")
|
||||
#endif()
|
||||
|
||||
if(NOT LIBRTLSDR_FOUND)
|
||||
message(FATAL_ERROR "LibRTLSDR required to compile osmosdr")
|
||||
endif()
|
||||
|
||||
########################################################################
|
||||
# Setup the include and linker paths
|
||||
########################################################################
|
||||
|
@ -119,7 +140,6 @@ include_directories(
|
|||
${GRUEL_INCLUDE_DIRS}
|
||||
${GNURADIO_CORE_INCLUDE_DIRS}
|
||||
# ${LIBUSB_INCLUDE_DIR}
|
||||
${LIBRTLSDR_INCLUDE_DIR}
|
||||
)
|
||||
|
||||
link_directories(
|
||||
|
@ -127,7 +147,6 @@ link_directories(
|
|||
${GRUEL_LIBRARY_DIRS}
|
||||
${GNURADIO_CORE_LIBRARY_DIRS}
|
||||
# ${LIBUSB_LIBRARY_DIRS}
|
||||
${LIBRTLSDR_LIBRARIES}
|
||||
)
|
||||
|
||||
# Set component parameters
|
||||
|
@ -156,3 +175,42 @@ add_subdirectory(python)
|
|||
add_subdirectory(grc)
|
||||
add_subdirectory(apps)
|
||||
add_subdirectory(docs)
|
||||
|
||||
########################################################################
|
||||
# Create Pkg Config File
|
||||
########################################################################
|
||||
FOREACH(inc ${Boost_INCLUDE_DIRS})
|
||||
LIST(APPEND GR_OSMOSDR_PC_CFLAGS "-I${inc}")
|
||||
ENDFOREACH(inc)
|
||||
|
||||
FOREACH(lib ${Boost_LIBRARY_DIRS})
|
||||
LIST(APPEND GR_OSMOSDR_PC_LIBS "-L${lib}")
|
||||
ENDFOREACH(lib)
|
||||
|
||||
# use space-separation format for the pc file
|
||||
STRING(REPLACE ";" " " GR_OSMOSDR_PC_REQUIRES "${GR_OSMOSDR_PC_REQUIRES}")
|
||||
STRING(REPLACE ";" " " GR_OSMOSDR_PC_CFLAGS "${GR_OSMOSDR_PC_CFLAGS}")
|
||||
STRING(REPLACE ";" " " GR_OSMOSDR_PC_LIBS "${GR_OSMOSDR_PC_LIBS}")
|
||||
|
||||
# unset these vars to avoid hard-coded paths to cross environment
|
||||
IF(CMAKE_CROSSCOMPILING)
|
||||
UNSET(GR_OSMOSDR_PC_CFLAGS)
|
||||
UNSET(GR_OSMOSDR_PC_LIBS)
|
||||
ENDIF(CMAKE_CROSSCOMPILING)
|
||||
|
||||
CONFIGURE_FILE(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/gnuradio-osmosdr.pc.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/gnuradio-osmosdr.pc
|
||||
@ONLY)
|
||||
|
||||
INSTALL(
|
||||
FILES ${CMAKE_CURRENT_BINARY_DIR}/gnuradio-osmosdr.pc
|
||||
DESTINATION ${GR_LIBRARY_DIR}/pkgconfig
|
||||
)
|
||||
|
||||
########################################################################
|
||||
# Print Summary
|
||||
########################################################################
|
||||
GR_PRINT_COMPONENT_SUMMARY()
|
||||
MESSAGE(STATUS "Building for version: ${VERSION} / ${LIBVER}")
|
||||
MESSAGE(STATUS "Using install prefix: ${CMAKE_INSTALL_PREFIX}")
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
INCLUDE(FindPkgConfig)
|
||||
PKG_CHECK_MODULES(PC_GNURADIO_FCD gnuradio-fcd)
|
||||
|
||||
FIND_PATH(
|
||||
GNURADIO_FCD_INCLUDE_DIRS
|
||||
NAMES fcd_api.h
|
||||
HINTS $ENV{GNURADIO_FCD_DIR}/include/gnuradio/fcd
|
||||
${PC_GNURADIO_FCD_INCLUDEDIR}
|
||||
PATHS /usr/local/include/gnuradio
|
||||
/usr/include/gnuradio
|
||||
)
|
||||
|
||||
FIND_LIBRARY(
|
||||
GNURADIO_FCD_LIBRARIES
|
||||
NAMES gnuradio-fcd
|
||||
HINTS $ENV{GNURADIO_FCD_DIR}/lib
|
||||
${PC_GNURADIO_FCD_LIBDIR}
|
||||
PATHS /usr/local/lib
|
||||
/usr/local/lib64
|
||||
/usr/lib
|
||||
/usr/lib64
|
||||
)
|
||||
|
||||
if(GNURADIO_FCD_INCLUDE_DIRS AND GNURADIO_FCD_LIBRARIES)
|
||||
set(GNURADIO_FCD_FOUND TRUE CACHE INTERNAL "gnuradio-fcd found")
|
||||
message(STATUS "Found gnuradio-fcd: ${GNURADIO_FCD_INCLUDE_DIRS}, ${GNURADIO_FCD_LIBRARIES}")
|
||||
else(GNURADIO_FCD_INCLUDE_DIRS AND GNURADIO_FCD_LIBRARIES)
|
||||
set(GNURADIO_FCD_FOUND FALSE CACHE INTERNAL "gnuradio-fcd found")
|
||||
message(STATUS "gnuradio-fcd not found.")
|
||||
endif(GNURADIO_FCD_INCLUDE_DIRS AND GNURADIO_FCD_LIBRARIES)
|
||||
|
||||
INCLUDE(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GNURADIO_FCD DEFAULT_MSG GNURADIO_FCD_LIBRARIES GNURADIO_FCD_INCLUDE_DIRS)
|
||||
MARK_AS_ADVANCED(GNURADIO_FCD_LIBRARIES GNURADIO_FCD_INCLUDE_DIRS)
|
|
@ -0,0 +1,34 @@
|
|||
INCLUDE(FindPkgConfig)
|
||||
PKG_CHECK_MODULES(PC_GNURADIO_UHD gnuradio-uhd)
|
||||
|
||||
FIND_PATH(
|
||||
GNURADIO_UHD_INCLUDE_DIRS
|
||||
NAMES gr_uhd_api.h
|
||||
HINTS $ENV{GNURADIO_UHD_DIR}/include/gnuradio
|
||||
${PC_GNURADIO_UHD_INCLUDEDIR}
|
||||
PATHS /usr/local/include/gnuradio
|
||||
/usr/include/gnuradio
|
||||
)
|
||||
|
||||
FIND_LIBRARY(
|
||||
GNURADIO_UHD_LIBRARIES
|
||||
NAMES gnuradio-uhd
|
||||
HINTS $ENV{GNURADIO_UHD_DIR}/lib
|
||||
${PC_GNURADIO_UHD_LIBDIR}
|
||||
PATHS /usr/local/lib
|
||||
/usr/local/lib64
|
||||
/usr/lib
|
||||
/usr/lib64
|
||||
)
|
||||
|
||||
if(GNURADIO_UHD_INCLUDE_DIRS AND GNURADIO_UHD_LIBRARIES)
|
||||
set(GNURADIO_UHD_FOUND TRUE CACHE INTERNAL "gnuradio-uhd found")
|
||||
message(STATUS "Found gnuradio-uhd: ${GNURADIO_UHD_INCLUDE_DIRS}, ${GNURADIO_UHD_LIBRARIES}")
|
||||
else(GNURADIO_UHD_INCLUDE_DIRS AND GNURADIO_UHD_LIBRARIES)
|
||||
set(GNURADIO_UHD_FOUND FALSE CACHE INTERNAL "gnuradio-uhd found")
|
||||
message(STATUS "gnuradio-uhd not found.")
|
||||
endif(GNURADIO_UHD_INCLUDE_DIRS AND GNURADIO_UHD_LIBRARIES)
|
||||
|
||||
INCLUDE(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GNURADIO_UHD DEFAULT_MSG GNURADIO_UHD_LIBRARIES GNURADIO_UHD_INCLUDE_DIRS)
|
||||
MARK_AS_ADVANCED(GNURADIO_UHD_LIBRARIES GNURADIO_UHD_INCLUDE_DIRS)
|
|
@ -0,0 +1,115 @@
|
|||
# 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.
|
||||
|
||||
if(DEFINED __INCLUDED_GR_COMPONENT_CMAKE)
|
||||
return()
|
||||
endif()
|
||||
set(__INCLUDED_GR_COMPONENT_CMAKE TRUE)
|
||||
|
||||
set(_gr_enabled_components "" CACHE INTERNAL "" FORCE)
|
||||
set(_gr_disabled_components "" CACHE INTERNAL "" FORCE)
|
||||
|
||||
if(NOT DEFINED ENABLE_DEFAULT)
|
||||
set(ENABLE_DEFAULT ON)
|
||||
message(STATUS "")
|
||||
message(STATUS "The build system will automatically enable all components.")
|
||||
message(STATUS "Use -DENABLE_DEFAULT=OFF to disable components by default.")
|
||||
endif()
|
||||
|
||||
########################################################################
|
||||
# Register a component into the system
|
||||
# - name: canonical component name
|
||||
# - var: variable for enabled status
|
||||
# - argn: list of dependencies
|
||||
########################################################################
|
||||
function(GR_REGISTER_COMPONENT name var)
|
||||
include(CMakeDependentOption)
|
||||
message(STATUS "")
|
||||
message(STATUS "Configuring ${name} support...")
|
||||
foreach(dep ${ARGN})
|
||||
message(STATUS " Dependency ${dep} = ${${dep}}")
|
||||
endforeach(dep)
|
||||
|
||||
#if the user set the var to force, we note this
|
||||
if("${${var}}" STREQUAL "FORCE")
|
||||
set(${var} ON)
|
||||
set(var_force TRUE)
|
||||
else()
|
||||
set(var_force FALSE)
|
||||
endif()
|
||||
|
||||
#rewrite the dependency list so that deps that are also components use the cached version
|
||||
unset(comp_deps)
|
||||
foreach(dep ${ARGN})
|
||||
list(FIND _gr_enabled_components ${dep} dep_enb_index)
|
||||
list(FIND _gr_disabled_components ${dep} dep_dis_index)
|
||||
if (${dep_enb_index} EQUAL -1 AND ${dep_dis_index} EQUAL -1)
|
||||
list(APPEND comp_deps ${dep})
|
||||
else()
|
||||
list(APPEND comp_deps ${dep}_cached) #is a component, use cached version
|
||||
endif()
|
||||
endforeach(dep)
|
||||
|
||||
#setup the dependent option for this component
|
||||
CMAKE_DEPENDENT_OPTION(${var} "enable ${name} support" ${ENABLE_DEFAULT} "${comp_deps}" OFF)
|
||||
set(${var} "${${var}}" PARENT_SCOPE)
|
||||
set(${var}_cached "${${var}}" CACHE INTERNAL "" FORCE)
|
||||
|
||||
#force was specified, but the dependencies were not met
|
||||
if(NOT ${var} AND var_force)
|
||||
message(FATAL_ERROR "user force-enabled ${name} but configuration checked failed")
|
||||
endif()
|
||||
|
||||
#append the component into one of the lists
|
||||
if(${var})
|
||||
message(STATUS " Enabling ${name} support.")
|
||||
list(APPEND _gr_enabled_components ${name})
|
||||
else(${var})
|
||||
message(STATUS " Disabling ${name} support.")
|
||||
list(APPEND _gr_disabled_components ${name})
|
||||
endif(${var})
|
||||
message(STATUS " Override with -D${var}=ON/OFF")
|
||||
|
||||
#make components lists into global variables
|
||||
set(_gr_enabled_components ${_gr_enabled_components} CACHE INTERNAL "" FORCE)
|
||||
set(_gr_disabled_components ${_gr_disabled_components} CACHE INTERNAL "" FORCE)
|
||||
endfunction(GR_REGISTER_COMPONENT)
|
||||
|
||||
########################################################################
|
||||
# Print the registered component summary
|
||||
########################################################################
|
||||
function(GR_PRINT_COMPONENT_SUMMARY)
|
||||
message(STATUS "")
|
||||
message(STATUS "######################################################")
|
||||
message(STATUS "# gr-osmosdr enabled components ")
|
||||
message(STATUS "######################################################")
|
||||
foreach(comp ${_gr_enabled_components})
|
||||
message(STATUS " * ${comp}")
|
||||
endforeach(comp)
|
||||
|
||||
message(STATUS "")
|
||||
message(STATUS "######################################################")
|
||||
message(STATUS "# gr-osmosdr disabled components ")
|
||||
message(STATUS "######################################################")
|
||||
foreach(comp ${_gr_disabled_components})
|
||||
message(STATUS " * ${comp}")
|
||||
endforeach(comp)
|
||||
|
||||
message(STATUS "")
|
||||
endfunction(GR_PRINT_COMPONENT_SUMMARY)
|
|
@ -0,0 +1,76 @@
|
|||
# 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.
|
||||
|
||||
if(DEFINED __INCLUDED_GR_VERSION_CMAKE)
|
||||
return()
|
||||
endif()
|
||||
set(__INCLUDED_GR_VERSION_CMAKE TRUE)
|
||||
|
||||
#eventually, replace version.sh and fill in the variables below
|
||||
set(MAJOR_VERSION ${VERSION_INFO_MAJOR_VERSION})
|
||||
set(API_COMPAT ${VERSION_INFO_API_COMPAT})
|
||||
set(MINOR_VERSION ${VERSION_INFO_MINOR_VERSION})
|
||||
set(MAINT_VERSION ${VERSION_INFO_MAINT_VERSION})
|
||||
|
||||
########################################################################
|
||||
# Extract the version string from git describe.
|
||||
########################################################################
|
||||
find_package(Git)
|
||||
|
||||
if(GIT_FOUND AND EXISTS ${CMAKE_SOURCE_DIR}/.git)
|
||||
message(STATUS "Extracting version information from git describe...")
|
||||
execute_process(
|
||||
COMMAND ${GIT_EXECUTABLE} describe --always --abbrev=8 --long
|
||||
OUTPUT_VARIABLE GIT_DESCRIBE OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
)
|
||||
else()
|
||||
set(GIT_DESCRIBE "v${MAJOR_VERSION}.${API_COMPAT}.x-xxx-xunknown")
|
||||
endif()
|
||||
|
||||
########################################################################
|
||||
# Use the logic below to set the version constants
|
||||
########################################################################
|
||||
if("${MINOR_VERSION}" STREQUAL "git")
|
||||
# VERSION: 3.6git-xxx-gxxxxxxxx
|
||||
# DOCVER: 3.6git
|
||||
# LIBVER: 3.6git
|
||||
set(VERSION "${GIT_DESCRIBE}")
|
||||
set(DOCVER "${MAJOR_VERSION}.${API_COMPAT}${MINOR_VERSION}")
|
||||
set(LIBVER "${MAJOR_VERSION}.${API_COMPAT}${MINOR_VERSION}")
|
||||
elseif("${MAINT_VERSION}" STREQUAL "git")
|
||||
# VERSION: 3.6.1git-xxx-gxxxxxxxx
|
||||
# DOCVER: 3.6.1git
|
||||
# LIBVER: 3.6.1git
|
||||
set(VERSION "${GIT_DESCRIBE}")
|
||||
set(DOCVER "${MAJOR_VERSION}.${API_COMPAT}.${MINOR_VERSION}${MAINT_VERSION}")
|
||||
set(LIBVER "${MAJOR_VERSION}.${API_COMPAT}.${MINOR_VERSION}${MAINT_VERSION}")
|
||||
else()
|
||||
# This is a numbered release.
|
||||
# VERSION: 3.6.1{.x}
|
||||
# DOCVER: 3.6.1{.x}
|
||||
# LIBVER: 3.6.1{.x}
|
||||
if("${MAINT_VERSION}" STREQUAL "0")
|
||||
set(VERSION "${MAJOR_VERSION}.${API_COMPAT}.${MINOR_VERSION}")
|
||||
else()
|
||||
set(VERSION "${MAJOR_VERSION}.${API_COMPAT}.${MINOR_VERSION}.${MAINT_VERSION}")
|
||||
endif()
|
||||
set(DOCVER "${VERSION}")
|
||||
set(LIBVER "${VERSION}")
|
||||
endif()
|
|
@ -0,0 +1,15 @@
|
|||
prefix=@CMAKE_INSTALL_PREFIX@
|
||||
exec_prefix=${prefix}
|
||||
libdir=${exec_prefix}/@LIBRARY_DIR@
|
||||
includedir=${prefix}/@INCLUDE_DIR@
|
||||
|
||||
Name: @CPACK_PACKAGE_NAME@
|
||||
Description: @CPACK_PACKAGE_DESCRIPTION_SUMMARY@
|
||||
URL: http://sdr.osmocom.org/trac/
|
||||
Version: @CPACK_PACKAGE_VERSION@
|
||||
Requires:
|
||||
Requires.private: @GR_OSMOSDR_PC_REQUIRES@
|
||||
Conflicts:
|
||||
Cflags: -I${includedir} @GR_OSMOSDR_PC_CFLAGS@
|
||||
Libs: -L${libdir} -lgnuradio-osmosdr
|
||||
Libs.private: @GR_OSMOSDR_PC_LIBS@
|
|
@ -20,38 +20,99 @@
|
|||
########################################################################
|
||||
# Setup library
|
||||
########################################################################
|
||||
include(GrPlatform) #define LIB_SUFFIX
|
||||
INCLUDE(GrPlatform) #define LIB_SUFFIX
|
||||
INCLUDE(GrMiscUtils)
|
||||
|
||||
add_library(gnuradio-osmosdr SHARED
|
||||
osmosdr_ranges.cc
|
||||
osmosdr_sink_c_impl.cc
|
||||
########################################################################
|
||||
# Helpful Macros
|
||||
########################################################################
|
||||
MACRO(GR_OSMOSDR_APPEND_SRCS)
|
||||
LIST(APPEND gr_osmosdr_srcs ${ARGV})
|
||||
ENDMACRO(GR_OSMOSDR_APPEND_SRCS)
|
||||
|
||||
MACRO(GR_OSMOSDR_APPEND_LIBS)
|
||||
LIST(APPEND gr_osmosdr_libs ${ARGV})
|
||||
ENDMACRO(GR_OSMOSDR_APPEND_LIBS)
|
||||
|
||||
GR_OSMOSDR_APPEND_SRCS(
|
||||
osmosdr_source_c_impl.cc
|
||||
rtl_source_c.cc
|
||||
osmosdr_sink_c_impl.cc
|
||||
osmosdr_ranges.cc
|
||||
)
|
||||
|
||||
target_link_libraries(gnuradio-osmosdr
|
||||
GR_OSMOSDR_APPEND_LIBS(
|
||||
${Boost_LIBRARIES}
|
||||
${GRUEL_LIBRARIES}
|
||||
${GNURADIO_CORE_LIBRARIES}
|
||||
# ${GNURADIO_AUDIO_LIBRARIES}
|
||||
${LIBRTLSDR_LIBRARIES}
|
||||
)
|
||||
|
||||
set_target_properties(gnuradio-osmosdr PROPERTIES DEFINE_SYMBOL "gnuradio_osmosdr_EXPORTS")
|
||||
########################################################################
|
||||
# Setup OsmoSDR component
|
||||
########################################################################
|
||||
include(GrComponent)
|
||||
GR_REGISTER_COMPONENT("Sysmocom OsmoSDR" ENABLE_OSMOSDR)
|
||||
|
||||
if(ENABLE_OSMOSDR)
|
||||
GR_INCLUDE_SUBDIRECTORY(osmosdr)
|
||||
endif(ENABLE_OSMOSDR)
|
||||
|
||||
########################################################################
|
||||
# Install built library files
|
||||
# Setup FCD component
|
||||
########################################################################
|
||||
install(TARGETS gnuradio-osmosdr
|
||||
include(GrComponent)
|
||||
GR_REGISTER_COMPONENT("FunCube Dongle" ENABLE_FCD GNURADIO_FCD_FOUND)
|
||||
|
||||
if(ENABLE_FCD)
|
||||
GR_INCLUDE_SUBDIRECTORY(fcd)
|
||||
endif(ENABLE_FCD)
|
||||
|
||||
########################################################################
|
||||
# Setup RTL component
|
||||
########################################################################
|
||||
include(GrComponent)
|
||||
GR_REGISTER_COMPONENT("Osmocom RTLSDR" ENABLE_RTL LIBRTLSDR_FOUND)
|
||||
|
||||
if(ENABLE_RTL)
|
||||
GR_INCLUDE_SUBDIRECTORY(rtl)
|
||||
endif(ENABLE_RTL)
|
||||
|
||||
########################################################################
|
||||
# Setup UHD component
|
||||
########################################################################
|
||||
include(GrComponent)
|
||||
GR_REGISTER_COMPONENT("Ettus UHD" ENABLE_UHD GNURADIO_UHD_FOUND)
|
||||
|
||||
if(ENABLE_UHD)
|
||||
GR_INCLUDE_SUBDIRECTORY(uhd)
|
||||
endif(ENABLE_UHD)
|
||||
|
||||
########################################################################
|
||||
# Setup configuration file
|
||||
########################################################################
|
||||
ADD_DEFINITIONS(-DHAVE_CONFIG_H=1)
|
||||
include_directories(APPEND ${CMAKE_CURRENT_BINARY_DIR})
|
||||
CONFIGURE_FILE(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/config.h.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/config.h
|
||||
@ONLY)
|
||||
|
||||
########################################################################
|
||||
# Setup libgnuradio-osmosdr library
|
||||
########################################################################
|
||||
ADD_LIBRARY(gnuradio-osmosdr SHARED ${gr_osmosdr_srcs})
|
||||
TARGET_LINK_LIBRARIES(gnuradio-osmosdr ${gr_osmosdr_libs})
|
||||
SET_TARGET_PROPERTIES(gnuradio-osmosdr PROPERTIES DEFINE_SYMBOL "gnuradio_osmosdr_EXPORTS")
|
||||
SET_TARGET_PROPERTIES(gnuradio-osmosdr PROPERTIES SOVERSION "${MAJOR_VERSION}")
|
||||
SET_TARGET_PROPERTIES(gnuradio-osmosdr PROPERTIES VERSION "${MAJOR_VERSION}.${MINOR_VERSION}")
|
||||
IF(DEFINED GR_OSMOSDR_OUTPUT_NAME)
|
||||
SET_TARGET_PROPERTIES(uhd PROPERTIES OUTPUT_NAME ${GR_OSMOSDR_OUTPUT_NAME})
|
||||
ENDIF(DEFINED GR_OSMOSDR_OUTPUT_NAME)
|
||||
|
||||
########################################################################
|
||||
# Install libgnuradio-osmosdr library
|
||||
########################################################################
|
||||
INSTALL(TARGETS gnuradio-osmosdr
|
||||
LIBRARY DESTINATION lib${LIB_SUFFIX} # .so/.dylib file
|
||||
ARCHIVE DESTINATION lib${LIB_SUFFIX} # .lib file
|
||||
RUNTIME DESTINATION bin # .dll file
|
||||
)
|
||||
|
||||
########################################################################
|
||||
# Add subdirectories
|
||||
########################################################################
|
||||
#add_subdirectory(fcd)
|
||||
#add_subdirectory(osmosdr)
|
||||
#add_subdirectory(rtl)
|
||||
#add_subdirectory(uhd)
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
#ifndef CONFIG_H_IN
|
||||
#define CONFIG_H_IN
|
||||
|
||||
#cmakedefine ENABLE_OSMOSDR
|
||||
#cmakedefine ENABLE_FCD
|
||||
#cmakedefine ENABLE_RTL
|
||||
#cmakedefine ENABLE_UHD
|
||||
|
||||
#endif // CONFIG_H_IN
|
Loading…
Reference in New Issue