Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMake scripts cleanups #680

Merged
merged 8 commits into from
May 11, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion iio-config.h.cmakein
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
#cmakedefine01 WITH_NETWORK_EVENTFD
#cmakedefine01 WITH_IIOD_USBD
#cmakedefine01 WITH_LOCAL_CONFIG
#cmakedefine01 WITH_AIO
Copy link
Contributor

@nunojsa nunojsa May 6, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a comment which has noting to do with this... We should definitely consider about replacing aio for io_uring and liburing for libiio2 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I will definitely have a look at io_uring. I want to see if it can help us with zero-copy.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It has both ring buffers shared between kernel and userspace so that's something already in the right way... Another neat thing is that we can potential reduce a lot the number of syscalls.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But I assume the IIO subsystem needs to support it (does it?).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't think so. At least for normal reads/writes on sysfs stuff. Now for ioctl (not sure if that stuff was merged; and yes, it seems io_uring is also allowing to re-implement ioctl), the last time I checked I think IIO would have to support it...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://lwn.net/Articles/844875/ - not idea the outcome of the RFC

#cmakedefine01 HAVE_DNS_SD
#cmakedefine01 HAVE_AVAHI
#cmakedefine01 ENABLE_AIO
#cmakedefine01 WITH_ZSTD

#cmakedefine HAS_PIPE2
Expand Down
11 changes: 5 additions & 6 deletions iiod/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ find_library(LIBAIO_LIBRARIES aio)
find_path(LIBAIO_INCLUDE_DIR libaio.h)

if (LIBAIO_LIBRARIES AND LIBAIO_INCLUDE_DIR)
option(ENABLE_AIO "Build IIOD with async. I/O support" ON)
option(WITH_AIO "Build IIOD with async. I/O support" ON)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this mean that we only provide the option if the libraries are installed in the system? If so, I'm not sure if it would not be better to always provide the option and look for the libraries if the option is enabled. Then make it explicit that dependencies are needed (cmake failure)... Otherwise, users might not even be aware that this feature is possible...

endif ()

include(CheckTypeSize)
Expand All @@ -33,12 +33,12 @@ check_type_size("struct usb_functionfs_descs_head_v2" FUNCTIONFS_V2)
set(CMAKE_EXTRA_INCLUDE_FILES)

if (HAVE_FUNCTIONFS_V2)
OPTION(WITH_IIOD_USBD "Add support for USB through FunctionFS within IIOD" ${ENABLE_AIO})
OPTION(WITH_IIOD_USBD "Add support for USB through FunctionFS within IIOD" ${WITH_AIO})

if (WITH_IIOD_USBD)
if (NOT ENABLE_AIO)
if (NOT WITH_AIO)
message(SEND_ERROR "USB support in IIOD requires async. I/O support")
endif (NOT ENABLE_AIO)
endif (NOT WITH_AIO)

set(IIOD_CFILES ${IIOD_CFILES} usbd.c)
endif (WITH_IIOD_USBD)
Expand All @@ -52,8 +52,7 @@ set_target_properties(iiod PROPERTIES
)
target_link_libraries(iiod iio ${PTHREAD_LIBRARIES} ${AVAHI_LIBRARIES})

if (ENABLE_AIO)
add_definitions(-DWITH_AIO=1)
if (WITH_AIO)
include_directories(${LIBAIO_INCLUDE_DIR})
target_link_libraries(iiod ${LIBAIO_LIBRARIES})
endif ()
Expand Down
2 changes: 1 addition & 1 deletion iiod/iiod.c
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ int main(int argc, char **argv)
interactive = true;
break;
case 'a':
if (!ENABLE_AIO) {
if (!WITH_AIO) {
IIO_ERROR("IIOD was not compiled with AIO support.\n");
return EXIT_FAILURE;
}
Expand Down