Added python so generation rule.

This commit is contained in:
xiong-jie-y 2020-06-20 23:41:49 +09:00
parent d9f11e7d4a
commit 0a41fbc376
3 changed files with 36 additions and 0 deletions

View File

@ -299,3 +299,15 @@ maven_install(
fetch_sources = True,
version_conflict_policy = "pinned",
)
new_local_repository(
name = "python_dev",
path = "/home/yusuke/miniconda3/envs/py37_ubuntu_vtuber/include/python3.7m",
build_file_content = """
package(default_visibility = ["//visibility:public"])
cc_library(
name = "headers",
hdrs = glob(["**/*.h"])
)
"""
)

View File

@ -76,3 +76,17 @@ cc_library(
"//mediapipe/calculators/core:packet_cloner_calculator"
],
)
cc_binary(
name = "cameravtuber.so",
linkshared = 1,
srcs = [
"cameravtuber.cc"
],
deps = [
":demo_run_graph_main_gpu",
"@python_dev//:headers"
],
copts = ["-Iexternal/python_dev", "-DPIC", "-shared", "-fPIC"],
linkopts = ["-lboost_python3"]
)

View File

@ -0,0 +1,10 @@
#include <boost/python.hpp>
std::string hello() {
return "hello world";
}
BOOST_PYTHON_MODULE(cameravtuber) {
using namespace boost::python;
def("hello", &hello);
}