mirror of
https://github.com/EttusResearch/uhd.git
synced 2026-10-25 17:36:10 +00:00
extension: windows: Fixed linking extension example to uhd.lib
Symtom to observed Example of how to use a (new) feature/behavior
This commit is contained in:
parent
0d15d7670e
commit
8be6b24ae3
@ -14,17 +14,6 @@ example in the examples directory. It can be built by
|
||||
|
||||
Depending on your UHD installation prefix root privileges may be required for `make install`.
|
||||
|
||||
<b>Known issue</b>:
|
||||
When using the Python API with an extension installed, `import uhd` may throw an error:
|
||||
|
||||
`Error: EnvironmentError: OSError: dlopen failed to load "/path/to/libextension.so"`
|
||||
|
||||
If this occurs, please provide the LD_PRELOAD variable with the path to the uhdlib:
|
||||
|
||||
export LD_PRELOAD=[UHD_PREFIX]/lib/libuhd.so
|
||||
|
||||
Afterwards start Python again in the same commandline.
|
||||
|
||||
\section extension_capabilities Capabilities of the Extension Framework
|
||||
|
||||
The Extension Framework attaches to multi_usrp and will work for all RFNoC-capable devices.
|
||||
|
||||
@ -42,7 +42,7 @@ include(UHDBoost)
|
||||
|
||||
# need these include and link directories for the build
|
||||
include_directories(
|
||||
${CMAKE_SOURCE_DIR}/include
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/include
|
||||
${Boost_INCLUDE_DIRS}
|
||||
${UHD_INCLUDE_DIRS}
|
||||
)
|
||||
@ -55,16 +55,49 @@ list(APPEND extexample_sources
|
||||
)
|
||||
add_subdirectory(include)
|
||||
|
||||
message(STATUS "UHD Module Path (to which the extension will be linked):")
|
||||
message(STATUS ${UHD_MODULE_PATH})
|
||||
message(STATUS ${PROJECT_NAME} " linking against library found at:")
|
||||
message(STATUS " " ${UHD_LIB_PATH})
|
||||
|
||||
### Make the executable #######################################################
|
||||
add_library(extexample SHARED ${extexample_sources})
|
||||
|
||||
##set(CMAKE_BUILD_TYPE "Release")
|
||||
message(STATUS "******************************************************************************")
|
||||
message(STATUS "* NOTE: When building your own app, you probably need all kinds of different ")
|
||||
message(STATUS "* compiler flags. This is just an example, so it's unlikely these settings ")
|
||||
message(STATUS "* exactly match what you require. Make sure to double-check compiler and ")
|
||||
message(STATUS "* linker flags to make sure your specific requirements are included. ")
|
||||
message(STATUS "******************************************************************************")
|
||||
|
||||
# Shared library case: All we need to do is link against the library, and
|
||||
# anything else we need (in this case, some Boost libraries):
|
||||
if(NOT UHD_USE_STATIC_LIBS)
|
||||
message(STATUS "Linking against shared UHD library.")
|
||||
target_link_libraries(extexample ${UHD_LIBRARIES} ${Boost_LIBRARIES})
|
||||
# Shared library case: All we need to do is link against the library, and
|
||||
# anything else we need (in this case, some Boost libraries):
|
||||
else(NOT UHD_USE_STATIC_LIBS)
|
||||
message(STATUS "Linking against static UHD library.")
|
||||
target_link_libraries(extexample
|
||||
# We could use ${UHD_LIBRARIES}, but linking requires some extra flags,
|
||||
# so we use this convenience variable provided to us
|
||||
${UHD_STATIC_LIB_LINK_FLAG}
|
||||
# Also, when linking statically, we need to pull in all the deps for
|
||||
# UHD as well, because the dependencies don't get resolved automatically
|
||||
${UHD_STATIC_LIB_DEPS}
|
||||
)
|
||||
endif(NOT UHD_USE_STATIC_LIBS)
|
||||
|
||||
### Once it's built... ########################################################
|
||||
# Here, you have commands to install your program.
|
||||
|
||||
set(extension_target ${CMAKE_INSTALL_PREFIX}/lib/libextexample.so)
|
||||
if(UNIX)
|
||||
# On Linux OS install into folder and symlink to UHD_MODULE_PATH
|
||||
set(extension_target ${CMAKE_INSTALL_PREFIX}/lib/libextexample.so)
|
||||
install(TARGETS extexample DESTINATION lib)
|
||||
install(CODE "execute_process(COMMAND bash -c \"mkdir -p ${UHD_MODULE_PATH} && ln -s -f ${extension_target} -t ${UHD_MODULE_PATH}\")")
|
||||
else(UNIX)
|
||||
# on other OS (Windows) install into UHD_MODULE_PATH
|
||||
install(TARGETS extexample DESTINATION ${UHD_MODULE_PATH})
|
||||
endif(UNIX)
|
||||
|
||||
install(TARGETS extexample DESTINATION lib)
|
||||
install(CODE "execute_process(COMMAND bash -c \"mkdir -p ${UHD_MODULE_PATH} && ln -s -f ${extension_target} -t ${UHD_MODULE_PATH}\")")
|
||||
|
||||
Loading…
Reference in New Issue
Block a user