import python ; import feature : feature ; import project ; import targets ; import "class" : new ; use-project /torrent : ../.. ; lib boost_python : : darwin boost_python-mt $(boost-library-search-path) ; lib boost_python : : boost_python ; feature visibility : default hidden : composite propagated link-incompatible ; feature.compose hidden : -fvisibility=hidden -fvisibility-inlines-hidden ; feature libtorrent-link : static shared : ; feature libtorrent-python-pic : off on : composite propagated link-incompatible ; feature.compose on : -fPIC ; rule libtorrent_linking ( properties * ) { local result ; if ! windows in $(properties) && gcc in $(properties) { result += on ; } if gcc in $(properties) || darwin in $(properties) || clang in $(properties) || clang-darwin in $(properties) { result += hidden ; if ( gcc in $(properties) ) { result += -Wl,-Bsymbolic ; } } if static in $(properties) { ECHO "WARNING: you probably want to specify libtorrent-link=static rather than link=static" ; } if source in $(properties) { if static in $(properties) && 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" ; } # 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 shared in $(properties) || linux in $(properties) { result += /boost/python//boost_python/shared ; } else { result += /boost/python//boost_python/static ; } if shared in $(properties) { result += /torrent//torrent/shared/shared ; } else { result += /torrent//torrent/static/static ; } } else { result += boost_python ; if shared in $(properties) { result += /torrent//torrent/shared/shared ; } else { result += /torrent//torrent/static/static ; } } return $(result) ; } # this is a copy of the rule from boost-build's python-extension, but without # specifying no as a mandatory property. That property # would otherwise cause build failures because it suppresses linking against the # runtime library and kernel32 on windows rule my-python-extension ( name : sources * : requirements * : default-build * : usage-requirements * ) { requirements += /python//python_for_extensions ; local project = [ project.current ] ; targets.main-target-alternative [ new typed-target $(name) : $(project) : PYTHON_EXTENSION : [ targets.main-target-sources $(sources) : $(name) ] : [ targets.main-target-requirements $(requirements) : $(project) ] : [ targets.main-target-default-build $(default-build) : $(project) ] ] ; } my-python-extension libtorrent : # sources src/module.cpp src/big_number.cpp src/converters.cpp src/create_torrent.cpp src/fingerprint.cpp src/utility.cpp src/session.cpp src/entry.cpp src/torrent_info.cpp src/string.cpp src/torrent_handle.cpp src/torrent_status.cpp src/session_settings.cpp src/version.cpp src/alert.cpp src/datetime.cpp src/peer_info.cpp src/ip_filter.cpp src/magnet_uri.cpp src/error_code.cpp : # requirements src @libtorrent_linking : # default build static static false ; install stage_module : libtorrent : LIB on . ;