使用从brew安装的boost-python和boost 1.59版本

时间:2018-12-23 08:06:30

标签: boost cmake boost-python macos-high-sierra

我宁愿不使用1.59版,但由于openrave而不得不使用。

我使用brew安装了boost和boost-python。如果我安装了最新版本,则可以编译基本示例程序没有问题。但是,当我安装1.59版时,我似乎无法用cmake来找到这些库!

我有一个非常简单的cmakelists.txt文件:

CMAKE_MINIMUM_REQUIRED(VERSION 2.8.12 )                                                                            
PROJECT( test )                                                                                                    
SET(SOURCE                                                                                                         
 test.cpp                                                                                                          
)                                                                                                                  

find_package(PythonLibs 2.7 REQUIRED)                                                                              

FIND_PACKAGE(Boost COMPONENTS python27 numpy27 regex filesystem system thread iostreams date_time REQUIRED)                                                                                                                           

find_package(PythonLibs REQUIRED)                                                                                  
message("Include dirs of Python: " ${PYTHON_INCLUDE_DIRS} )                                                        
message("Libs of Python: " ${PYTHON_LIBRARIES} )                                                                   

ADD_EXECUTABLE( test  ${SOURCE})                                                                                   

include_directories(                                                                                               
    ${Boost_INCLUDE_DIRS}                                                                                          
    ${PYTHON_INCLUDE_DIRS}                                                                                         
)                                                                                                                  
target_link_libraries(test ${Boost_LIBRARIES} ${PYTHON_LIBRARIES})

最初,它什么也找不到:

  Unable to find the requested Boost libraries.

  Unable to find the Boost header files.  Please set BOOST_ROOT to the root
  directory containing Boost or BOOST_INCLUDEDIR to the directory containing
  Boost's headers.

然后我开始搞混BOOST_INCLUDEDIR等,以获取除python27和numpy27之外的所有内容!在我的设置中,我已经安装了

/usr/local/Cellar/boost\@1.59/
/usr/local/Cellar/boost-python\@1.59/

如果我愿意

BOOST_INCLUDEDIR=/usr/local/Cellar/boost\@1.59/1.59.0/include/  cmake ../

(我的构建目录在CMakeLists.txt文件下一级),它找到了增强但抱怨

boost_python27
boost_numpy27

任何将其付诸实践的帮助都是巨大的帮助。我拼命尝试在osx上构建openrave,但这是一场艰巨的斗争。

0 个答案:

没有答案