Fixed missing library dir argument for OSX

This commit is contained in:
Ryzerth
2021-04-29 14:30:11 +02:00
parent 6aade531a2
commit 8c8acf6955
10 changed files with 83 additions and 1 deletions

View File

@ -64,6 +64,13 @@ else()
${VOLK_INCLUDE_DIRS}
)
target_link_directories(sdrpp_core PUBLIC
${GLEW_LIBRARY_DIRS}
${FFTW3_LIBRARY_DIRS}
${GLFW3_LIBRARY_DIRS}
${VOLK_LIBRARY_DIRS}
)
target_link_libraries(sdrpp_core PUBLIC
${OPENGL_LIBRARIES}
${GLEW_LIBRARIES}

View File

@ -0,0 +1,2 @@
#include <utils/networking.h>

View File

@ -0,0 +1,66 @@
#pragma once
#include <string>
#include <vector>
#include <thread>
#include <chrono>
#include <mutex>
struct TCPAsyncRead {
int timeout;
int count;
void (*handler)(int count, char* data, void* ctx);
void* ctx;
};
struct TCPAsyncWrite {
int timeoutMs;
int count;
char* data;
};
enum {
NET_ERR_OK = 0,
NET_ERR_TIMEOUT = -1,
NET_ERR_SYSTEM = -2
};
class TCPClient {
public:
TCPClient();
~TCPClient();
bool connect(std::string host, int port);
bool disconnect();
int enableAsync();
int disableAsync();
bool isAsync();
int read(char* data, int count, int timeout = -1);
int write(char* data, int count, int timeout = -1);
int asyncRead(int count, void (*handler)(int count, char* data, void* ctx), int timeout = -1);
int asyncWrite(char* data, int count, int timeout = -1);
bool isOpen();
int close();
private:
void readWorker();
void writeWorker();
std::mutex readQueueMtx;
std::vector<TCPAsyncRead> readQueue;
std::mutex writeQueueMtx;
std::vector<TCPAsyncWrite> writeQueue;
std::thread readWorkerThread;
std::thread writeWorkerThread;
bool open = false;
bool async = false;
};