Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ On *Arch Linux*: ```base-devel libusb cmake readline libtool glib2```

On _Fedora (RHEL)_: ...

On macOS: `brew install pkg-config cmake libusb iconv`

## Compiling

On Terminal:
Expand All @@ -30,9 +32,8 @@ On Terminal:
git clone https://github.com/CaesarW/libexword-re.git
cd libexword-re
mkdir build
cd build
cmake ..
make
cmake -S src -B build
cmake --build build
```

# Commands
Expand Down
17 changes: 16 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,24 @@ CMAKE_MINIMUM_REQUIRED(VERSION 3.5)

PROJECT("libexword-re")

FIND_PACKAGE(PkgConfig REQUIRED)
PKG_CHECK_MODULES(LIBUSB libusb-1.0)

IF(LIBUSB_FOUND)
INCLUDE_DIRECTORIES(${LIBUSB_INCLUDE_DIRS})
LINK_DIRECTORIES(${LIBUSB_LIBRARY_DIRS})
ENDIF()

# Find iconv (required for character encoding)
FIND_PACKAGE(Iconv REQUIRED)

SET(BIN_NAME "exword")
INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/includes)
FILE(GLOB srcfile "databuffer.c" "dict.c" "exword.c" "obex.c" "util.c" )
ADD_EXECUTABLE(${BIN_NAME} main.c ${srcfile})

TARGET_LINK_LIBRARIES(exword usb-1.0 readline)
# Link with libusb, iconv, readline, and macOS frameworks
TARGET_LINK_LIBRARIES(${BIN_NAME} ${LIBUSB_LIBRARIES} Iconv::Iconv readline)
IF(APPLE)
TARGET_LINK_LIBRARIES(${BIN_NAME} "-framework CoreFoundation" "-framework Carbon")
ENDIF()
1 change: 1 addition & 0 deletions src/dict.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include <sys/stat.h>
#include <fcntl.h>

#include "dict.h"
#include "exword.h"
#include "util.h"

Expand Down
8 changes: 8 additions & 0 deletions src/includes/dict.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#ifndef DICT_H
#define DICT_H

#include "exword.h"

int dict_reset(exword_t *device, char *user);

#endif /* DICT_H */
4 changes: 3 additions & 1 deletion src/includes/obex.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
#ifndef OBEX_H
#define OBEX_H

#include <libusb-1.0/libusb.h>
#include <inttypes.h>
#include <libusb.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
Expand Down Expand Up @@ -283,5 +283,7 @@ int obex_object_getnextheader(obex_t *self, obex_object_t *object,
uint8_t *hi, obex_headerdata_t *hv, uint32_t *hv_size);
int obex_object_set_nonhdr_data(obex_object_t *object, const uint8_t *buffer, unsigned int len);
int obex_request(obex_t *self, obex_object_t *object);
int obex_object_addheader(obex_t *self, obex_object_t *object, uint8_t hi,
obex_headerdata_t hv, uint32_t hv_size, unsigned int flags);

#endif
Loading