Skip to content

Commit

Permalink
libini: Now that we have it, use it.
Browse files Browse the repository at this point in the history
turn it on, and connect things to the Cmake build system.
Can optionally be turned off now.

Signed-off-by: Robin Getz <[email protected]>
  • Loading branch information
rgetz committed Apr 8, 2020
1 parent 77568c7 commit dbc2338
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 13 deletions.
11 changes: 2 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -162,16 +162,9 @@ if(WITH_LOCAL_BACKEND)
list(APPEND LIBS_TO_LINK ${LIBRT_LIBRARIES})
endif()

option(WITH_LOCAL_CONFIG "Read local context attributes from /etc/libiio.ini" OFF)
option(WITH_LOCAL_CONFIG "Read local context attributes from /etc/libiio.ini" ON)
if (WITH_LOCAL_CONFIG)
find_library(LIBINI_LIBRARIES ini)
find_path(LIBINI_INCLUDE_DIR ini.h)
if (NOT LIBINI_LIBRARIES OR NOT LIBINI_INCLUDE_DIR)
message(SEND_ERROR "WITH_LOCAL_CONFIG option requires libini to be installed")
else()
include_directories(${LIBINI_INCLUDE_DIR})
list(APPEND LIBS_TO_LINK ${LIBINI_LIBRARIES})
endif()
list(APPEND LIBIIO_CFILES ./libini/libini.c)
endif()
endif()

Expand Down
2 changes: 1 addition & 1 deletion README_BUILD.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Cmake Options | Default | Description |
`WITH_DOC` | OFF | Generate documentation with Doxygen |
`WITH_MAN` | OFF | Generate and install man pages |
`WITH_TESTS` | ON | Build the test programs |
`WITH_LOCAL_CONFIG` | OFF | Read local context attributes from /etc/libiio.ini |
`WITH_LOCAL_CONFIG` | ON | Read local context attributes from /etc/libiio.ini |
`ENABLE_PACKAGING` | OFF | Create .deb/.rpm/.tar.gz via 'make package' |
`INSTALL_UDEV_RULE` | ON | Install a udev rule for detection of USB devices |

Expand Down
7 changes: 4 additions & 3 deletions local.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
#include "debug.h"
#include "iio-private.h"
#include "sort.h"
#ifdef WITH_LOCAL_CONFIG
#include "libini/ini.h"
#endif


#include <dirent.h>
#include <errno.h>
Expand All @@ -39,9 +43,6 @@
#include <time.h>
#include <unistd.h>
#include <fcntl.h>
#ifdef WITH_LOCAL_CONFIG
#include <ini.h>
#endif

#define DEFAULT_TIMEOUT_MS 1000

Expand Down

0 comments on commit dbc2338

Please sign in to comment.