simplify Jamfile by determining whether to use boost from source or from system installed version based on the BOOST_ROOT environment variable. This removes the build feature boost=source/boost=system

This commit is contained in:
arvidn 2015-08-08 19:18:05 -04:00
parent 3963d47385
commit a854fed12b
8 changed files with 79 additions and 97 deletions

108
Jamfile
View File

@ -13,14 +13,49 @@ BOOST_ROOT = [ modules.peek : BOOST_ROOT ] ;
CXXFLAGS = [ modules.peek : CXXFLAGS ] ; CXXFLAGS = [ modules.peek : CXXFLAGS ] ;
LDFLAGS = [ modules.peek : LDFLAGS ] ; LDFLAGS = [ modules.peek : LDFLAGS ] ;
ECHO "BOOST_ROOT =" $(BOOST_ROOT) ;
ECHO "CXXFLAGS =" $(CXXFLAGS) ; ECHO "CXXFLAGS =" $(CXXFLAGS) ;
ECHO "LDFLAGS =" $(LDFLAGS) ; ECHO "LDFLAGS =" $(LDFLAGS) ;
ECHO "OS =" [ os.name ] ; ECHO "OS =" [ os.name ] ;
if $(BOOST_ROOT) if $(BOOST_ROOT)
{ {
ECHO "building boost from source directory: " $(BOOST_ROOT) ;
use-project /boost : $(BOOST_ROOT) ; use-project /boost : $(BOOST_ROOT) ;
alias boost_chrono : /boost/chrono//boost_chrono : : : <include>$(BOOST_ROOT) ;
alias boost_system : /boost/system//boost_system : : : <include>$(BOOST_ROOT) ;
alias boost_random : /boost/random//boost_random : : : <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_chrono : : <target-os>darwin <name>boost_chrono-mt $(boost-lib-search-path)
: : $(boost-include-path) ;
lib boost_system : : <target-os>darwin <name>boost_system-mt $(boost-lib-search-path)
: : $(boost-include-path) ;
lib boost_random : : <target-os>darwin <name>boost_random-mt $(boost-lib-search-path)
: : $(boost-include-path) ;
lib boost_chrono : : <name>boost_chrono $(boost-lib-search-path)
: : $(boost-include-path) ;
lib boost_system : : <name>boost_system $(boost-lib-search-path)
: : $(boost-include-path) ;
lib boost_random : : <name>boost_random $(boost-lib-search-path)
: : $(boost-include-path) ;
} }
VERSION = 1.1.0 ; VERSION = 1.1.0 ;
@ -171,8 +206,6 @@ rule linking ( properties * )
result += <linkflags>-export-dynamic <linkflags>-rdynamic ; result += <linkflags>-export-dynamic <linkflags>-rdynamic ;
} }
if <boost>source in $(properties)
{
if <boost-link>static in $(properties) if <boost-link>static in $(properties)
{ {
if <link>shared in $(properties) if <link>shared in $(properties)
@ -182,15 +215,15 @@ rule linking ( properties * )
# need to make boost think it's being built as a shared # need to make boost think it's being built as a shared
# library, so that it properly exports its symbols # library, so that it properly exports its symbols
result += <define>BOOST_ALL_DYN_LINK ; result += <define>BOOST_ALL_DYN_LINK ;
result += <library>/boost/system//boost_system/<link>static/<define>BOOST_ALL_DYN_LINK ; result += <library>boost_system/<link>static/<define>BOOST_ALL_DYN_LINK ;
result += <library>/boost/chrono//boost_chrono/<link>static/<define>BOOST_ALL_DYN_LINK ; result += <library>boost_chrono/<link>static/<define>BOOST_ALL_DYN_LINK ;
result += <library>/boost/random//boost_random/<link>static/<define>BOOST_ALL_DYN_LINK ; result += <library>boost_random/<link>static/<define>BOOST_ALL_DYN_LINK ;
} }
else else
{ {
result += <library>/boost/system//boost_system/<link>static ; result += <library>boost_system/<link>static ;
result += <library>/boost/chrono//boost_chrono/<link>static ; result += <library>boost_chrono/<link>static ;
result += <library>/boost/random//boost_random/<link>static ; result += <library>boost_random/<link>static ;
} }
if <toolset>gcc in $(properties) if <toolset>gcc in $(properties)
@ -202,40 +235,14 @@ rule linking ( properties * )
} }
else else
{
result += <library>/boost/system//boost_system/<link>shared ;
result += <library>/boost/chrono//boost_chrono/<link>shared ;
result += <library>/boost/random//boost_random/<link>shared ;
}
result += <include>$(BOOST_ROOT)
<define>BOOST_ALL_NO_LIB
<define>BOOST_MULTI_INDEX_DISABLE_SERIALIZATION
;
}
else
{
if <boost-link>static in $(properties)
{
result += <library>boost_system/<link>static ;
result += <library>boost_chrono/<link>static ;
result += <library>boost_random/<link>static ;
}
else
{ {
result += <library>boost_system/<link>shared ; result += <library>boost_system/<link>shared ;
result += <library>boost_chrono/<link>shared ; result += <library>boost_chrono/<link>shared ;
result += <library>boost_random/<link>shared ; result += <library>boost_random/<link>shared ;
} }
result += <define>BOOST_ALL_NO_LIB
# on mac the boost headers are installed in <define>BOOST_MULTI_INDEX_DISABLE_SERIALIZATION
# a directory that isn't automatically accessable
# on open indiana, boost is install at /usr/g++/include
result += <include>/opt/local/include/boost-1_35
<include>/opt/local/include
<include>/usr/g++/include
; ;
}
return $(result) ; return $(result) ;
} }
@ -486,7 +493,6 @@ feature.compose <character-set>unicode : <define>_UNICODE <define>UNICODE ;
feature deprecated-functions : on off : composite propagated link-incompatible ; feature deprecated-functions : on off : composite propagated link-incompatible ;
feature.compose <deprecated-functions>off : <define>TORRENT_NO_DEPRECATE ; feature.compose <deprecated-functions>off : <define>TORRENT_NO_DEPRECATE ;
feature boost : system source : link-incompatible propagated ;
feature boost-link : static shared : propagated composite ; feature boost-link : static shared : propagated composite ;
feature debug-iterators : off on : composite propagated link-incompatible ; feature debug-iterators : off on : composite propagated link-incompatible ;
@ -543,26 +549,6 @@ lib gcc : : <name>gcc <link>static ;
# when using iconv # when using iconv
lib libiconv : : <name>iconv <link>shared <search>/usr/local/lib ; lib libiconv : : <name>iconv <link>shared <search>/usr/local/lib ;
local boost-library-search-path =
<search>/opt/local/lib
<search>/usr/lib
<search>/usr/local/lib
<search>/sw/lib
<search>/usr/g++/lib
;
lib boost_system : : <target-os>darwin <name>boost_system-mt $(boost-library-search-path) ;
lib boost_system : : <target-os>solaris <name>boost_system $(boost-library-search-path) ;
lib boost_system : : <name>boost_system ;
lib boost_chrono : : <target-os>darwin <name>boost_chrono-mt $(boost-library-search-path) ;
lib boost_chrono : : <target-os>solaris <name>boost_chrono $(boost-library-search-path) ;
lib boost_chrono : : <name>boost_chrono ;
lib boost_random : : <target-os>darwin <name>boost_random-mt $(boost-library-search-path) ;
lib boost_random : : <target-os>solaris <name>boost_random $(boost-library-search-path) ;
lib boost_random : : <name>boost_random ;
# openssl on linux/bsd/macos etc. # openssl on linux/bsd/macos etc.
lib gcrypt : : <name>gcrypt <link>shared <search>/opt/local/lib ; lib gcrypt : : <name>gcrypt <link>shared <search>/opt/local/lib ;
lib z : : <link>shared <name>z <search>/usr/lib ; lib z : : <link>shared <name>z <search>/usr/lib ;
@ -748,8 +734,8 @@ local usage-requirements =
<toolset>msvc,<variant>release:<linkflags>/OPT:ICF=5 <toolset>msvc,<variant>release:<linkflags>/OPT:ICF=5
<toolset>msvc,<variant>release:<linkflags>/OPT:REF <toolset>msvc,<variant>release:<linkflags>/OPT:REF
<boost>system:<cxxflags>$(CXXFLAGS) <cxxflags>$(CXXFLAGS)
<boost>system:<linkflags>$(LDFLAGS) <linkflags>$(LDFLAGS)
# this works around a bug in asio in boost-1.39 # this works around a bug in asio in boost-1.39
<define>BOOST_ASIO_HASH_MAP_BUCKETS=1021 <define>BOOST_ASIO_HASH_MAP_BUCKETS=1021
<tag>@tag <tag>@tag
@ -775,7 +761,7 @@ lib torrent
<conditional>@building <conditional>@building
<conditional>@warnings <conditional>@warnings
<boost>system:<cxxflags>$(CXXFLAGS) <cxxflags>$(CXXFLAGS)
# disable bogus deprecation warnings on msvc8 # disable bogus deprecation warnings on msvc8
<toolset>msvc:<define>_SCL_SECURE_NO_DEPRECATE <toolset>msvc:<define>_SCL_SECURE_NO_DEPRECATE

