mirror of
https://github.com/commaai/msgq.git
synced 2026-06-08 05:54:44 +08:00
include from project root (#402)
This commit is contained in:
5
.gitignore
vendored
5
.gitignore
vendored
@@ -1,6 +1,4 @@
|
||||
gen
|
||||
node_modules
|
||||
package-lock.json
|
||||
/gen/
|
||||
*.tmp
|
||||
*.pyc
|
||||
__pycache__
|
||||
@@ -18,4 +16,3 @@ services.h
|
||||
.sconsign.dblite
|
||||
libcereal_shared.*
|
||||
.mypy_cache/
|
||||
catch2/
|
||||
|
||||
@@ -39,11 +39,12 @@ RUN pyenv install 3.8.10 && \
|
||||
pyenv rehash && \
|
||||
pip3 install --no-cache-dir pyyaml==5.1.2 Cython==0.29.14 scons==3.1.1 pycapnp==1.0.0 pre-commit==2.15.0 pylint==2.5.2 parameterized==0.7.4 coverage==5.1 numpy==1.21.1
|
||||
|
||||
WORKDIR /project/cereal/messaging
|
||||
RUN git clone https://github.com/catchorg/Catch2.git && \
|
||||
WORKDIR /project/
|
||||
RUN cd /tmp/ && \
|
||||
git clone https://github.com/catchorg/Catch2.git && \
|
||||
cd Catch2 && \
|
||||
git checkout 229cc4823c8cbe67366da8179efc6089dd3893e9 && \
|
||||
mv single_include/catch2 ../catch2 && \
|
||||
mv single_include/catch2/ /project/ && \
|
||||
cd .. \
|
||||
rm -rf Catch2
|
||||
|
||||
|
||||
@@ -8,13 +8,10 @@ arch = subprocess.check_output(["uname", "-m"], encoding='utf8').rstrip()
|
||||
if platform.system() == "Darwin":
|
||||
arch = "Darwin"
|
||||
|
||||
cereal_dir = Dir('.')
|
||||
messaging_dir = Dir('./messaging')
|
||||
common = ''
|
||||
|
||||
cpppath = [
|
||||
cereal_dir,
|
||||
messaging_dir,
|
||||
f"#/../",
|
||||
'/usr/lib/include',
|
||||
'/opt/homebrew/include',
|
||||
sysconfig.get_paths()['include'],
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
|
||||
typedef void (*sighandler_t)(int sig);
|
||||
|
||||
#include "impl_msgq.h"
|
||||
#include "impl_zmq.h"
|
||||
#include "services.h"
|
||||
#include "cereal/services.h"
|
||||
#include "cereal/messaging/impl_msgq.h"
|
||||
#include "cereal/messaging/impl_zmq.h"
|
||||
|
||||
std::atomic<bool> do_exit = false;
|
||||
static void set_do_exit(int sig) {
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
#include <thread>
|
||||
#include <cassert>
|
||||
|
||||
#include "messaging.h"
|
||||
#include "impl_zmq.h"
|
||||
#include "cereal/messaging/messaging.h"
|
||||
#include "cereal/messaging/impl_zmq.h"
|
||||
|
||||
#define MSGS 1e5
|
||||
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
#include <csignal>
|
||||
#include <cerrno>
|
||||
|
||||
#include "services.h"
|
||||
#include "impl_msgq.h"
|
||||
#include "cereal/services.h"
|
||||
#include "cereal/messaging/impl_msgq.h"
|
||||
|
||||
|
||||
volatile sig_atomic_t msgq_do_exit = 0;
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
#pragma once
|
||||
#include "messaging.h"
|
||||
#include "msgq.h"
|
||||
|
||||
#include <zmq.h>
|
||||
#include <string>
|
||||
|
||||
#include "cereal/messaging/messaging.h"
|
||||
#include "cereal/messaging/msgq.h"
|
||||
|
||||
#define MAX_POLLERS 128
|
||||
|
||||
class MSGQContext : public Context {
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
|
||||
#include <zmq.h>
|
||||
|
||||
#include "services.h"
|
||||
#include "impl_zmq.h"
|
||||
#include "cereal/services.h"
|
||||
#include "cereal/messaging/impl_zmq.h"
|
||||
|
||||
static int get_port(std::string endpoint) {
|
||||
int port = -1;
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
#pragma once
|
||||
#include "messaging.h"
|
||||
|
||||
#include <zmq.h>
|
||||
#include <string>
|
||||
|
||||
#include "cereal/messaging/messaging.h"
|
||||
|
||||
#define MAX_POLLERS 128
|
||||
|
||||
class ZMQContext : public Context {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
#include <cassert>
|
||||
#include <iostream>
|
||||
|
||||
#include "messaging.h"
|
||||
#include "impl_zmq.h"
|
||||
#include "impl_msgq.h"
|
||||
#include "cereal/messaging/messaging.h"
|
||||
#include "cereal/messaging/impl_zmq.h"
|
||||
#include "cereal/messaging/impl_msgq.h"
|
||||
|
||||
#ifdef __APPLE__
|
||||
const bool MUST_USE_ZMQ = true;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstddef>
|
||||
#include <map>
|
||||
#include <string>
|
||||
@@ -6,7 +7,8 @@
|
||||
#include <time.h>
|
||||
|
||||
#include <capnp/serialize.h>
|
||||
#include "../gen/cpp/log.capnp.h"
|
||||
|
||||
#include "cereal/gen/cpp/log.capnp.h"
|
||||
|
||||
#ifdef __APPLE__
|
||||
#define CLOCK_BOOTTIME CLOCK_MONOTONIC
|
||||
@@ -20,7 +22,7 @@ class Context {
|
||||
public:
|
||||
virtual void * getRawContext() = 0;
|
||||
static Context * create();
|
||||
virtual ~Context(){};
|
||||
virtual ~Context(){}
|
||||
};
|
||||
|
||||
class Message {
|
||||
|
||||
@@ -6,7 +6,7 @@ from libcpp.vector cimport vector
|
||||
from libcpp cimport bool
|
||||
|
||||
|
||||
cdef extern from "messaging.h":
|
||||
cdef extern from "cereal/messaging/messaging.h":
|
||||
cdef cppclass Context:
|
||||
@staticmethod
|
||||
Context * create()
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "msgq.h"
|
||||
#include "cereal/messaging/msgq.h"
|
||||
|
||||
void sigusr2_handler(int signal) {
|
||||
assert(signal == SIGUSR2);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
#include <string>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "catch2/catch.hpp"
|
||||
#include "msgq.h"
|
||||
#include "cereal/messaging/msgq.h"
|
||||
|
||||
TEST_CASE("ALIGN"){
|
||||
REQUIRE(ALIGN(0) == 0);
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
#include <string>
|
||||
#include <mutex>
|
||||
|
||||
#include "services.h"
|
||||
#include "messaging.h"
|
||||
#include "cereal/services.h"
|
||||
#include "cereal/messaging/messaging.h"
|
||||
|
||||
const bool SIMULATION = (getenv("SIMULATION") != nullptr) && (std::string(getenv("SIMULATION")) == "1");
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "visionbuf.h"
|
||||
#include "cereal/visionipc/visionbuf.h"
|
||||
|
||||
#define ALIGN(x, align) (((x) + (align)-1) & ~((align)-1))
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
#include "visionipc.h"
|
||||
|
||||
#include "cereal/visionipc/visionipc.h"
|
||||
|
||||
#define CL_USE_DEPRECATED_OPENCL_1_2_APIS
|
||||
#ifdef __APPLE__
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "visionbuf.h"
|
||||
#include "cereal/visionipc/visionbuf.h"
|
||||
|
||||
#include <atomic>
|
||||
#include <stdio.h>
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
#include <msm_ion.h>
|
||||
|
||||
#include "visionbuf.h"
|
||||
#include "cereal/visionipc/visionbuf.h"
|
||||
|
||||
// keep trying if x gets interrupted by a signal
|
||||
#define HANDLE_EINTR(x) \
|
||||
|
||||
@@ -6,7 +6,7 @@ from libcpp.vector cimport vector
|
||||
from libc.stdint cimport uint32_t, uint64_t
|
||||
from libcpp cimport bool
|
||||
|
||||
cdef extern from "visionbuf.h":
|
||||
cdef extern from "cereal/visionipc/visionbuf.h":
|
||||
cdef enum VisionStreamType:
|
||||
pass
|
||||
|
||||
@@ -19,13 +19,13 @@ cdef extern from "visionbuf.h":
|
||||
size_t uv_offset
|
||||
void set_frame_id(uint64_t id)
|
||||
|
||||
cdef extern from "visionipc.h":
|
||||
cdef extern from "cereal/visionipc/visionipc.h":
|
||||
struct VisionIpcBufExtra:
|
||||
uint32_t frame_id
|
||||
uint64_t timestamp_sof
|
||||
uint64_t timestamp_eof
|
||||
|
||||
cdef extern from "visionipc_server.h":
|
||||
cdef extern from "cereal/visionipc/visionipc_server.h":
|
||||
cdef cppclass VisionIpcServer:
|
||||
VisionIpcServer(string, void*, void*)
|
||||
void create_buffers(VisionStreamType, size_t, bool, size_t, size_t)
|
||||
@@ -34,7 +34,7 @@ cdef extern from "visionipc_server.h":
|
||||
void send(VisionBuf *, VisionIpcBufExtra *, bool)
|
||||
void start_listener()
|
||||
|
||||
cdef extern from "visionipc_client.h":
|
||||
cdef extern from "cereal/visionipc/visionipc_client.h":
|
||||
cdef cppclass VisionIpcClient:
|
||||
VisionIpcClient(string, VisionStreamType, bool, void*, void*)
|
||||
VisionBuf * recv(VisionIpcBufExtra *, int)
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
#include <iostream>
|
||||
#include <thread>
|
||||
|
||||
#include "visionipc/ipc.h"
|
||||
#include "visionipc/visionipc_client.h"
|
||||
#include "visionipc/visionipc_server.h"
|
||||
#include "logger/logger.h"
|
||||
#include "cereal/visionipc/ipc.h"
|
||||
#include "cereal/visionipc/visionipc_client.h"
|
||||
#include "cereal/visionipc/visionipc_server.h"
|
||||
#include "cereal/logger/logger.h"
|
||||
|
||||
VisionIpcClient::VisionIpcClient(std::string name, VisionStreamType type, bool conflate, cl_device_id device_id, cl_context ctx) : name(name), type(type), device_id(device_id), ctx(ctx) {
|
||||
msg_ctx = Context::create();
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
#include <string>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "messaging/messaging.h"
|
||||
#include "visionipc/visionipc.h"
|
||||
#include "visionipc/visionbuf.h"
|
||||
#include "cereal/messaging/messaging.h"
|
||||
#include "cereal/visionipc/visionipc.h"
|
||||
#include "cereal/visionipc/visionbuf.h"
|
||||
|
||||
class VisionIpcClient {
|
||||
private:
|
||||
|
||||
@@ -7,10 +7,10 @@
|
||||
#include <sys/socket.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "messaging/messaging.h"
|
||||
#include "visionipc/ipc.h"
|
||||
#include "visionipc/visionipc_server.h"
|
||||
#include "logger/logger.h"
|
||||
#include "cereal/messaging/messaging.h"
|
||||
#include "cereal/visionipc/ipc.h"
|
||||
#include "cereal/visionipc/visionipc_server.h"
|
||||
#include "cereal/logger/logger.h"
|
||||
|
||||
std::string get_endpoint_name(std::string name, VisionStreamType type){
|
||||
if (messaging_use_zmq()){
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
#include <atomic>
|
||||
#include <map>
|
||||
|
||||
#include "messaging/messaging.h"
|
||||
#include "visionipc/visionipc.h"
|
||||
#include "visionipc/visionbuf.h"
|
||||
#include "cereal/messaging/messaging.h"
|
||||
#include "cereal/visionipc/visionipc.h"
|
||||
#include "cereal/visionipc/visionbuf.h"
|
||||
|
||||
std::string get_endpoint_name(std::string name, VisionStreamType type);
|
||||
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
#include <chrono>
|
||||
|
||||
#include "catch2/catch.hpp"
|
||||
#include "visionipc_server.h"
|
||||
#include "visionipc_client.h"
|
||||
#include "cereal/visionipc/visionipc_server.h"
|
||||
#include "cereal/visionipc/visionipc_client.h"
|
||||
|
||||
static void zmq_sleep(int milliseconds=1000){
|
||||
if (messaging_use_zmq()){
|
||||
|
||||
Reference in New Issue
Block a user