refind logger
This commit is contained in:
34
cpp_ext/CMakeLists.txt
Normal file
34
cpp_ext/CMakeLists.txt
Normal file
@@ -0,0 +1,34 @@
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
project(archery_netcore CXX)
|
||||
|
||||
set(CMAKE_SYSTEM_NAME Linux)
|
||||
set(CMAKE_SYSTEM_PROCESSOR riscv64)
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||
|
||||
if(NOT DEFINED PY_INCLUDE_DIR)
|
||||
message(FATAL_ERROR "PY_INCLUDE_DIR not set")
|
||||
endif()
|
||||
if(NOT DEFINED PY_LIB)
|
||||
message(FATAL_ERROR "PY_LIB not set")
|
||||
endif()
|
||||
if(NOT DEFINED PY_EXT_SUFFIX)
|
||||
message(FATAL_ERROR "PY_EXT_SUFFIX not set")
|
||||
endif()
|
||||
if(NOT DEFINED MAIXCDK_PATH)
|
||||
message(FATAL_ERROR "MAIXCDK_PATH not set (need components/3rd_party/pybind11)")
|
||||
endif()
|
||||
|
||||
add_library(archery_netcore MODULE archery_netcore.cpp)
|
||||
|
||||
target_include_directories(archery_netcore PRIVATE
|
||||
"${PY_INCLUDE_DIR}"
|
||||
"${MAIXCDK_PATH}/components/3rd_party/pybind11/pybind11/include"
|
||||
)
|
||||
|
||||
set_target_properties(archery_netcore PROPERTIES
|
||||
PREFIX ""
|
||||
SUFFIX "${PY_EXT_SUFFIX}"
|
||||
)
|
||||
|
||||
target_link_libraries(archery_netcore PRIVATE "${PY_LIB}")
|
||||
12
cpp_ext/archery_netcore.cpp
Normal file
12
cpp_ext/archery_netcore.cpp
Normal file
@@ -0,0 +1,12 @@
|
||||
#include <pybind11/pybind11.h>
|
||||
|
||||
namespace py = pybind11;
|
||||
|
||||
static const char* kServerIp = "stcp.shelingxingqiu.com";
|
||||
|
||||
PYBIND11_MODULE(archery_netcore, m) {
|
||||
m.doc() = "Archery net core (native, pybind11).";
|
||||
m.def("server_ip", []() {
|
||||
return py::str(kServerIp);
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user