Skip to content

Commit

Permalink
Fix linux build
Browse files Browse the repository at this point in the history
  • Loading branch information
cozycactus committed Aug 20, 2022
1 parent 9a82916 commit 4d3f793
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
8 changes: 8 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@ target_link_libraries(rx888_test rx888
${CMAKE_THREAD_LIBS_INIT}
)

if(UNIX)
if(APPLE OR CMAKE_SYSTEM MATCHES "OpenBSD")
target_link_libraries(rx888_test m)
else()
target_link_libraries(rx888_test m rt)
endif()
endif()

########################################################################
# Install built library files & utilities
########################################################################
Expand Down
4 changes: 3 additions & 1 deletion src/rx888_test.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#define _POSIX_C_SOURCE 200112L

#include <errno.h>
#include <signal.h>
#include <string.h>
Expand Down Expand Up @@ -203,9 +205,9 @@ static void underrun_test(unsigned char *buf, uint32_t len, int mute)
static int ppm_gettime(struct time_generic *tg)
{
int rv = ENOSYS;
//struct timespec ts;

#ifdef __unix__
struct timespec ts;
rv = clock_gettime(CLOCK_MONOTONIC, &ts);
tg->tv_sec = ts.tv_sec;
tg->tv_nsec = ts.tv_nsec;
Expand Down

0 comments on commit 4d3f793

Please sign in to comment.