Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compiled successfully #33

Open
yuzhuhua opened this issue Jul 30, 2024 · 0 comments
Open

Compiled successfully #33

yuzhuhua opened this issue Jul 30, 2024 · 0 comments

Comments

@yuzhuhua
Copy link

yuzhuhua commented Jul 30, 2024

CMAKE_SOURCE_DIR = C:/Users/15156/Desktop/pyboostcvconverter-master

CMAKE_BINARY_DIR = C:/Users/15156/Desktop/pyboostcvconverter-master/build

all: cmake_check_build_system
$(CMAKE_COMMAND) -E cmake_progress_start C:/Users/15156/Desktop/pyboostcvconverter-master/build/CMakeFiles C:/Users/15156/Desktop/pyboostcvconverter-master/build/CMakeFiles/progress.marks
$(MAKE) -f CMakeFiles/Makefile2 all
$(CMAKE_COMMAND) -E cmake_progress_start C:/Users/15156/Desktop/pyboostcvconverter-master/build/CMakeFiles 0
.PHONY : all

Create a build folder yourself

Step 1: Download and Unzip pbcvt Source Code
Download the pbcvt source code zip file to the target directory, e.g., C:\Users\15156\Desktop.
Unzip the source code. The path after unzipping should be C:\Users\15156\Desktop\pyboostcvconverter-master.
Step 2: Install Required Dependencies
Ensure the following software is installed:

Visual Studio 2022 (Build Tools)
CMake
Conda
Install Boost using Conda:

conda install -c conda-forge boost
Step 3: Create and Activate Conda Environment

conda create -n qiege python=3.8
conda activate qiege
Step 4: Get Python and NumPy Paths
Retrieve the paths for Python and NumPy:

python -c "from distutils.sysconfig import get_python_inc; print(get_python_inc())"
python -c "import numpy; print(numpy.get_include())"
Step 5: Get Boost Library Paths
Retrieve the Boost library paths:

echo $env:CONDA_PREFIX
Find the paths for Boost libraries and headers:

Get-ChildItem -Path $env:CONDA_PREFIX -Recurse -Filter "boost_python*.lib"
Get-ChildItem -Path $env:CONDA_PREFIX -Recurse -Filter "boost"
Step 6: Configure and Compile pbcvt
Navigate to the build directory and run the CMake configuration command:

mkdir build
cd build

cmake -DCMAKE_BUILD_TYPE=Release -DPYTHON_DESIRED_VERSION=3.8
-DPYTHON3_INCLUDE_DIR=C:/Users/15156/.conda/envs/qiege/include -DPYTHON3_NUMPY_INCLUDE_DIRS=C:/Users/15156/.conda/envs/qiege/lib/site-packages/numpy/core/include
-DPYTHON3_LIBRARY=C:/Users/15156/.conda/envs/qiege/libs/python38.lib -DBoost_INCLUDE_DIR=C:/Users/15156/.conda/envs/qiege/Library/include
-DBoost_LIBRARY_DIR=C:/Users/15156/.conda/envs/qiege/Library/lib -DBOOST_ROOT=C:/Users/15156/.conda/envs/qiege/Library
-DBoost_NO_SYSTEM_PATHS=ON -DBoost_NO_BOOST_CMAKE=ON
-DBoost_PYTHON_LIBRARY_RELEASE=C:/Users/15156/.conda/envs/qiege/Library/lib/boost_python38.lib -DBoost_PYTHON_LIBRARY_DEBUG=C:/Users/15156/.conda/envs/qiege/Library/lib/boost_python38.lib
-DBoost_PYTHON38_LIBRARY=C:/Users/15156/.conda/envs/qiege/Library/lib/boost_python38.lib `
-DBoost_PYTHON38_LIBRARIES=C:/Users/15156/.conda/envs/qiege/Library/lib/boost_python38.lib ..
Compile the project:

cmake --build . --config Release
Step 7: Move the Generated .pyd File
Locate the generated pbcvt.cp38-win_amd64.pyd file and copy it to the target directory, e.g., C:/Users/15156/Desktop/pyproject/yzh/tracker/.

Step 8: Import and Use the pbcvt Module
Add the following code to your Python script to ensure the path is correct and to import the pbcvt module:

import sys
sys.path.append('C:/Users/15156/Desktop/pyproject/yzh/tracker') # Replace with the actual path

import pbcvt

Use functions from pbcvt

result = pbcvt.example_function() # Replace with the actual function name
print(result)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant