Skip to content

pypros/boost_python_bindings

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

boost_python_bindings

Setup env

docker-compose up -d

Log on to container

docker-compose exec boost_python sh

Boost bindings

  1. Creat symboli link to python3. Deflaut boost python creat only -lboost_python which is library to python2.
ln -s /usr/lib/x86_64-linux-gnu/libboost_python-py36.so /usr/lib/x86_64-linux-gnu/libboost_python3.so
  1. Make folder and name it build
mkdir build
  1. Go to root folder project and do all steps:

  2. Build Rectangle.o - object file

g++ -o build/Rectangle.o -c cpp_code/library_rectangle/src/Rectangle.cpp -Wall -fPIC -I/usr/include/python3.6 -Icpp_code/library_rectangle/inc/
  1. Build Square.o - object file
g++ -o build/Square.o -c cpp_code/library_square/src/Square.cpp -Wall -fPIC -I/usr/include/python3.6 -Icpp_code/library_square/inc/
  1. Build Square.o - object file
g++ -o build/Shapes.o -c boost_bindings/Shapes.cpp -Wall -fPIC -I/usr/include/python3.6 -Icpp_code/library_rectangle/inc/ -Icpp_code/library_square/inc/
  1. Build shapes.so - shared object library - which will be import to python
g++ -shared -o shapes.so build/Rectangle.o  build/Shapes.o  build/Square.o -L/usr/local/lib -lpython3.6m -lboost_python3 -lboost_system
  1. in root folder run
python3
  1. Import shapes library
from shapes import Rectangle, Square

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages