From 97099dc0ca10c0985479669db9712c9c2402623c Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Wed, 13 Jun 2007 17:36:26 +0000 Subject: [PATCH] added more fixes to Jamfile in order to make it build on windows --- Jamfile | 97 +++++++++++++++++++++++++++------------- examples/client_test.cpp | 5 ++- 2 files changed, 68 insertions(+), 34 deletions(-) diff --git a/Jamfile b/Jamfile index 78b192433..e6bcdc49a 100755 --- a/Jamfile +++ b/Jamfile @@ -19,16 +19,24 @@ if ! $(BOOST_ROOT) use-project /boost : $(BOOST_ROOT) ; -# rule for linking the correct library when using openssl -rule link-openssl ( properties * ) +# rule for linking the correct libraries depending +# on features and target-os +rule linking ( properties * ) { local result ; + # openssl libraries, if enabled if sha-1 in $(properties) || pe in $(properties) { - if [ os.name ] = NT + if windows in $(properties) { - result += ssleay libeay ; + result += ssleay32 + libeay32 + advapi32 + user32 + shell32 + gdi32 + ; } else { @@ -36,11 +44,31 @@ rule link-openssl ( properties * ) } } + # socket functions on windows require winsock libraries + if windows in $(properties) || cygwin in $(properties) + { + result += ws2_32 + wsock32 + WIN32_LEAN_AND_MEAN + _WIN32_WINNT=0x0500 + __USE_W32_SOCKETS + WIN32 + _WIN32 + ; + } + + # clock_gettime on linux requires librt + if linux in $(properties) + { + result += rt ; + } + return $(result) ; } -# rule for adding the right source files when using openssl and/or PE -rule use-openssl ( properties * ) +# rule for adding the right source files +# depending on target-os and features +rule building ( properties * ) { local result ; @@ -56,6 +84,15 @@ rule use-openssl ( properties * ) } } + if windows in $(properties) + { + result += src/file_win.cpp ; + } + else + { + result += src/file.cpp ; + } + return $(result) ; } @@ -88,11 +125,27 @@ feature.compose on : TORRENT_STATS ; feature upnp-logging : off on : composite propagated link-incompatible ; feature.compose on : TORRENT_UPNP_LOGGING ; -lib ssleay : : ssleay32 ; -lib libeay : : libeay32 ; +# required for openssl on windows +lib ssleay32 : : ssleay32 ; +lib libeay32 : : libeay32 ; +lib advapi32 : : Advapi32 ; +lib user32 : : User32 ; +lib shell32 : : shell32 ; +lib gdi32 : : gdi32 ; + +# openssl on linux/bsd/macos etc. lib crypto : : crypto ; + +# time functions used on linux require librt +lib librt : : rt ; + +# libz lib zlib-target : : z ; +# socket libraries on windows +lib wsock32 : : wsock32 ; +lib ws2_32 : : ws2_32 ; + SOURCES = allocate_resources alert @@ -160,26 +213,6 @@ ZLIB_SOURCES = zutil ; -local defines ; -local libs ; - -if [ os.name ] = CYGWIN || [ os.name ] = NT -{ - lib wsock32 : : wsock32 ; - lib ws2_32 : : ws2_32 ; - libs += ws2_32 wsock32 ; - defines += WIN32_LEAN_AND_MEAN ; - defines += _WIN32_WINNT=0x0500 ; - defines += __USE_W32_SOCKETS ; - defines += WIN32 ; - defines += _WIN32 ; - SOURCES += file_win ; -} -else -{ - SOURCES += file ; -} - local usage-requirements = ./include ./include/libtorrent @@ -188,10 +221,9 @@ local usage-requirements = release:NDEBUG BOOST_ALL_NO_LIB _FILE_OFFSET_BITS=64 - $(defines) /boost/thread//boost_thread #/static /boost/filesystem//boost_filesystem #/static - @link-openssl + @linking system:zlib-target # these compiler settings just makes the compiler standard conforming msvc:/Zc:wchar_t @@ -201,11 +233,12 @@ local usage-requirements = msvc:_CRT_SECURE_NO_DEPRECATE ; +project torrent ; + lib torrent : # sources src/$(SOURCES).cpp - $(libs) : # requirements BOOST_THREAD_USE_LIB @@ -214,7 +247,7 @@ lib torrent on:src/$(KADEMLIA_SOURCES).cpp logging:src/$(KADEMLIA_SOURCES).cpp shipped:zlib/$(ZLIB_SOURCES).c - @use-openssl + @building $(usage-requirements) : # default build diff --git a/examples/client_test.cpp b/examples/client_test.cpp index 67838b09c..2d33d70bb 100644 --- a/examples/client_test.cpp +++ b/examples/client_test.cpp @@ -1039,8 +1039,9 @@ int main(int ac, char* av[]) else if (i->blocks[j].state == block_info::requested) out << str; else out << " "; #else - if (i->finished_blocks[j]) out << "#"; - else if (i->requested_blocks[j]) out << str; + if (i->blocks[j].state == block_info::finished) out << "#"; + else if (i->blocks[j].state == block_info::writing) out << "+"; + else if (i->blocks[j].state == block_info::requested) out << str; else out << " "; #endif }