diff --git a/build.sh b/build.sh index 53c9eaf..f2ad9c9 100644 --- a/build.sh +++ b/build.sh @@ -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 \ -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())") \ + -L./lib \ rtc_plugins.cpp util/RTCContext.cpp \ - -o rtc_plugins.so \ No newline at end of file + -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 diff --git a/rtc_plugins.cpp b/rtc_plugins.cpp index f8d2484..1109a63 100644 --- a/rtc_plugins.cpp +++ b/rtc_plugins.cpp @@ -1,13 +1,7 @@ -#include -#include -#define PY_ARRAY_UNIQUE_SYMBOL rtc_plugins_ARRAY_API -#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION -#include -#include -#include - - #include "./util/RTCContext.h" + + + namespace py = boost::python; int init(const char* selfUserId, const char* selfDisplayName, const char* selfRoomId, boost::python::object callback) { diff --git a/util/RTCContext.h b/util/RTCContext.h index eaaebea..47476b8 100644 --- a/util/RTCContext.h +++ b/util/RTCContext.h @@ -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 "MRTCEngineDefine.hpp" #include "IMRTCEngineFactory.hpp" @@ -5,10 +9,16 @@ #include #include // C++17 #include +#include #include + +#include #include #include #include +#include +#include +#include #include namespace fs = std::filesystem; #define ENV_PRODUCT