aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorViktor Elofsson <viktor@viktorelofsson.se>2017-07-09 22:34:33 +0200
committerViktor Elofsson <viktor@viktorelofsson.se>2017-07-09 23:12:39 +0200
commit20944ef885c1b300974e0b4893e003d342330f06 (patch)
tree1255cbf7e1100ab15bc94c4f1a332f2c319fa378
parent26cf1a80e9e6855b521729a30d4cf6f530cc16c8 (diff)
downloadvcpkg-20944ef885c1b300974e0b4893e003d342330f06.tar.gz
vcpkg-20944ef885c1b300974e0b4893e003d342330f06.zip
Fix vcpkg Boost naming for static libs and also fix the include file for shared libs.
-rw-r--r--ports/libtorrent/portfile.cmake13
-rw-r--r--ports/libtorrent/vcpkg-boost-madness.patch13
2 files changed, 23 insertions, 3 deletions
diff --git a/ports/libtorrent/portfile.cmake b/ports/libtorrent/portfile.cmake
index 476d84221..6eb49c0b4 100644
--- a/ports/libtorrent/portfile.cmake
+++ b/ports/libtorrent/portfile.cmake
@@ -24,16 +24,20 @@ vcpkg_apply_patches(
SOURCE_PATH ${SOURCE_PATH}
PATCHES ${CMAKE_CURRENT_LIST_DIR}/add-datetime-to-boost-libs.patch
PATCHES ${CMAKE_CURRENT_LIST_DIR}/add-dbghelp-to-win32-libs.patch
+ PATCHES ${CMAKE_CURRENT_LIST_DIR}/vcpkg-boost-madness.patch
)
-if (NOT VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
- message(FATAL_ERROR "Only dynamic linking supported.")
+if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
+ set(LIBTORRENT_SHARED ON)
+else()
+ set(LIBTORRENT_SHARED OFF)
endif()
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
)
@@ -46,8 +50,11 @@ if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
file(RENAME ${CURRENT_PACKAGES_DIR}/lib/torrent-rasterbar.dll ${CURRENT_PACKAGES_DIR}/bin/torrent-rasterbar.dll)
file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/torrent-rasterbar.dll ${CURRENT_PACKAGES_DIR}/debug/bin/torrent-rasterbar.dll)
-else()
+ # Defines for shared lib
+ file(READ ${CURRENT_PACKAGES_DIR}/include/libtorrent/export.hpp EXPORT_H)
+ string(REPLACE "defined TORRENT_BUILDING_SHARED" "1" EXPORT_H "${EXPORT_H}")
+ file(WRITE ${CURRENT_PACKAGES_DIR}/include/libtorrent/export.hpp "${EXPORT_H}")
endif()
# Handle copyright
diff --git a/ports/libtorrent/vcpkg-boost-madness.patch b/ports/libtorrent/vcpkg-boost-madness.patch
new file mode 100644
index 000000000..e9e498ee4
--- /dev/null
+++ b/ports/libtorrent/vcpkg-boost-madness.patch
@@ -0,0 +1,13 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 99698a2..454bae6 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -252,7 +252,7 @@ else()
+
+ set(Boost_USE_STATIC_RUNTIME ON)
+ endif()
+- set(Boost_USE_STATIC_LIBS ON)
++ set(Boost_USE_STATIC_LIBS OFF)
+ add_library(torrent-rasterbar STATIC ${sources2})
+ endif()
+