1 # This Jamfile requires boost-build v2 to build.
2 # The version shipped with boost 1.34.0
7 import feature : feature ;
9 BOOST_ROOT = [ modules.peek : BOOST_ROOT ] ;
10 CXXFLAGS = [ modules.peek : CXXFLAGS ] ;
11 LDFLAGS = [ modules.peek : LDFLAGS ] ;
13 ECHO "BOOST_ROOT =" $(BOOST_ROOT) ;
14 ECHO "OS =" [ os.name ] ;
18 use-project /boost : $(BOOST_ROOT) ;
21 # rule for linking the correct libraries depending
22 # on features and target-os
23 rule linking ( properties * )
27 # openssl libraries, if enabled
28 if <openssl>sha-1 in $(properties)
29 || <openssl>pe in $(properties)
31 # exclude gcc from a regular windows build to make mingw
32 # link against the regular unix library name
34 if <target-os>windows in $(properties)
36 result += <library>gdi32 ;
39 if <target-os>windows in $(properties) && ! <toolset>gcc in $(properties)
41 result += <library>ssleay32
50 result += <library>crypto <library>ssl ;
54 if <geoip>shared in $(properties)
56 result += <library>GeoIP ;
59 # socket functions on windows require winsock libraries
60 if <target-os>windows in $(properties)
61 || <target-os>cygwin in $(properties)
63 result += <library>ws2_32
65 <define>WIN32_LEAN_AND_MEAN
66 <define>_WIN32_WINNT=0x0500
67 <define>__USE_W32_SOCKETS
73 if <test-coverage>on in $(properties)
74 && ( <toolset>gcc in $(properties)
75 || <toolset>darwin in $(properties) )
77 result += <cxxflags>-fprofile-arcs <cxxflags>-ftest-coverage ;
80 # clock_gettime on linux requires librt
81 if <need-librt>yes in $(properties)
83 result += <library>librt ;
86 if <tcmalloc>yes in $(properties)
88 result += <library>tcmalloc ;
91 if <boost>system in $(properties)
93 result += <library>boost_filesystem
95 <library>boost_iostreams
100 if <toolset>gcc in $(properties)
101 && <target-os>linux in $(properties)
102 && <variant>debug in $(properties)
104 # for backtraces in assertion failures
105 # which only works on ELF targets with gcc
106 result += <linkflags>-export-dynamic <cxxflags>-rdynamic ;
109 if <boost>source in $(properties)
111 if <boost-link>static in $(properties)
113 result += <library>/boost/thread//boost_thread/<link>static
114 <library>/boost/filesystem//boost_filesystem/<link>static
115 <library>/boost/iostreams//boost_iostreams/<link>static
116 <library>/boost/system//boost_system/<link>static
117 <include>$(BOOST_ROOT)
118 <define>BOOST_ALL_NO_LIB
123 result += <library>/boost/thread//boost_thread/<link>shared
124 <library>/boost/filesystem//boost_filesystem/<link>shared
125 <library>/boost/iostreams//boost_iostreams/<link>shared
126 <library>/boost/system//boost_system/<link>shared
127 <include>$(BOOST_ROOT)
128 <define>BOOST_ALL_NO_LIB
133 if <boost>system in $(properties)
135 # on mac the boost headers are installed in
136 # a directory that isn't automatically accessable
137 result += <include>/opt/local/include/boost-1_35
138 <include>/opt/local/include/boost
145 # rule for adding the right source files
146 # depending on target-os and features
147 rule building ( properties * )
151 if ( <target-os>linux in $(properties)
152 || <target-os>darwin in $(properties) )
153 && ( <toolset>gcc in $(properties)
154 || <toolset>darwin in $(properties) )
156 result += <source>src/assert.cpp ;
159 if <geoip>static in $(properties)
161 result += <source>src/GeoIP.c ;
164 if <openssl>off in $(properties)
166 result += <source>src/sha1.cpp ;
170 if <openssl>pe in $(properties)
172 result += <source>src/pe_crypto.cpp ;
176 if <target-os>windows in $(properties)
178 result += <source>src/file_win.cpp ;
182 result += <source>src/file.cpp ;
185 if <memdebug>on in $(properties)
187 result += <source>src/memdebug.cpp ;
193 feature tcmalloc : no yes : composite propagated link-incompatible ;
195 feature need-librt : no yes : composite propagated link-incompatible ;
197 feature pool-allocators : on off : composite propagated link-incompatible ;
198 feature.compose <pool-allocators>off : <define>TORRENT_DISABLE_POOL_ALLOCATOR ;
200 feature geoip : off static shared : composite propagated link-incompatible ;
201 feature.compose <geoip>off : <define>TORRENT_DISABLE_GEO_IP ;
203 feature bandwidth-limit-logging : off on : composite propagated link-incompatible ;
204 feature.compose <bandwidth-limit-logging>on : <define>TORRENT_VERBOSE_BANDWIDTH_LIMIT ;
206 feature invariant-checks : on off full : composite propagated link-incompatible ;
207 feature.compose <invariant-checks>off : <define>TORRENT_DISABLE_INVARIANT_CHECKS ;
208 feature.compose <invariant-checks>full : <define>TORRENT_EXPENSIVE_INVARIANT_CHECKS ;
210 feature disk-stats : off on : composite propagated link-incompatible ;
211 feature.compose <disk-stats>on : <define>TORRENT_DISK_STATS ;
213 feature memdebug : off on : composite propagated ;
214 feature.compose <memdebug>on : <define>TORRENT_MEMDEBUG ;
216 feature logging : none default errors verbose : composite propagated link-incompatible ;
217 feature.compose <logging>default : <define>TORRENT_LOGGING ;
218 feature.compose <logging>errors : <define>TORRENT_ERROR_LOGGING ;
219 feature.compose <logging>verbose : <define>TORRENT_VERBOSE_LOGGING ;
221 feature dht-support : on off logging : composite propagated link-incompatible ;
222 feature.compose <dht-support>off : <define>TORRENT_DISABLE_DHT ;
223 feature.compose <dht-support>logging : <define>TORRENT_DHT_VERBOSE_LOGGING ;
225 feature openssl : pe sha-1 off : composite propagated link-incompatible ;
226 feature.compose <openssl>pe : <define>TORRENT_USE_OPENSSL ;
227 feature.compose <openssl>sha-1 : <define>TORRENT_USE_OPENSSL <define>TORRENT_DISABLE_ENCRYPTION ;
228 feature.compose <openssl>off : <define>TORRENT_DISABLE_ENCRYPTION ;
230 feature resolve-countries : on off : composite propagated link-incompatible ;
231 feature.compose <resolve-countries>off : <define>TORRENT_DISABLE_RESOLVE_COUNTRIES ;
233 feature character-set : ansi unicode : composite propagated link-incompatible ;
234 feature.compose <character-set>unicode : <define>_UNICODE <define>UNICODE ;
236 feature zlib : shipped system : composite propagated link-incompatible ;
238 feature statistics : off on : composite propagated link-incompatible ;
239 feature.compose <statistics>on : <define>TORRENT_STATS ;
241 feature upnp-logging : off on : composite propagated link-incompatible ;
242 feature.compose <upnp-logging>on : <define>TORRENT_UPNP_LOGGING ;
244 feature boost : system source : link-incompatible propagated ;
245 feature boost-link : static shared : composite ;
247 feature debug-iterators : off on : composite propagated link-incompatible ;
248 feature.compose <debug-iterators>on : <define>_SCL_SECURE=1 <define>_GLIBCXX_DEBUG ;
250 feature test-coverage : off on : composite propagated ;
252 # required for openssl on windows
253 lib ssleay32 : : <name>ssleay32 ;
254 lib libeay32 : : <name>libeay32 ;
255 lib advapi32 : : <name>Advapi32 ;
256 lib user32 : : <name>User32 ;
257 lib shell32 : : <name>shell32 ;
258 lib gdi32 : : <name>gdi32 ;
260 local library-search-path = <search>/opt/local/lib <search>/usr/lib <search>/usr/local/lib <search>/sw/lib ;
262 lib boost_filesystem : : <name>boost_filesystem $(library-search-path) ;
263 lib boost_thread : : <name>boost_thread $(library-search-path) ;
264 lib boost_iostreams : : <name>boost_iostreams $(library-search-path) ;
265 lib boost_system : : <name>boost_system $(library-search-path) ;
267 # openssl on linux/bsd/macos etc.
268 lib crypto : : <name>crypto ;
269 lib ssl : : <name>ssl ;
271 # time functions used on linux require librt
272 lib librt : : <name>rt ;
274 lib tcmalloc : : <name>tcmalloc $(library-search-path) ;
277 lib zlib-target : : <name>z ;
279 # socket libraries on windows
280 lib wsock32 : : <name>wsock32 ;
281 lib ws2_32 : : <name>ws2_32 ;
302 instantiate_connection
317 http_tracker_connection
318 udp_tracker_connection
339 kademlia/closest_nodes
346 kademlia/routing_table
347 kademlia/traversal_algorithm
365 local usage-requirements =
367 <include>./include/libtorrent
368 <zlib>shipped:<include>./zlib
369 <variant>release:<define>NDEBUG
370 <define>_FILE_OFFSET_BITS=64
371 <define>BOOST_MULTI_INDEX_DISABLE_SERIALIZATION
372 <conditional>@linking
373 <zlib>system:<library>zlib-target
374 # these compiler settings just makes the compiler standard conforming
375 <toolset>msvc:<cxxflags>/Zc:wchar_t
376 <toolset>msvc:<cxxflags>/Zc:forScope
377 # disable bogus deprecation warnings on msvc8
378 <toolset>msvc:<define>_SCL_SECURE_NO_DEPRECATE
379 <toolset>msvc:<define>_CRT_SECURE_NO_DEPRECATE
381 <toolset>msvc,<variant>release:<linkflags>/OPT:ICF=5
382 <toolset>msvc,<variant>release:<linkflags>/OPT:REF
383 # disable warning C4503: decorated name length exceeded, name was truncated
384 <toolset>msvc:<cxxflags>/wd4503
385 # disable some warnings for gcc
386 <toolset>gcc:<cxxflags>-fno-strict-aliasing
387 <toolset>gcc:<cxxflags>-Wno-missing-braces
388 <boost>system:<cxxflags>$(CXXFLAGS)
389 <boost>system:<linkflags>$(LDFLAGS)
400 <define>BOOST_THREAD_USE_LIB
402 <link>shared:<define>TORRENT_BUILDING_SHARED
403 <dht-support>on:<source>src/$(KADEMLIA_SOURCES).cpp
404 <dht-support>logging:<source>src/$(KADEMLIA_SOURCES).cpp
405 <zlib>shipped:<source>zlib/$(ZLIB_SOURCES).c
406 <conditional>@building
407 <boost>system:<cxxflags>$(CXXFLAGS)
408 $(usage-requirements)
413 : # usage requirements
414 $(usage-requirements)