View File

@ -42,4 +42,4 @@ cache:
- C:\OpenSSL-Win32 - C:\OpenSSL-Win32
build_script: build_script:
- cd %ROOT_DIRECTORY%\test - cd %ROOT_DIRECTORY%\test
- b2.exe -j2 %compiler% boost=source variant=%variant% link=shared linkflags=%linkflags% include="C:\\OpenSSL-Win32\\include" warnings=off --abbreviate-paths - b2.exe -j2 %compiler% variant=%variant% link=shared linkflags=%linkflags% include="C:\\OpenSSL-Win32\\include" warnings=off --abbreviate-paths

View File

@ -71,7 +71,7 @@ if '--bjam' in sys.argv or ldflags == None or extra_cmd == None:
parallel_builds = ' -j%d' % multiprocessing.cpu_count() parallel_builds = ' -j%d' % multiprocessing.cpu_count()
# build libtorrent using bjam and build the installer with distutils # build libtorrent using bjam and build the installer with distutils
cmdline = 'b2 boost=source libtorrent-link=static boost-link=static release optimization=space stage_module --abbreviate-paths' + toolset + parallel_builds cmdline = 'b2 libtorrent-link=static boost-link=static release optimization=space stage_module --abbreviate-paths' + toolset + parallel_builds
print(cmdline) print(cmdline)
if os.system(cmdline) != 0: if os.system(cmdline) != 0:
print('build failed') print('build failed')

