diff --git a/.gitignore b/.gitignore index 59dadb0..f59af41 100644 --- a/.gitignore +++ b/.gitignore @@ -3,5 +3,6 @@ build/ bin/ temp/ __pycache__/ -src/*.egg-info/* +*/*.egg-info/* dist/ +*.so \ No newline at end of file diff --git a/.gitmodules b/.gitmodules index dda98b2..0682eb2 100644 --- a/.gitmodules +++ b/.gitmodules @@ -3,3 +3,4 @@ url = https://github.com/Tensor-Array/Tensor-Array [submodule "third_party/pybind11"] path = third_party/pybind11 + url = https://github.com/pybind/pybind11 diff --git a/CMakeLists.txt b/CMakeLists.txt index 84ffda6..0132681 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,32 +3,27 @@ find_package(Python COMPONENTS Interpreter Development) if (${Python_FOUND}) project(TensorArray_Python VERSION 0.1.0 LANGUAGES C CXX) -set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/lib) -set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/src/tensor_array/core) -set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/bin) include(CTest) enable_testing() add_subdirectory("third_party/pybind11" EXCLUDE_FROM_ALL) add_subdirectory("tensor-array-repo/Tensor-Array" EXCLUDE_FROM_ALL) -add_library(tensor2 SHARED src/tensor_array/_core/tensor_bind.cc) +pybind11_add_module(tensor2 SHARED src/tensor_array/_core/tensor_bind.cc) target_include_directories( tensor2 - PRIVATE "${CMAKE_CURRENT_LIST_DIR}/third_party/pybind11/include" - PRIVATE "${CMAKE_CURRENT_LIST_DIR}/tensor-array-repo/Tensor-Array/src" - PRIVATE ${Python_INCLUDE_DIRS} + PUBLIC "${CMAKE_CURRENT_LIST_DIR}/tensor-array-repo/Tensor-Array/src" + INTERFACE ${Python_INCLUDE_DIRS} ) SET_TARGET_PROPERTIES(tensor2 PROPERTIES PREFIX "") -target_link_libraries(tensor2 PRIVATE TensorArray::Core) +target_link_libraries(tensor2 PUBLIC TensorArray::Core) set(CPACK_PROJECT_NAME ${PROJECT_NAME}) set(CPACK_PROJECT_VERSION ${PROJECT_VERSION}) include(CPack) -install(TARGETS tensor2 LIBRARY DESTINATION /src/tensor_array/core ARCHIVE DESTINATION lib) endif() diff --git a/pyproject.toml b/pyproject.toml index dc29fcb..23c27f3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,8 +1,8 @@ [build-system] requires = [ - "setuptools>=61.0", + "setuptools", "wheel", "ninja", - "cmake", + "cmake" ] build-backend = "setuptools.build_meta" diff --git a/setup.py b/setup.py index 2f124d2..a981b6e 100644 --- a/setup.py +++ b/setup.py @@ -15,7 +15,6 @@ "win-arm64": "ARM64", } -cwd = os.path.dirname(os.path.abspath(__file__)) # A CMakeExtension needs a sourcedir instead of a file list. # The name must be the _single_ output extension from the CMake build. @@ -124,18 +123,25 @@ def build_extension(self, ext: CMakeExtension) -> None: ) def main(): + cwd = os.path.dirname(os.path.abspath(__file__)) with open(os.path.join(cwd, "README.md"), encoding="utf-8") as f: long_description = f.read() + packages = find_packages("src") + + print(packages) + setup( name = "TensorArray", - version = "0.0.1a02", + version = "0.0.1a3", description = "A machine learning package", long_description=long_description, - ext_modules=[CMakeExtension('tensor_array')], authors = "TensorArray-Creators", url= "https://github.com/Tensor-Array/Tensor-Array-Python", - packages=find_packages(exclude=("tests.*", "tests",)), + packages=packages, + ext_modules=[ + CMakeExtension("tensor_array/core/tensor2") + ], classifiers = [ "Development Status :: 2 - Pre-Alpha", @@ -152,8 +158,13 @@ def main(): ], license="MIT", cmdclass={ - 'build_ext': CMakeBuild + "build_ext": CMakeBuild + }, + package_dir={ + "": "src", + "tests": "tests" }, + python_requires=">=3.8", ) if __name__ == "__main__": diff --git a/src/tensor_array/core/tensor2.so b/src/tensor_array/core/tensor2.so deleted file mode 100644 index 3454c85..0000000 Binary files a/src/tensor_array/core/tensor2.so and /dev/null differ diff --git a/tensor-array-repo/Tensor-Array b/tensor-array-repo/Tensor-Array index 0d078f5..6351b0a 160000 --- a/tensor-array-repo/Tensor-Array +++ b/tensor-array-repo/Tensor-Array @@ -1 +1 @@ -Subproject commit 0d078f5c8ac21638d6583d9633e1d10cc25918d1 +Subproject commit 6351b0ab48aa14d8ee238d2b3f1fef52cc3531d3