This commit is contained in:
wangjiyu 2025-04-10 16:20:22 +08:00
parent 7ce5b29e0f
commit 3a75556b54
3 changed files with 26 additions and 22 deletions

View File

@ -1,16 +1,16 @@
#g++ -shared -fPIC \
# -I/usr/include/python3.10 -I/usr/include/python3.10/numpy -I./include \
# -L./lib \
# rtc_plugins.cpp util/RTCContext.cpp \
# -lMRTCEngine -lboost_python310 -lpython3.10 \
# -Wl,-rpath='$ORIGIN/lib' \
# -o rtc_plugins.so
g++ -shared -fPIC \ g++ -shared -fPIC \
-I/usr/include/python3.10 -I/usr/include/python3.10/numpy -I./include \ -I/usr/include/python3.10 -I/usr/include/python3.10/numpy -I./include \
-I/usr/include/python3.10 -I/usr/include/numpy \ -L./lib \
-Wl,-rpath='$ORIGIN/lib' \
-lboost_python310 -lpython3.10 \
-lMRTCEngine -lboost_python310 -lpython3.10 \
-L$(python3 -c "import numpy; print(numpy.get_include())") \
rtc_plugins.cpp util/RTCContext.cpp \ rtc_plugins.cpp util/RTCContext.cpp \
-o rtc_plugins.so -lMRTCEngine -lboost_python310 -lpython3.10 \
-Wl,-rpath='$ORIGIN/lib' \
-o rtc_plugins.so
#g++ -shared -fPIC \
# -I/usr/include/python3.10 -I/usr/include/python3.10/numpy -I./include \
# -I/usr/include/python3.10 -I/usr/include/numpy \
# -Wl,-rpath='$ORIGIN/lib' \
# -lboost_python310 -lpython3.10 \
# -lMRTCEngine -lboost_python310 -lpython3.10 \
# -L$(python3 -c "import numpy; print(numpy.get_include())") \
# rtc_plugins.cpp util/RTCContext.cpp \
# -o rtc_plugins.so

View File

@ -1,13 +1,7 @@
#include <boost/python/module.hpp>
#include <boost/python/def.hpp>
#define PY_ARRAY_UNIQUE_SYMBOL rtc_plugins_ARRAY_API
#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
#include <numpy/ndarrayobject.h>
#include <numpy/arrayobject.h>
#include <stdio.h>
#include "./util/RTCContext.h" #include "./util/RTCContext.h"
namespace py = boost::python; namespace py = boost::python;
int init(const char* selfUserId, const char* selfDisplayName, const char* selfRoomId, boost::python::object callback) { int init(const char* selfUserId, const char* selfDisplayName, const char* selfRoomId, boost::python::object callback) {

View File

@ -1,3 +1,7 @@
// 在文件顶部定义唯一符号(关键!)
#define PY_ARRAY_UNIQUE_SYMBOL rtc_plugins_ARRAY_API
#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
#include "IMRTCEngine.hpp" #include "IMRTCEngine.hpp"
#include "MRTCEngineDefine.hpp" #include "MRTCEngineDefine.hpp"
#include "IMRTCEngineFactory.hpp" #include "IMRTCEngineFactory.hpp"
@ -5,10 +9,16 @@
#include <cstring> #include <cstring>
#include <filesystem> // C++17 #include <filesystem> // C++17
#include <iostream> #include <iostream>
#include <stdio.h>
#include <unistd.h> #include <unistd.h>
#include <Python.h>
#include <boost/python.hpp> #include <boost/python.hpp>
#include <boost/python/detail/wrap_python.hpp> #include <boost/python/detail/wrap_python.hpp>
#include <boost/python/detail/prefix.hpp> #include <boost/python/detail/prefix.hpp>
#include <boost/python/module.hpp>
#include <boost/python/def.hpp>
#include <numpy/ndarrayobject.h>
#include <numpy/arrayobject.h> #include <numpy/arrayobject.h>
namespace fs = std::filesystem; namespace fs = std::filesystem;
#define ENV_PRODUCT #define ENV_PRODUCT