st/prober: Guard libudev usage

This commit is contained in:
Jakob Bornecrantz 2019-06-20 18:02:28 +01:00
parent 542208bd42
commit 7f07cee387
3 changed files with 15 additions and 7 deletions

View file

@ -7,24 +7,34 @@ include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/../../../external
)
set(PROBER_INCLUDES)
set(PROBER_SOURCE_FILES
p_auto_wrap.c
p_documentation.h
p_dump.c
p_prober.c
p_prober.h
p_udev.c
)
# Add libudev
if(BUILD_WITH_LIBUDEV)
list(APPEND PROBER_SOURCE_FILES
p_udev.c
)
list(APPEND PROBER_INCLUDES
${LIBUDEV_INCLUDES}
)
endif()
# Use OBJECT to not create a archive, since it just gets in the way.
add_library(st_prober OBJECT ${PROBER_SOURCE_FILES})
target_include_directories(st_prober
PRIVATE
${PROBER_INCLUDES}
${LIBUSB_INCLUDES}
${LIBUVC_INCLUDES}
${FFMPEG_INCLUDES}
${OPENCV_INCLUDES}
)
set_property(TARGET st_prober PROPERTY POSITION_INDEPENDENT_CODE ON)

View file

@ -465,11 +465,13 @@ probe(struct xrt_prober* xp)
return -1;
}
#ifdef XRT_HAVE_LIBUDEV
ret = p_udev_probe(p);
if (ret != 0) {
P_ERROR(p, "Failed to enumerate udev devices\n");
return -1;
}
#endif
return 0;
}

View file

@ -7,8 +7,6 @@
* @ingroup st_prober
*/
#ifdef XRT_HAVE_LIBUDEV
#include "util/u_misc.h"
#include "p_prober.h"
@ -341,5 +339,3 @@ p_udev_get_and_parse_uevent(struct udev_device* raw_dev,
return -1;
}
}
#endif