forked from davidmoreno/onion
-
Notifications
You must be signed in to change notification settings - Fork 0
Getting Onion to Work on macOS
Eugene edited this page Mar 15, 2020
·
4 revisions
Note: All the changes detailed below have already been applied to this fork of the Onion library.
- Clone the master branch of Onion
- CMakeLists.txt: Change the CMake minimum required version to 3.6. Delete the CMake policy command.
- Remove the deprecated use of
sem_init(...)
from /src/onion/poller_libev.c and /src/onion/poller_libevent.c and implement proper freeing of semaphores:- Update the
onion_poller_t
struct to use a pointer to a semaphore:sem_t *sem;
- In
onion_poller_new(...)
, addsem_unlink("/poller");
to the start of the function, and replacesem_init(&ret->sem, 0, 1)
withret->sem = sem_open("/poller", O_CREAT, 0, 1)
. - In
onion_poller_free(...)
, addsem_close(p->sem); sem_unlink("/poller");
to the start of the function. - In
onion_poller_poll(...)
, simply usepoller->sem
andpoller->sem
.
- Update the
- Resolve some of the compilation warnings by including
<strings.h>
,<stdlib.h>
, and<alloca.h>
, by using%lld
for printf, and by using the correctonion_poller_slot_type_e
parameter type. - Run CMake from the build directory:
cmake ..
- Compile the static Onion C library (dynamic C++ library does not compile):
make onion_static
- C++ bindings, examples, and tests
- OTemplate tool, examples, and tests