Skip to content

Commit 7bd30f3

Browse files
add submodule "pybind11"
1 parent 02d63b1 commit 7bd30f3

File tree

6 files changed

+32
-3
lines changed

6 files changed

+32
-3
lines changed

.gitmodules

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
[submodule "tensor-array-repo/Tensor-Array"]
22
path = tensor-array-repo/Tensor-Array
33
url = https://github.com/Tensor-Array/Tensor-Array
4+
[submodule "third_party/pybind11"]
5+
path = third_party/pybind11

.vscode/c_cpp_properties.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"name": "Linux",
55
"includePath": [
66
"${workspaceFolder}/**",
7-
"${workspaceFolder}/.venv/lib/python3.10/site-packages/pybind11/include/**",
7+
"${workspaceFolder}/third_party/pybind11/include/**",
88
"/usr/include/python3.10/**",
99
"${workspaceFolder}/tensor-array-repo/Tensor-Array/src/**"
1010
],

CMakeLists.txt

+3-2
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,20 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/bin)
1010
include(CTest)
1111
enable_testing()
1212

13+
add_subdirectory("third_party/pybind11" EXCLUDE_FROM_ALL)
1314
add_subdirectory("tensor-array-repo/Tensor-Array" EXCLUDE_FROM_ALL)
1415
add_library(tensor2 SHARED scripts/cpp/tensor_bind.cc)
1516

1617
target_include_directories(
1718
tensor2
18-
PRIVATE "${CMAKE_CURRENT_LIST_DIR}/.venv/lib/python3.10/site-packages/pybind11/include"
19+
PRIVATE "${CMAKE_CURRENT_LIST_DIR}/third_party/pybind11/include"
1920
PRIVATE "${CMAKE_CURRENT_LIST_DIR}/tensor-array-repo/Tensor-Array/src"
2021
PRIVATE ${Python_INCLUDE_DIRS}
2122
)
2223

2324
SET_TARGET_PROPERTIES(tensor2 PROPERTIES PREFIX "")
2425

25-
target_link_libraries(tensor2 PUBLIC TensorArray::Core)
26+
target_link_libraries(tensor2 PRIVATE TensorArray::Core)
2627

2728
set(CPACK_PROJECT_NAME ${PROJECT_NAME})
2829
set(CPACK_PROJECT_VERSION ${PROJECT_VERSION})

setup.py

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
from setuptools import setup
2+
from setuptools.command.develop import develop
3+
from setuptools.command.install import install
4+
from setuptools.command.build_ext import build_ext
5+
6+
class PostDevelopCommand(develop):
7+
"""Post-installation for development mode."""
8+
def run(self):
9+
develop.run(self)
10+
print("TensorArray developed.")
11+
# PUT YOUR POST-INSTALL SCRIPT HERE or CALL A FUNCTION
12+
13+
class PostInstallCommand(install):
14+
"""Post-installation for installation mode."""
15+
def run(self):
16+
install.run(self)
17+
print("TensorArray installed.")
18+
# PUT YOUR POST-INSTALL SCRIPT HERE or CALL A FUNCTION
19+
20+
setup(
21+
cmdclass={
22+
'develop': PostDevelopCommand,
23+
'install': PostInstallCommand,
24+
},
25+
)

src/tensor_array/core/tensor2.so

52.3 KB
Binary file not shown.

third_party/pybind11

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Subproject commit aec6cc5406edb076f5a489c2d7f84bb07052c4a3

0 commit comments

Comments
 (0)