fix python binding Jamfile to detect BOOST_ROOT environment variable too

This commit is contained in:
arvidn 2015-08-09 21:23:11 -04:00
parent e38f461197
commit c99ad7b962
1 changed files with 49 additions and 36 deletions

View File

@ -3,11 +3,11 @@ import feature : feature ;
import project ;
import targets ;
import "class" : new ;
import modules ;
use-project /torrent : ../.. ;
lib boost_python : : <target-os>darwin <name>boost_python-mt $(boost-library-search-path) ;
lib boost_python : : <name>boost_python ;
BOOST_ROOT = [ modules.peek : BOOST_ROOT ] ;
feature visibility : default hidden : composite propagated link-incompatible ;
feature.compose <visibility>hidden : <cflags>-fvisibility=hidden <cxxflags>-fvisibility-inlines-hidden ;
@ -16,6 +16,35 @@ feature libtorrent-link : shared static : composite propagated ;
feature libtorrent-python-pic : off on : composite propagated link-incompatible ;
feature.compose <libtorrent-python-pic>on : <cflags>-fPIC ;
if $(BOOST_ROOT)
{
use-project /boost : $(BOOST_ROOT) ;
alias boost_python : /boost/python//boost_python : : : <include>$(BOOST_ROOT) ;
}
else
{
local boost-lib-search-path =
<search>/opt/local/lib
<search>/usr/lib
<search>/usr/local/lib
<search>/sw/lib
<search>/usr/g++/lib
;
local boost-include-path =
<include>/opt/local/include
<include>/usr/local/include
<include>/usr/sfw/include
;
# the names are decorated in MacPorts
lib boost_python : : <target-os>darwin <name>boost_python-mt
: : $(boost-include-path) ;
lib boost_python : : <name>boost_python
: : $(boost-include-path) ;
}
rule libtorrent_linking ( properties * )
{
@ -45,46 +74,30 @@ rule libtorrent_linking ( properties * )
ECHO "WARNING: you probably want to specify libtorrent-link=static rather than link=static" ;
}
if <boost>source in $(properties)
if <boost-link>static in $(properties) && <target-os>linux in $(properties)
{
if <boost-link>static in $(properties) && <target-os>linux in $(properties)
{
ECHO "WARNING: you cannot link statically against boost-python on linux, because it links against pthread statically in that case, which is not allowed" ;
}
ECHO "WARNING: you cannot link statically against boost-python on linux, because it links against pthread statically in that case, which is not allowed" ;
}
# linux must link dynamically against boost python because it pulls
# in libpthread, which must be linked dynamically since we're building a .so
# (the static build of libpthread is not position independent)
if <boost-link>shared in $(properties) || <target-os>linux in $(properties)
{
result += <library>/boost/python//boost_python/<link>shared ;
}
else
{
result += <library>/boost/python//boost_python/<link>static ;
}
if <libtorrent-link>shared in $(properties)
{
result += <library>/torrent//torrent/<link>shared/<boost-link>shared ;
}
else
{
result += <library>/torrent//torrent/<link>static/<boost-link>static ;
}
# linux must link dynamically against boost python because it pulls
# in libpthread, which must be linked dynamically since we're building a .so
# (the static build of libpthread is not position independent)
if <boost-link>shared in $(properties) || <target-os>linux in $(properties)
{
result += <library>boost_python/<link>shared ;
}
else
{
result += <library>boost_python ;
result += <library>boost_python/<link>static ;
}
if <libtorrent-link>shared in $(properties)
{
result += <library>/torrent//torrent/<link>shared/<boost-link>shared ;
}
else
{
result += <library>/torrent//torrent/<link>static/<boost-link>static ;
}
if <libtorrent-link>shared in $(properties)
{
result += <library>/torrent//torrent/<link>shared/<boost-link>shared ;
}
else
{
result += <library>/torrent//torrent/<link>static/<boost-link>static ;
}
return $(result) ;