forked from premiere/premiere-libtorrent
attempt to make shared library builds to work with visibility=hidden
This commit is contained in:
parent
7f2d6325df
commit
7b1a441aeb
|
@ -5,6 +5,7 @@ set(sources
|
|||
web_connection_base
|
||||
alert
|
||||
allocator
|
||||
asio
|
||||
assert
|
||||
bandwidth_limit
|
||||
bandwidth_manager
|
||||
|
@ -142,6 +143,7 @@ else (dht)
|
|||
endif (dht)
|
||||
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -fvisibility-inlines-hidden")
|
||||
|
||||
if (shared)
|
||||
add_library(torrent-rasterbar SHARED ${sources2})
|
||||
|
@ -157,7 +159,7 @@ include_directories(${Boost_INCLUDE_DIR})
|
|||
target_link_libraries(torrent-rasterbar ${Boost_LIBRARIES})
|
||||
|
||||
# this works around a bug in asio in boost-1.39
|
||||
add_definitions(-DBOOST_ASIO_HASH_MAP_BUCKETS=1021)
|
||||
add_definitions(-DBOOST_ASIO_HASH_MAP_BUCKETS=1021 -DBOOST_ASIO_DYN_LINK)
|
||||
|
||||
if (WIN32)
|
||||
target_link_libraries(torrent-rasterbar wsock32 ws2_32)
|
||||
|
|
44
Jamfile
44
Jamfile
|
@ -31,6 +31,13 @@ rule linking ( properties * )
|
|||
{
|
||||
local result ;
|
||||
|
||||
if <link>shared in $(properties)
|
||||
{
|
||||
# make sure asio symbols are properly exported
|
||||
# and imported
|
||||
result += <define>BOOST_ASIO_DYN_LINK ;
|
||||
}
|
||||
|
||||
# openssl libraries, if enabled
|
||||
if <encryption>openssl in $(properties)
|
||||
{
|
||||
|
@ -61,7 +68,6 @@ rule linking ( properties * )
|
|||
# linker library on linux, required when using openssl
|
||||
result += <library>dl ;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if <target-os>windows in $(properties)
|
||||
|
@ -83,11 +89,6 @@ rule linking ( properties * )
|
|||
result += <library>gcrypt <include>/opt/local/include ;
|
||||
}
|
||||
|
||||
if <encryption>tommath in $(properties)
|
||||
{
|
||||
result += <source>src/mpi.c ;
|
||||
}
|
||||
|
||||
if <geoip>shared in $(properties)
|
||||
{
|
||||
result += <library>GeoIP ;
|
||||
|
@ -210,6 +211,11 @@ rule building ( properties * )
|
|||
result += <source>src/assert.cpp ;
|
||||
}
|
||||
|
||||
if <encryption>tommath in $(properties)
|
||||
{
|
||||
result += <source>src/mpi.c ;
|
||||
}
|
||||
|
||||
if <geoip>static in $(properties)
|
||||
{
|
||||
result += <source>src/GeoIP.c ;
|
||||
|
@ -226,6 +232,19 @@ rule building ( properties * )
|
|||
result += <source>src/pe_crypto.cpp ;
|
||||
}
|
||||
|
||||
if ( <toolset>darwin in $(properties)
|
||||
|| <toolset>gcc in $(properties)
|
||||
|| <toolset>clang in $(propertoes) )
|
||||
&& <link>shared in $(properties)
|
||||
{
|
||||
# hide non-external symbols
|
||||
# use ms-compat because boost.asio (as of 1.47.0
|
||||
# appears to have some types not fulle exported)
|
||||
result += <cflags>-fvisibility-ms-compat ;
|
||||
result += <cxxflags>-fvisibility-inlines-hidden ;
|
||||
result += <linkflags>-W1,-Bsymbolic ;
|
||||
}
|
||||
|
||||
return $(result) ;
|
||||
}
|
||||
|
||||
|
@ -406,6 +425,7 @@ lib iphlpapi : : <name>iphlpapi <link>shared ;
|
|||
SOURCES =
|
||||
alert
|
||||
allocator
|
||||
asio
|
||||
assert
|
||||
bandwidth_limit
|
||||
bandwidth_manager
|
||||
|
@ -550,16 +570,8 @@ lib torrent
|
|||
<conditional>@building
|
||||
<boost>system:<cxxflags>$(CXXFLAGS)
|
||||
|
||||
# hide non-external symbols
|
||||
<toolset>darwin:<cflags>-fvisibility=hidden
|
||||
<toolset>darwin:<cxxflags>-fvisibility-inlines-hidden
|
||||
<toolset>darwin:<linkflags>-W1,-Bsymbolic
|
||||
<toolset>gcc:<cflags>-fvisibility=hidden
|
||||
<toolset>gcc:<cxxflags>-fvisibility-inlines-hidden
|
||||
<toolset>gcc:<linkflags>-W1,-Bsymbolic
|
||||
<toolset>llvm:<cflags>-fvisibility=hidden
|
||||
<toolset>llvm:<cxxflags>-fvisibility-inlines-hidden
|
||||
<toolset>llvm:<linkflags>-W1,-Bsymbolic
|
||||
# tell asio to export its symbols
|
||||
<link>shared:<define>BOOST_ASIO_SOURCE
|
||||
|
||||
$(usage-requirements)
|
||||
|
||||
|
|
|
@ -98,7 +98,7 @@ AX_PTHREAD()
|
|||
|
||||
LIBS="$PTHREAD_LIBS $LIBS"
|
||||
CFLAGS="$PTHREAD_CFLAGS $CFLAGS -fvisibility=hidden"
|
||||
CXXFLAGS="$CXXFLAGS -fvisibility=hidden -fvisibility-inlines-hidden"
|
||||
CXXFLAGS="$CXXFLAGS -fvisibility-inlines-hidden"
|
||||
CC="$PTHREAD_CC"
|
||||
|
||||
AS_ECHO
|
||||
|
@ -159,7 +159,7 @@ AC_CHECK_FUNCS([clock_gettime], [],
|
|||
|
||||
|
||||
dnl Pass some build options to setup.py and .pc file
|
||||
COMPILETIME_OPTIONS=""
|
||||
COMPILETIME_OPTIONS="-DBOOST_ASIO_DYN_LINK "
|
||||
|
||||
|
||||
###############################################################################
|
||||
|
|
|
@ -44,6 +44,10 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <boost/function/function1.hpp>
|
||||
#include <boost/function/function2.hpp>
|
||||
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
#include <boost/system/system_error.hpp>
|
||||
#endif
|
||||
|
||||
#define CCONTROL_TARGET 100
|
||||
|
||||
namespace libtorrent
|
||||
|
|
|
@ -20,6 +20,7 @@ libtorrent_rasterbar_la_SOURCES = \
|
|||
web_connection_base.cpp \
|
||||
alert.cpp \
|
||||
allocator.cpp \
|
||||
asio.cpp \
|
||||
assert.cpp \
|
||||
bandwidth_limit.cpp \
|
||||
bandwidth_manager.cpp \
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
// builds all boost.asio source as a separate compilation unit
|
||||
#include <boost/asio/impl/src.hpp>
|
||||
|
|
@ -9,7 +9,7 @@ explicit test_natpmp ;
|
|||
|
||||
project
|
||||
: requirements
|
||||
<library>/torrent//torrent
|
||||
<library>/torrent//torrent/<link>shared
|
||||
<source>main.cpp
|
||||
<source>setup_transfer.cpp
|
||||
: default-build
|
||||
|
|
Loading…
Reference in New Issue