Skip to content

Commit

Permalink
[libtorrent] Fix linkage issues for dynamic builds (#7345)
Browse files Browse the repository at this point in the history
* [libtorrent] Fix linkage issues for dynamic builds

* [libtorrent] Also handle static linkage

Co-authored-by: Jack·Boos·Yu <47264268+JackBoosY@users.noreply.github.com>
  • Loading branch information
2 people authored and vicroms committed Jan 16, 2020
1 parent 2dde9fb commit 562515f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion ports/libtorrent/CONTROL
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Source: libtorrent
Version: 1.2.2
Version: 1.2.2-1
Homepage: https://github.com/arvidn/libtorrent
Description: An efficient feature complete C++ BitTorrent implementation
Build-Depends: openssl, boost-system, boost-date-time, boost-chrono, boost-random, boost-asio, boost-crc, boost-config, boost-iterator, boost-scope-exit, boost-multiprecision
13 changes: 6 additions & 7 deletions ports/libtorrent/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,23 @@ vcpkg_from_github(
add-datetime-to-boost-libs.patch
)

string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" LIBTORRENT_SHARED)

vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA # Disable this option if project cannot be built with Ninja
OPTIONS
-Dshared=${LIBTORRENT_SHARED}
-Ddeprecated-functions=off
)

vcpkg_install_cmake()

file(READ ${CURRENT_PACKAGES_DIR}/include/libtorrent/aux_/export.hpp EXPORT_H)
string(REPLACE "defined TORRENT_BUILDING_SHARED" "0" EXPORT_H "${EXPORT_H}")
if (VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
# Defines for shared lib
file(READ ${CURRENT_PACKAGES_DIR}/include/libtorrent/aux_/export.hpp EXPORT_H)
string(REPLACE "defined TORRENT_BUILDING_SHARED" "1" EXPORT_H "${EXPORT_H}")
file(WRITE ${CURRENT_PACKAGES_DIR}/include/libtorrent/aux_/export.hpp "${EXPORT_H}")
string(REPLACE "defined TORRENT_LINKING_SHARED" "1" EXPORT_H "${EXPORT_H}")
else()
string(REPLACE "defined TORRENT_LINKING_SHARED" "0" EXPORT_H "${EXPORT_H}")
endif()
file(WRITE ${CURRENT_PACKAGES_DIR}/include/libtorrent/aux_/export.hpp "${EXPORT_H}")

vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/LibtorrentRasterbar TARGET_PATH share/libtorrentrasterbar)

Expand Down

0 comments on commit 562515f

Please sign in to comment.