如何创建JAMROOT文件以生成链接到C ++共享库的cppObjConverter.cpp的python .so文件

时间:2018-04-06 07:21:49

标签: python c++ boost shared-libraries boost-bjam

我有3个共享库通过c ++生成  1. libfile1.so
 2. libfile2.so
 3. libfile2.so

我还有2个外部共享库 1. gumbo-parser
2. libcurl

我还有两个文件:
 这个文件包括升级库
    --->的 cppObjConverter.cpp
 2.此文件调用cpp对象以获取python对象中的数据     ---> cppObjCaller.py

我想生成与c ++共享库链接的.so文件 converter.so ,以便在python中导入它。

请建议Jamroot文件结构:
示例文件如下:

import python ;

if ! [ python.configured ]
{
   ECHO "notice: no Python configured in user-config.jam" ;
    ECHO "notice: will use default configuration" ;
    using python ;
}

# Specify the path to the Boost project. If you move this project,
# adjust this path to refer to the Boost root directory
use-project converter_project
  : ../../../.. ;

# Set up the project-wide requirements that everything uses the boost_python library from the project whose global ID is /boost/python.
project
  : requirements <library>/boost/python//boost_python <implicit-dependency>/boost//headers
  : usage-requirements <implicit-dependency>/boost//headers ;

# Declare the three extension modules. You can specify multiple source files after the colon separated by spaces.
python-extension converter : cppObjConverter.cpp -L. -lfile1 -lfile1 -lfile1 -lboost_python ``pkg-config --cflags --libs gumbo`` -lcurl;
#I am not sure of above code line, I am expecting this as we do in c++ while generate object file linked to shared lib to generate common .so

# Put the extension and Boost.Python DLL in the current directory, so that running script by hand works.
install convenient_copy
  : converter
  : <install-dependencies>on <install-type>SHARED_LIB <install-type>PYTHON_EXTENSION <location>.
  ;

# A little "rule" (function) to clean up the syntax of declaring tests of these extension modules.
local rule run-test ( test-name : sources + )
{
    import testing ;     testing.make-test run-pyd : $(sources) : : $(test-name) ; }

# Declare test targets
run-test doctest : converter cppObjCaller.py ;

0 个答案:

没有答案