View File

@ -155,11 +155,15 @@ Then the only thing left is simply to invoke ``bjam``. If you want to specify
a specific toolset to use (compiler) you can just add that to the commandline. a specific toolset to use (compiler) you can just add that to the commandline.
For example:: For example::
bjam msvc-7.1 boost=source bjam msvc-7.1
bjam gcc-3.3 boost=source bjam gcc-3.3
bjam darwin-4.0 boost=source bjam darwin-4.0
If you're building against a system installed boost, specify ``boost=system``. .. note::
If the environment variable ``BOOST_ROOT`` is not set, the jamfile will
attempt to link against "installed" boost libraries. i.e. assume the headers
and libraries are available in default search paths.
To build different versions you can also just add the name of the build To build different versions you can also just add the name of the build
variant. Some default build variants in BBv2 are ``release``, ``debug``, variant. Some default build variants in BBv2 are ``release``, ``debug``,
@ -173,7 +177,7 @@ can set the ``runtime-link`` feature on the commandline, either to ``shared``
or ``static``. Most operating systems will only allow linking shared against or ``static``. Most operating systems will only allow linking shared against
the runtime, but on windows you can do both. Example:: the runtime, but on windows you can do both. Example::
bjam msvc-7.1 link=static runtime-link=static boost=source bjam msvc-7.1 link=static runtime-link=static
.. note:: .. note::
@ -236,14 +240,6 @@ Build features:
+--------------------------+----------------------------------------------------+ +--------------------------+----------------------------------------------------+
| boost build feature | values | | boost build feature | values |
+==========================+====================================================+ +==========================+====================================================+
| ``boost`` | * ``system`` - default. Tells the Jamfile that |
| | boost is installed and should be linked against |
| | the system libraries. |
| | * ``source`` - Specifies that boost is to be built |
| | from source. The environment variable |
| | ``BOOST_ROOT`` must be defined to point to the |
| | boost directory. |
+--------------------------+----------------------------------------------------+
| ``boost-link`` | * ``static`` - links statically against the boost | | ``boost-link`` | * ``static`` - links statically against the boost |
| | libraries. | | | libraries. |
| | * ``shared`` - links dynamically against the boost | | | * ``shared`` - links dynamically against the boost |

