Skip to content

Commit

Permalink
update pypi action
Browse files Browse the repository at this point in the history
  • Loading branch information
kungjim committed Sep 17, 2023
1 parent b002baf commit 7ad44b8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ include_directories(include)
include_directories(/usr/local/include)
include_directories(/usr/include)

set(PYTHON ${PYTHON_EXECUTABLE})
find_package(Python REQUIRED)
include_directories(${Python_INCLUDE_DIRS})

message(STATUS "PYTHON_LIBRARIES = ${PYTHON_LIBRARIES}")
message(STATUS "PYTHON_EXECUTABLE = ${PYTHON_EXECUTABLE}")
Expand Down
13 changes: 7 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@ def __init__(self, name: str, sourcedir: str = "") -> None:
super().__init__(name, sources=[])
self.sourcedir = os.fspath(Path(sourcedir).resolve())


def site_dir():
import site
python_lib_dir = site.getsitepackages()[0] if hasattr(site, 'getsitepackages') else sys.prefix
return python_lib_dir
class CMakeBuild(build_ext):
def build_extension(self, ext: CMakeExtension) -> None:
# Must be in this form due to bug in .resolve() only fixed in Python 3.10+
Expand All @@ -67,11 +70,9 @@ def build_extension(self, ext: CMakeExtension) -> None:
# Set Python_EXECUTABLE instead if you use PYBIND11_FINDPYTHON
# from Python.
venv_dir = os.path.abspath(sys.executable+"/../../")
python_version = sys.version
pybind11_dir=f"{venv_dir}/lib/python{python_version}/site-packages/pybind11/share/cmake/pybind11"

CMAKE_PREFIX_PATH = os.getenv("CMAKE_PREFIX_PATH")
print(f"Python Versin: {python_version} {CMAKE_PREFIX_PATH}")
site_packages_dir = site_dir()
pybind11_dir=f"{site_packages_dir}/pybind11/share/cmake/pybind11"

cmake_args = [
f"-DCMAKE_LIBRARY_OUTPUT_DIRECTORY={extdir}{os.sep}",
f"-DPYTHON_EXECUTABLE={sys.executable}",
Expand Down

0 comments on commit 7ad44b8

Please sign in to comment.