From e4e783685338df68cecc8748e16f42b96cba1ea2 Mon Sep 17 00:00:00 2001 From: hanskw-weston Date: Wed, 29 May 2024 10:30:19 +0800 Subject: [PATCH] setup: adjust lib output dir --- README.md | 11 +++++++---- setup.py | 4 ++-- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 99b1056b..037a8b3b 100755 --- a/README.md +++ b/README.md @@ -94,17 +94,20 @@ For development and testing, you can use inplace build $ python setup.py build_ext --inplace ``` -It will generate library files in build/temp.linux-x86_64-3.10/lib (the name could be different based on your system). -You can add the path to the PYTHONPATH environment variable to use the library. Please note that setting the PYTHONPATH directly in the shell will only affect the current session. +It will generate library files in build/temp.linux-x86_64-3.10/lib (the name could be different based on your system) and in the directory where you run the command. + +You can then use the library in a python script from the same directory directly. If you want to use the library in other directories, you can add the path to the PYTHONPATH environment variable. + +Please note that setting the PYTHONPATH directly in the shell will only affect the current session. ```bash -$ export PYTHONPATH=$PYTHONPATH:/build/temp.linux-x86_64-3.10/lib +$ export PYTHONPATH=$PYTHONPATH:/build/lib.linux-x86_64-3.10 ``` You can also install the package to your Python environment using ```bash -$ python setup.py install +$ python3 -m pip install . ``` ## Setup CAN-To-USB Adapter diff --git a/setup.py b/setup.py index 73042d24..e00ca7a0 100644 --- a/setup.py +++ b/setup.py @@ -34,7 +34,7 @@ def build_extension(self, ext): cfg = 'Debug' if debug else 'Release' cmake_args = [ - f"-DPYBIND_OUTPUT_LIBDIR={extdir}{os.sep}{ext.name}{os.sep}", + f"-DPYBIND_OUTPUT_LIBDIR={extdir}{os.sep}", f"-DPYTHON_EXECUTABLE={sys.executable}", f"-DCMAKE_BUILD_TYPE={cfg}", f"-DPYTHON_BINDING=ON" @@ -49,7 +49,7 @@ def build_extension(self, ext): build_temp = Path(self.build_temp) / ext.name if not build_temp.exists(): build_temp.mkdir(parents=True) - lib_path = Path(f"{extdir}{os.sep}{ext.name}{os.sep}") + lib_path = Path(f"{extdir}{os.sep}") if not lib_path.exists(): lib_path.mkdir(parents=True)