Browse Source
- pthread barriers implementation. - clock time.h - libiconv link - Support for dylib loading - CMake project fixes QTEditor parent project file.chirpmodem-v8.0.0
9 changed files with 249 additions and 1 deletions
@ -0,0 +1,77 @@
@@ -0,0 +1,77 @@
|
||||
/*
|
||||
* APPLE Compatibility |
||||
*/ |
||||
|
||||
#ifdef __APPLE__ |
||||
|
||||
#include <pthread.h> |
||||
#include <errno.h> |
||||
|
||||
#include "apple_compat.h" |
||||
|
||||
int pthread_barrier_init(pthread_barrier_t *barrier, const pthread_barrierattr_t *attr, unsigned int count) |
||||
{ |
||||
if(count == 0) |
||||
{ |
||||
errno = EINVAL; |
||||
return -1; |
||||
} |
||||
if(pthread_mutex_init(&barrier->mutex, 0) < 0) |
||||
{ |
||||
return -1; |
||||
} |
||||
if(pthread_cond_init(&barrier->cond, 0) < 0) |
||||
{ |
||||
pthread_mutex_destroy(&barrier->mutex); |
||||
return -1; |
||||
} |
||||
barrier->tripCount = count; |
||||
barrier->count = 0; |
||||
|
||||
return 0; |
||||
} |
||||
|
||||
int pthread_barrier_destroy(pthread_barrier_t *barrier) |
||||
{ |
||||
pthread_cond_destroy(&barrier->cond); |
||||
pthread_mutex_destroy(&barrier->mutex); |
||||
return 0; |
||||
} |
||||
|
||||
int pthread_barrier_wait(pthread_barrier_t *barrier) |
||||
{ |
||||
pthread_mutex_lock(&barrier->mutex); |
||||
++(barrier->count); |
||||
if(barrier->count >= barrier->tripCount) |
||||
{ |
||||
barrier->count = 0; |
||||
pthread_cond_broadcast(&barrier->cond); |
||||
pthread_mutex_unlock(&barrier->mutex); |
||||
return 1; |
||||
} |
||||
else |
||||
{ |
||||
pthread_cond_wait(&barrier->cond, &(barrier->mutex)); |
||||
pthread_mutex_unlock(&barrier->mutex); |
||||
return 0; |
||||
} |
||||
} |
||||
|
||||
/**
|
||||
* Missing POSIX RealTime/Monotonic Clock |
||||
*/ |
||||
#include <mach/mach_time.h> |
||||
|
||||
int clock_gettime(int clk_id, struct timespec *t) { |
||||
mach_timebase_info_data_t timebase; |
||||
mach_timebase_info(&timebase); |
||||
uint64_t time; |
||||
time = mach_absolute_time(); |
||||
double nseconds = ((double)time * (double)timebase.numer)/((double)timebase.denom); |
||||
double seconds = ((double)time * (double)timebase.numer)/((double)timebase.denom * 1e9); |
||||
t->tv_sec = seconds; |
||||
t->tv_nsec = nseconds; |
||||
return 0; |
||||
} |
||||
|
||||
#endif // APPLE Compatibility
|
||||
@ -0,0 +1,45 @@
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* APPLE Compatibility |
||||
*/ |
||||
|
||||
#ifdef __APPLE__ |
||||
|
||||
/**
|
||||
* Missing POSIX Thread Barriers implementation |
||||
*/ |
||||
#ifndef PTHREAD_BARRIER_H_ |
||||
#define PTHREAD_BARRIER_H_ |
||||
|
||||
#include <pthread.h> |
||||
#include <errno.h> |
||||
|
||||
typedef int pthread_barrierattr_t; |
||||
typedef struct |
||||
{ |
||||
pthread_mutex_t mutex; |
||||
pthread_cond_t cond; |
||||
int count; |
||||
int tripCount; |
||||
} pthread_barrier_t; |
||||
|
||||
|
||||
int pthread_barrier_init(pthread_barrier_t *barrier, const pthread_barrierattr_t *attr, unsigned int count); |
||||
|
||||
int pthread_barrier_destroy(pthread_barrier_t *barrier); |
||||
|
||||
int pthread_barrier_wait(pthread_barrier_t *barrier); |
||||
|
||||
#endif // PTHREAD_BARRIER_H_
|
||||
|
||||
// <time.h>
|
||||
#ifndef CLOCK_REALTIME |
||||
# define CLOCK_REALTIME 0 |
||||
#endif |
||||
|
||||
#ifndef CLOCK_MONOTONIC |
||||
# define CLOCK_MONOTONIC 0 |
||||
#endif |
||||
|
||||
int clock_gettime(int clk_id, struct timespec *t); |
||||
|
||||
#endif // APPLE Compatibility
|
||||
@ -0,0 +1,73 @@
@@ -0,0 +1,73 @@
|
||||
set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true) |
||||
include(CheckFunctionExists) |
||||
if (ICONV_INCLUDE_DIR) |
||||
# Already in cache, be silent |
||||
set(ICONV_FIND_QUIETLY TRUE) |
||||
endif() |
||||
|
||||
find_path(ICONV_INCLUDE_DIR iconv.h |
||||
/usr/include |
||||
/usr/local/include |
||||
/opt/local/include) |
||||
|
||||
set(POTENTIAL_ICONV_LIBS iconv libiconv libiconv2) |
||||
|
||||
find_library(ICONV_LIBRARY NAMES ${POTENTIAL_ICONV_LIBS} |
||||
PATHS /usr/lib /usr/local/lib /opt/local/lib) |
||||
|
||||
if(WIN32) |
||||
set(ICONV_DLL_NAMES iconv.dll libiconv.dll libiconv2.dll) |
||||
find_file(ICONV_DLL |
||||
NAMES ${ICONV_DLL_NAMES} |
||||
PATHS ENV PATH |
||||
NO_DEFAULT_PATH) |
||||
find_file(ICONV_DLL_HELP |
||||
NAMES ${ICONV_DLL_NAMES} |
||||
PATHS ENV PATH |
||||
${ICONV_INCLUDE_DIR}/../bin) |
||||
if(ICONV_FIND_REQUIRED) |
||||
if(NOT ICONV_DLL AND NOT ICONV_DLL_HELP) |
||||
message(FATAL_ERROR "Could not find iconv.dll, please add correct your PATH environment variable") |
||||
endif() |
||||
if(NOT ICONV_DLL AND ICONV_DLL_HELP) |
||||
get_filename_component(ICONV_DLL_HELP ${ICONV_DLL_HELP} PATH) |
||||
message(STATUS) |
||||
message(STATUS "Could not find iconv.dll in standard search path, please add ") |
||||
message(STATUS "${ICONV_DLL_HELP}") |
||||
message(STATUS "to your PATH environment variable.") |
||||
message(STATUS) |
||||
message(FATAL_ERROR "exit cmake") |
||||
endif() |
||||
endif() |
||||
if(ICONV_INCLUDE_DIR AND ICONV_LIBRARY AND ICONV_DLL) |
||||
set(ICONV_FOUND TRUE) |
||||
endif() |
||||
else() |
||||
check_function_exists(iconv HAVE_ICONV_IN_LIBC) |
||||
if(ICONV_INCLUDE_DIR AND HAVE_ICONV_IN_LIBC) |
||||
set(ICONV_FOUND TRUE) |
||||
set(ICONV_LIBRARY CACHE TYPE STRING FORCE) |
||||
endif() |
||||
if(ICONV_INCLUDE_DIR AND ICONV_LIBRARY) |
||||
set(ICONV_FOUND TRUE) |
||||
endif() |
||||
endif() |
||||
|
||||
|
||||
|
||||
if(ICONV_FOUND) |
||||
if(NOT ICONV_FIND_QUIETLY) |
||||
message(STATUS "Found iconv library: ${ICONV_LIBRARY}") |
||||
#message(STATUS "Found iconv dll : ${ICONV_DLL}") |
||||
endif() |
||||
else() |
||||
if(ICONV_FIND_REQUIRED) |
||||
message(STATUS "Looked for iconv library named ${POTENTIAL_ICONV_LIBS}.") |
||||
message(STATUS "Found no acceptable iconv library. This is fatal.") |
||||
message(STATUS "iconv header: ${ICONV_INCLUDE_DIR}") |
||||
message(STATUS "iconv lib : ${ICONV_LIBRARY}") |
||||
message(FATAL_ERROR "Could NOT find iconv library") |
||||
endif() |
||||
endif() |
||||
|
||||
mark_as_advanced(ICONV_LIBRARY ICONV_INCLUDE_DIR) |
||||
@ -0,0 +1,30 @@
@@ -0,0 +1,30 @@
|
||||
#-------------------------------------------------------- |
||||
# |
||||
# Pro file for MacOS builds with Qt Creator |
||||
# |
||||
#-------------------------------------------------------- |
||||
|
||||
TEMPLATE = subdirs |
||||
SUBDIRS = sdrbase |
||||
SUBDIRS += lz4 |
||||
SUBDIRS += librtlsdr |
||||
SUBDIRS += libhackrf |
||||
SUBDIRS += libairspy |
||||
SUBDIRS += plugins/samplesource/filesource |
||||
SUBDIRS += plugins/samplesource/sdrdaemon |
||||
SUBDIRS += plugins/samplesource/rtlsdr |
||||
SUBDIRS += plugins/samplesource/hackrf |
||||
SUBDIRS += plugins/samplesource/airspy |
||||
SUBDIRS += plugins/channel/chanalyzer |
||||
SUBDIRS += plugins/channel/demodam |
||||
SUBDIRS += plugins/channel/demodbfm |
||||
SUBDIRS += plugins/channel/demodlora |
||||
SUBDIRS += plugins/channel/demodnfm |
||||
SUBDIRS += plugins/channel/demodssb |
||||
SUBDIRS += plugins/channel/demodwfm |
||||
SUBDIRS += plugins/channel/tcpsrc |
||||
SUBDIRS += plugins/channel/udpsrc |
||||
|
||||
# Main app must be last |
||||
CONFIG += ordered |
||||
SUBDIRS += app |
||||
Loading…
Reference in new issue