discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [EXTERNAL] Re: Using function from OOT in another OOT


From: Michael Dickens
Subject: Re: [EXTERNAL] Re: Using function from OOT in another OOT
Date: Tue, 5 Nov 2019 16:08:28 -0500

That CMake code reads nicely; a little more verbose than desirable, but whatever works as it's an OOT & not GR proper. You -might- be able to do "find_package(gnuradio-myoot)" ... might work or not depending on whether .cmake and/or .pc file were installed by the OOT.

Wouldn't it be nice if you could instead just do "find_package(gnuradio COMPONENTS runtime myoot)" and then various return variables would be set that you could use for the includes and linking? There's an open request for something like this from, I believe, Mait. I don't think it's made progress, but it's something I'd love to see! It would mean, of course, than you can have only 1 version of "myoot" installed at a time. IMHO a small price to pay for the convenience!

Food for thought... - MLD

On Tue, Nov 5, 2019 at 4:02 PM Morman, Joshua <address@hidden> wrote:

Michael,


Thank you for the response.  Here is what I ended up doing:


If I have gr-myoot that I want to reference from gr-anotheroot


In gr-anotheroot/cmake/modules, create FindMyoot.cmake, which should look something like:


########################################################

find_package(PkgConfig)
pkg_check_modules(PC_GNURADIO_RUNTIME gnuradio-runtime)

find_path(MYOOT_INCLUDE_DIR myoot/one_of_the_header_files.h
          HINTS ${PC_GNURADIO_RUNTIME_INCLUDEDIR} ${PC_GNURADIO_RUNTIME_INCLUDE_DIRS}
          PATH_SUFFIXES myoot )

find_library(MYOOT_LIBRARY NAMES gnuradio-myoot
             HINTS ${PC_GNURADIO_RUNTIME_LIBDIR} ${PC_GNURADIO_RUNTIME_LIBRARY_DIRS} )

include(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set MYOOT_FOUND to TRUE
# if all listed variables are TRUE
find_package_handle_standard_args(Myoot  DEFAULT_MSG
                                  MYOOT_LIBRARY MYOOT_INCLUDE_DIR)

mark_as_advanced(MYOOT_INCLUDE_DIR MYOOT_LIBRARY )

set(MYOOT_LIBRARIES ${MYOOT_LIBRARY} )
set(MYOOT_INCLUDE_DIRS ${MYOOT_INCLUDE_DIR} )
########################################################

I'm sure there are better ways to do this, but this did the trick quick and dirty.  It looks like some other oots have .pc files installed which help with the process, but that doesn't look to be standard.



Josh


From: Michael Dickens <address@hidden>
Sent: Tuesday, November 5, 2019 2:14 PM
To: Morman, Joshua
Cc: address@hidden
Subject: [EXTERNAL] Re: Using function from OOT in another OOT
 
Hi Josh - I don't think there's a standard way to do this. -Most- OOTs install cmake scripts that can be used to "find" them, if you can determine the correct "find" name (might be "gr-OOT" or just "OOT", where 'OOT' is the name of the OOT module). Once found, you can then use either the target or returned variables (OOT_INCLUDE_DIRS, OOT_LIBRARIES most likely) to find the API and link against the ABI. Nothing special, but generic enough that it should work on different OSs & GR installs. Hope this is useful! - MLD

On Tue, Nov 5, 2019 at 1:42 PM Morman, Joshua <address@hidden> wrote:

Is there a prescribed method for including functions from one OOT in another OOT (c++ code)?


I could probably figure out how to do it in cmake, but is there some magical cmake find functions that already exist for OOTs to set the INCLUDE and LIBRARY variables relative to the GR prefix installation?


Thanks,

Josh



--
Michael Dickens
Ettus Research Technical Support
Email: address@hidden
Web: https://ettus.com/ [ettus.com]


--
Michael Dickens
Ettus Research Technical Support
Email: address@hidden
Web: https://ettus.com/

reply via email to

[Prev in Thread] Current Thread [Next in Thread]