View File

@ -67,7 +67,7 @@ build variants, see `libtorrent build options`_.
For example:: For example::
$ bjam dht-support=on boost=source release link=static $ bjam dht-support=on link=static
On Mac OS X, this will produce the following python module:: On Mac OS X, this will produce the following python module::

View File

@ -1,5 +1,5 @@
REM this is just to get libtorrent built REM this is just to get libtorrent built
bjam -j8 msvc-12.0 boost=source invariant-checks=off asserts=off link=shared boost-link=shared test_primitives linkflags=/profile deprecated-functions=off bjam -j8 msvc-12.0 invariant-checks=off asserts=off link=shared boost-link=shared test_primitives linkflags=/profile deprecated-functions=off
Vsinstr -coverage ..\bin\msvc-12.0\debug\asserts-off\boost-link-shared\boost-source\debug-iterators-on\deprecated-functions-off\export-extra-on\invariant-checks-off\threading-multi\torrent.dll @vsinstr_excludes.rsp Vsinstr -coverage ..\bin\msvc-12.0\debug\asserts-off\boost-link-shared\boost-source\debug-iterators-on\deprecated-functions-off\export-extra-on\invariant-checks-off\threading-multi\torrent.dll @vsinstr_excludes.rsp
@ -13,7 +13,7 @@ set path=%path%;c:\Program Files (x86)\Microsoft Visual Studio 12.0\Team Tools\P
Start vsperfmon -coverage -output:test.coverage Start vsperfmon -coverage -output:test.coverage
REM Now we run all the unit tests to record test coverage REM Now we run all the unit tests to record test coverage
bjam -j8 msvc-12.0 boost=source invariant-checks=off asserts=off link=shared boost-link=shared linkflags=/profile deprecated-functions=off bjam -j8 msvc-12.0 invariant-checks=off asserts=off link=shared boost-link=shared linkflags=/profile deprecated-functions=off
vsperfcmd -shutdown vsperfcmd -shutdown

View File

@ -203,7 +203,7 @@ def main(argv):
test_dirs = [] test_dirs = []
build_dirs = [] build_dirs = []
configs = [] configs = []
options = ['boost=source', 'preserve-test-targets=on'] options = ['preserve-test-targets=on']
time_limit = 1200 time_limit = 1200
for arg in argv: for arg in argv:

View File

@ -13,7 +13,7 @@ function run_test {
cd test cd test
set +e set +e
bjam asserts=off invariant-checks=off link=static boost=source deprecated-functions=off debug-iterators=off test-coverage=on picker-debugging=off -j4 $1 bjam asserts=off invariant-checks=off link=static deprecated-functions=off debug-iterators=off test-coverage=on picker-debugging=off -j4 $1
set -e set -e
cd .. cd ..