Jamroot (boost-bjam) 与共享库链接
Jamroot (boost-bjam) linking with shared libraries
我正在使用 Jamroot/boost-bjam 为 C++ 代码构建 python 绑定:
alias boost_dependencies
: /boost/python//boost_python
/boost/thread//boost_thread
;
# Platform architecture provided as an environment variable
import os ;
local ARCH = [ os.environ ARCH ] ;
# 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_dependencies
<include>../
<include>../../
: requirements
<library-path>../../thirdparty/opencv/lib/
<linkflags>-lm
<linkflags>-lpthread
<linkflags>-lcrypto
<linkflags>-lssl
;
# Declare the three extension modules. You can specify multiple
# source files after the colon separated by spaces.
python-extension test_library : src/Test.cpp
我想 link 在 opencv 项目 (../../thirdparty/opencv/lib/) 中使用共享库,例如 libopencv_core.dylib、libopencv_video.dylib 等 mac。如何在 Jamroot 文件中指定库并安装它们?
我使用 lib 选项解决了这个问题:
lib opencv_core : : <name>libopencv_core <search>../../thirdparty/opencv/build/$(ARCH)/lib/ ;
lib opencv_video : : <name>libopencv_video <search>../../thirdparty/opencv/build/$(ARCH)/lib/ ;
lib opencv_ml : : <name>libopencv_ml <search>../../thirdparty/opencv/build/$(ARCH)/lib/ ;
lib opencv_imgproc : : <name>libopencv_imgproc <search>../../thirdparty/opencv/build/$(ARCH)/lib/ ;
lib opencv_objdetect : : <name>libopencv_objdetect <search>../../thirdparty/opencv/build/$(ARCH)/lib/ ;
# 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_dependencies
<include>../
<include>../../
: requirements <library>../../Common/build/$(ARCH)/lib/libCommon.a
<library>../../Vision/build/$(ARCH)/lib/libVision.a
<library-path>../../thirdparty/opencv/build/$(ARCH)/lib/
<library>../../thirdparty/opencv/build/$(ARCH)/lib/python2.7/site-packages/cv2.so
<linkflags>-lopencv_core
<linkflags>-lopencv_video
<linkflags>-lopencv_ml
<linkflags>-lopencv_imgproc
<linkflags>-lopencv_objdetect
;
我正在使用 Jamroot/boost-bjam 为 C++ 代码构建 python 绑定:
alias boost_dependencies
: /boost/python//boost_python
/boost/thread//boost_thread
;
# Platform architecture provided as an environment variable
import os ;
local ARCH = [ os.environ ARCH ] ;
# 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_dependencies
<include>../
<include>../../
: requirements
<library-path>../../thirdparty/opencv/lib/
<linkflags>-lm
<linkflags>-lpthread
<linkflags>-lcrypto
<linkflags>-lssl
;
# Declare the three extension modules. You can specify multiple
# source files after the colon separated by spaces.
python-extension test_library : src/Test.cpp
我想 link 在 opencv 项目 (../../thirdparty/opencv/lib/) 中使用共享库,例如 libopencv_core.dylib、libopencv_video.dylib 等 mac。如何在 Jamroot 文件中指定库并安装它们?
我使用 lib 选项解决了这个问题:
lib opencv_core : : <name>libopencv_core <search>../../thirdparty/opencv/build/$(ARCH)/lib/ ;
lib opencv_video : : <name>libopencv_video <search>../../thirdparty/opencv/build/$(ARCH)/lib/ ;
lib opencv_ml : : <name>libopencv_ml <search>../../thirdparty/opencv/build/$(ARCH)/lib/ ;
lib opencv_imgproc : : <name>libopencv_imgproc <search>../../thirdparty/opencv/build/$(ARCH)/lib/ ;
lib opencv_objdetect : : <name>libopencv_objdetect <search>../../thirdparty/opencv/build/$(ARCH)/lib/ ;
# 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_dependencies
<include>../
<include>../../
: requirements <library>../../Common/build/$(ARCH)/lib/libCommon.a
<library>../../Vision/build/$(ARCH)/lib/libVision.a
<library-path>../../thirdparty/opencv/build/$(ARCH)/lib/
<library>../../thirdparty/opencv/build/$(ARCH)/lib/python2.7/site-packages/cv2.so
<linkflags>-lopencv_core
<linkflags>-lopencv_video
<linkflags>-lopencv_ml
<linkflags>-lopencv_imgproc
<linkflags>-lopencv_objdetect
;