cmake updates
This commit is contained in:
@@ -0,0 +1,138 @@
|
|||||||
|
# CMAKE_PARSE_ARGUMENTS(<prefix> <options> <one_value_keywords> <multi_value_keywords> args...)
|
||||||
|
#
|
||||||
|
# CMAKE_PARSE_ARGUMENTS() is intended to be used in macros or functions for
|
||||||
|
# parsing the arguments given to that macro or function.
|
||||||
|
# It processes the arguments and defines a set of variables which hold the
|
||||||
|
# values of the respective options.
|
||||||
|
#
|
||||||
|
# The <options> argument contains all options for the respective macro,
|
||||||
|
# i.e. keywords which can be used when calling the macro without any value
|
||||||
|
# following, like e.g. the OPTIONAL keyword of the install() command.
|
||||||
|
#
|
||||||
|
# The <one_value_keywords> argument contains all keywords for this macro
|
||||||
|
# which are followed by one value, like e.g. DESTINATION keyword of the
|
||||||
|
# install() command.
|
||||||
|
#
|
||||||
|
# The <multi_value_keywords> argument contains all keywords for this macro
|
||||||
|
# which can be followed by more than one value, like e.g. the TARGETS or
|
||||||
|
# FILES keywords of the install() command.
|
||||||
|
#
|
||||||
|
# When done, CMAKE_PARSE_ARGUMENTS() will have defined for each of the
|
||||||
|
# keywords listed in <options>, <one_value_keywords> and
|
||||||
|
# <multi_value_keywords> a variable composed of the given <prefix>
|
||||||
|
# followed by "_" and the name of the respective keyword.
|
||||||
|
# These variables will then hold the respective value from the argument list.
|
||||||
|
# For the <options> keywords this will be TRUE or FALSE.
|
||||||
|
#
|
||||||
|
# All remaining arguments are collected in a variable
|
||||||
|
# <prefix>_UNPARSED_ARGUMENTS, this can be checked afterwards to see whether
|
||||||
|
# your macro was called with unrecognized parameters.
|
||||||
|
#
|
||||||
|
# As an example here a my_install() macro, which takes similar arguments as the
|
||||||
|
# real install() command:
|
||||||
|
#
|
||||||
|
# function(MY_INSTALL)
|
||||||
|
# set(options OPTIONAL FAST)
|
||||||
|
# set(oneValueArgs DESTINATION RENAME)
|
||||||
|
# set(multiValueArgs TARGETS CONFIGURATIONS)
|
||||||
|
# cmake_parse_arguments(MY_INSTALL "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
|
||||||
|
# ...
|
||||||
|
#
|
||||||
|
# Assume my_install() has been called like this:
|
||||||
|
# my_install(TARGETS foo bar DESTINATION bin OPTIONAL blub)
|
||||||
|
#
|
||||||
|
# After the cmake_parse_arguments() call the macro will have set the following
|
||||||
|
# variables:
|
||||||
|
# MY_INSTALL_OPTIONAL = TRUE
|
||||||
|
# MY_INSTALL_FAST = FALSE (this option was not used when calling my_install()
|
||||||
|
# MY_INSTALL_DESTINATION = "bin"
|
||||||
|
# MY_INSTALL_RENAME = "" (was not used)
|
||||||
|
# MY_INSTALL_TARGETS = "foo;bar"
|
||||||
|
# MY_INSTALL_CONFIGURATIONS = "" (was not used)
|
||||||
|
# MY_INSTALL_UNPARSED_ARGUMENTS = "blub" (no value expected after "OPTIONAL"
|
||||||
|
#
|
||||||
|
# You can the continue and process these variables.
|
||||||
|
#
|
||||||
|
# Keywords terminate lists of values, e.g. if directly after a one_value_keyword
|
||||||
|
# another recognized keyword follows, this is interpreted as the beginning of
|
||||||
|
# the new option.
|
||||||
|
# E.g. my_install(TARGETS foo DESTINATION OPTIONAL) would result in
|
||||||
|
# MY_INSTALL_DESTINATION set to "OPTIONAL", but MY_INSTALL_DESTINATION would
|
||||||
|
# be empty and MY_INSTALL_OPTIONAL would be set to TRUE therefore.
|
||||||
|
|
||||||
|
#=============================================================================
|
||||||
|
# Copyright 2010 Alexander Neundorf <neundorf@kde.org>
|
||||||
|
#
|
||||||
|
# Distributed under the OSI-approved BSD License (the "License");
|
||||||
|
# see accompanying file Copyright.txt for details.
|
||||||
|
#
|
||||||
|
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
||||||
|
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
# See the License for more information.
|
||||||
|
#=============================================================================
|
||||||
|
# (To distribute this file outside of CMake, substitute the full
|
||||||
|
# License text for the above reference.)
|
||||||
|
|
||||||
|
|
||||||
|
if(__CMAKE_PARSE_ARGUMENTS_INCLUDED)
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
set(__CMAKE_PARSE_ARGUMENTS_INCLUDED TRUE)
|
||||||
|
|
||||||
|
|
||||||
|
function(CMAKE_PARSE_ARGUMENTS prefix _optionNames _singleArgNames _multiArgNames)
|
||||||
|
# first set all result variables to empty/FALSE
|
||||||
|
foreach(arg_name ${_singleArgNames} ${_multiArgNames})
|
||||||
|
set(${prefix}_${arg_name})
|
||||||
|
endforeach(arg_name)
|
||||||
|
|
||||||
|
foreach(option ${_optionNames})
|
||||||
|
set(${prefix}_${option} FALSE)
|
||||||
|
endforeach(option)
|
||||||
|
|
||||||
|
set(${prefix}_UNPARSED_ARGUMENTS)
|
||||||
|
|
||||||
|
set(insideValues FALSE)
|
||||||
|
set(currentArgName)
|
||||||
|
|
||||||
|
# now iterate over all arguments and fill the result variables
|
||||||
|
foreach(currentArg ${ARGN})
|
||||||
|
list(FIND _optionNames "${currentArg}" optionIndex) # ... then this marks the end of the arguments belonging to this keyword
|
||||||
|
list(FIND _singleArgNames "${currentArg}" singleArgIndex) # ... then this marks the end of the arguments belonging to this keyword
|
||||||
|
list(FIND _multiArgNames "${currentArg}" multiArgIndex) # ... then this marks the end of the arguments belonging to this keyword
|
||||||
|
|
||||||
|
if(${optionIndex} EQUAL -1 AND ${singleArgIndex} EQUAL -1 AND ${multiArgIndex} EQUAL -1)
|
||||||
|
if(insideValues)
|
||||||
|
if("${insideValues}" STREQUAL "SINGLE")
|
||||||
|
set(${prefix}_${currentArgName} ${currentArg})
|
||||||
|
set(insideValues FALSE)
|
||||||
|
elseif("${insideValues}" STREQUAL "MULTI")
|
||||||
|
list(APPEND ${prefix}_${currentArgName} ${currentArg})
|
||||||
|
endif()
|
||||||
|
else(insideValues)
|
||||||
|
list(APPEND ${prefix}_UNPARSED_ARGUMENTS ${currentArg})
|
||||||
|
endif(insideValues)
|
||||||
|
else()
|
||||||
|
if(NOT ${optionIndex} EQUAL -1)
|
||||||
|
set(${prefix}_${currentArg} TRUE)
|
||||||
|
set(insideValues FALSE)
|
||||||
|
elseif(NOT ${singleArgIndex} EQUAL -1)
|
||||||
|
set(currentArgName ${currentArg})
|
||||||
|
set(${prefix}_${currentArgName})
|
||||||
|
set(insideValues "SINGLE")
|
||||||
|
elseif(NOT ${multiArgIndex} EQUAL -1)
|
||||||
|
set(currentArgName ${currentArg})
|
||||||
|
set(${prefix}_${currentArgName})
|
||||||
|
set(insideValues "MULTI")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
endforeach(currentArg)
|
||||||
|
|
||||||
|
# propagate the result variables to the caller:
|
||||||
|
foreach(arg_name ${_singleArgNames} ${_multiArgNames} ${_optionNames})
|
||||||
|
set(${prefix}_${arg_name} ${${prefix}_${arg_name}} PARENT_SCOPE)
|
||||||
|
endforeach(arg_name)
|
||||||
|
set(${prefix}_UNPARSED_ARGUMENTS ${${prefix}_UNPARSED_ARGUMENTS} PARENT_SCOPE)
|
||||||
|
|
||||||
|
endfunction(CMAKE_PARSE_ARGUMENTS _options _singleArgs _multiArgs)
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
INCLUDE(FindPkgConfig)
|
||||||
|
PKG_CHECK_MODULES(PC_FOO foo)
|
||||||
|
|
||||||
|
FIND_PATH(
|
||||||
|
FOO_INCLUDE_DIRS
|
||||||
|
NAMES foo/api.h
|
||||||
|
HINTS $ENV{FOO_DIR}/include
|
||||||
|
${PC_FOO_INCLUDEDIR}
|
||||||
|
PATHS ${CMAKE_INSTALL_PREFIX}/include
|
||||||
|
/usr/local/include
|
||||||
|
/usr/include
|
||||||
|
)
|
||||||
|
|
||||||
|
FIND_LIBRARY(
|
||||||
|
FOO_LIBRARIES
|
||||||
|
NAMES gnuradio-foo
|
||||||
|
HINTS $ENV{FOO_DIR}/lib
|
||||||
|
${PC_FOO_LIBDIR}
|
||||||
|
PATHS ${CMAKE_INSTALL_PREFIX}/lib
|
||||||
|
${CMAKE_INSTALL_PREFIX}/lib64
|
||||||
|
/usr/local/lib
|
||||||
|
/usr/local/lib64
|
||||||
|
/usr/lib
|
||||||
|
/usr/lib64
|
||||||
|
)
|
||||||
|
|
||||||
|
include("${CMAKE_CURRENT_LIST_DIR}/fooTarget.cmake")
|
||||||
|
|
||||||
|
INCLUDE(FindPackageHandleStandardArgs)
|
||||||
|
FIND_PACKAGE_HANDLE_STANDARD_ARGS(FOO DEFAULT_MSG FOO_LIBRARIES FOO_INCLUDE_DIRS)
|
||||||
|
MARK_AS_ADVANCED(FOO_LIBRARIES FOO_INCLUDE_DIRS)
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
# Copyright 2018 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.
|
||||||
|
|
||||||
|
include(CMakeFindDependencyMacro)
|
||||||
|
|
||||||
|
set(target_deps "@TARGET_DEPENDENCIES@")
|
||||||
|
foreach(dep IN LISTS target_deps)
|
||||||
|
find_dependency(${dep})
|
||||||
|
endforeach()
|
||||||
|
include("${CMAKE_CURRENT_LIST_DIR}/@TARGET@Targets.cmake")
|
||||||
+15
-4
@@ -1,6 +1,6 @@
|
|||||||
# Copyright 2011 Free Software Foundation, Inc.
|
# Copyright 2011 Free Software Foundation, Inc.
|
||||||
#
|
#
|
||||||
# This file is part of GNU Radio
|
# This file is part of gr-foo
|
||||||
#
|
#
|
||||||
# GNU Radio is free software; you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -17,6 +17,17 @@
|
|||||||
# the Free Software Foundation, Inc., 51 Franklin Street,
|
# the Free Software Foundation, Inc., 51 Franklin Street,
|
||||||
# Boston, MA 02110-1301, USA.
|
# Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
file(GLOB xml_files "*.block.yml")
|
install(FILES
|
||||||
|
foo_burst_tagger.block.yml
|
||||||
install(FILES ${xml_files} DESTINATION share/gnuradio/grc/blocks )
|
foo_packet_pad2.block.yml
|
||||||
|
foo_random_periodic_msg_source.block.yml
|
||||||
|
foo_valve.block.yml
|
||||||
|
foo_channel_model.block.yml
|
||||||
|
foo_packet_pad.block.yml
|
||||||
|
foo_rtt_measure.block.yml
|
||||||
|
foo_wireshark_connector.block.yml
|
||||||
|
foo_packet_dropper.block.yml
|
||||||
|
foo_periodic_msg_source.block.yml
|
||||||
|
foo_selector.block.yml
|
||||||
|
DESTINATION share/gnuradio/grc/blocks
|
||||||
|
)
|
||||||
|
|||||||
+35
-6
@@ -1,6 +1,6 @@
|
|||||||
# Copyright 2011,2012 Free Software Foundation, Inc.
|
# Copyright 2011,2012 Free Software Foundation, Inc.
|
||||||
#
|
#
|
||||||
# This file is part of GNU Radio
|
# This file is part of gr-foo
|
||||||
#
|
#
|
||||||
# GNU Radio is free software; you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -43,16 +43,45 @@ list(APPEND foo_sources
|
|||||||
wireshark_connector_impl.cc
|
wireshark_connector_impl.cc
|
||||||
)
|
)
|
||||||
|
|
||||||
|
set(foo_sources "${foo_sources}" PARENT_SCOPE)
|
||||||
|
if(NOT foo_sources)
|
||||||
|
MESSAGE(STATUS "No C++ sources... skipping lib/")
|
||||||
|
return()
|
||||||
|
endif(NOT foo_sources)
|
||||||
|
|
||||||
add_library(gnuradio-foo SHARED ${foo_sources})
|
add_library(gnuradio-foo SHARED ${foo_sources})
|
||||||
target_link_libraries(gnuradio-foo ${Boost_LIBRARIES} ${GNURADIO_ALL_LIBRARIES} ${UHD_LIBRARIES})
|
target_link_libraries(gnuradio-foo gnuradio::gnuradio-runtime ${Boost_LIBRARIES} ${UHD_LIBRARIES})
|
||||||
|
target_include_directories(gnuradio-foo
|
||||||
|
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../include>
|
||||||
|
PUBLIC $<INSTALL_INTERFACE:include>
|
||||||
|
)
|
||||||
set_target_properties(gnuradio-foo PROPERTIES DEFINE_SYMBOL "gnuradio_foo_EXPORTS")
|
set_target_properties(gnuradio-foo PROPERTIES DEFINE_SYMBOL "gnuradio_foo_EXPORTS")
|
||||||
|
|
||||||
|
if(APPLE)
|
||||||
|
set_target_properties(gnuradio-foo PROPERTIES
|
||||||
|
INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib"
|
||||||
|
)
|
||||||
|
endif(APPLE)
|
||||||
|
|
||||||
########################################################################
|
########################################################################
|
||||||
# Install built library files
|
# Install built library files
|
||||||
########################################################################
|
########################################################################
|
||||||
install(TARGETS gnuradio-foo
|
include(GrMiscUtils)
|
||||||
LIBRARY DESTINATION lib${LIB_SUFFIX} # .so/.dylib file
|
GR_LIBRARY_FOO(gnuradio-foo)
|
||||||
ARCHIVE DESTINATION lib${LIB_SUFFIX} # .lib file
|
|
||||||
RUNTIME DESTINATION bin # .dll file
|
########################################################################
|
||||||
|
# Print summary
|
||||||
|
########################################################################
|
||||||
|
message(STATUS "Using install prefix: ${CMAKE_INSTALL_PREFIX}")
|
||||||
|
message(STATUS "Building for version: ${VERSION} / ${LIBVER}")
|
||||||
|
|
||||||
|
########################################################################
|
||||||
|
# Build and register unit test
|
||||||
|
########################################################################
|
||||||
|
include(GrTest)
|
||||||
|
|
||||||
|
# If your unit tests require special include paths, add them here
|
||||||
|
#include_directories()
|
||||||
|
# List all files that contain Boost.UTF unit tests here
|
||||||
|
list(APPEND test_foo_sources
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user