aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRaynor Vliegendhart <ShinNoNoir+git@gmail.com>2017-09-06 07:54:32 +0200
committerRaynor Vliegendhart <ShinNoNoir+git@gmail.com>2017-09-06 07:54:32 +0200
commitcd8c8af8e85e2b077090c42f3ea9554d9f626023 (patch)
tree62bc9f5a74bb4ccea7e8c3d982c451fca0f204c3
parent929bf5c33dc48063c0744aa4155ad01167939305 (diff)
downloadvcpkg-cd8c8af8e85e2b077090c42f3ea9554d9f626023.tar.gz
vcpkg-cd8c8af8e85e2b077090c42f3ea9554d9f626023.zip
[qt5] Do not link all .lib files
This commit moves a few .lib files to subfolders to prevent them from automatically getting linked: Qt5Bootstrap (dbg): This lib is linked against a release version of the CRT and is only meant for release builds. For debug builds, this lib should not be linked at all. qtmain (rel), qtmaind (dbg), Qt5AxServer (rel), Qt5AxServerd (dbg): These libs are mutually exclusive. The user either links against qtmain(d) for desktop applications or against Qt5AxServer(d) for ActiveX servers. See https://github.com/Microsoft/vcpkg/issues/1442 for more information.
-rw-r--r--ports/qt5/portfile.cmake49
1 files changed, 49 insertions, 0 deletions
diff --git a/ports/qt5/portfile.cmake b/ports/qt5/portfile.cmake
index 33709c528..4b852e95c 100644
--- a/ports/qt5/portfile.cmake
+++ b/ports/qt5/portfile.cmake
@@ -89,6 +89,55 @@ vcpkg_execute_required_process(
vcpkg_copy_tool_dependencies(${CURRENT_PACKAGES_DIR}/tools/${PORT})
+
+#---------------------------------------------------------------------------
+# Qt5Bootstrap: a release-only dependency
+#---------------------------------------------------------------------------
+# Remove release-only Qt5Bootstrap.lib from debug folders:
+#file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/lib/Qt5Bootstrap.lib)
+#file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/lib/Qt5Bootstrap.prl)
+# Above approach does not work:
+# check_matching_debug_and_release_binaries(dbg_libs, rel_libs)
+# requires the two sets to be of equal size!
+# Alt. approach, create dummy folder instead:
+file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/debug/lib/dont-use)
+file(COPY ${CURRENT_PACKAGES_DIR}/debug/lib/Qt5Bootstrap.lib DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib/dont-use)
+file(COPY ${CURRENT_PACKAGES_DIR}/debug/lib/Qt5Bootstrap.prl DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib/dont-use)
+file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/lib/Qt5Bootstrap.lib)
+file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/lib/Qt5Bootstrap.prl)
+#---------------------------------------------------------------------------
+
+#---------------------------------------------------------------------------
+# qtmain(d) vs. Qt5AxServer(d)
+#---------------------------------------------------------------------------
+# Qt applications have to either link to qtmain(d) or to Qt5AxServer(d),
+# never both. See http://doc.qt.io/qt-5/activeqt-server.html for more info.
+#
+# Create manual-link folders:
+file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/lib/manual-link)
+file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/debug/lib/manual-link)
+#
+# Either have users explicitly link against qtmain.lib, qtmaind.lib:
+file(COPY ${CURRENT_PACKAGES_DIR}/lib/qtmain.lib DESTINATION ${CURRENT_PACKAGES_DIR}/lib/manual-link)
+file(COPY ${CURRENT_PACKAGES_DIR}/lib/qtmain.prl DESTINATION ${CURRENT_PACKAGES_DIR}/lib/manual-link)
+file(REMOVE ${CURRENT_PACKAGES_DIR}/lib/qtmain.lib)
+file(REMOVE ${CURRENT_PACKAGES_DIR}/lib/qtmain.prl)
+file(COPY ${CURRENT_PACKAGES_DIR}/debug/lib/qtmaind.lib DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib/manual-link)
+file(COPY ${CURRENT_PACKAGES_DIR}/debug/lib/qtmaind.prl DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib/manual-link)
+file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/lib/qtmaind.lib)
+file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/lib/qtmaind.prl)
+#
+# ... or have users explicitly link against Qt5AxServer.lib, Qt5AxServerd.lib:
+file(COPY ${CURRENT_PACKAGES_DIR}/lib/Qt5AxServer.lib DESTINATION ${CURRENT_PACKAGES_DIR}/lib/manual-link)
+file(COPY ${CURRENT_PACKAGES_DIR}/lib/Qt5AxServer.prl DESTINATION ${CURRENT_PACKAGES_DIR}/lib/manual-link)
+file(REMOVE ${CURRENT_PACKAGES_DIR}/lib/Qt5AxServer.lib)
+file(REMOVE ${CURRENT_PACKAGES_DIR}/lib/Qt5AxServer.prl)
+file(COPY ${CURRENT_PACKAGES_DIR}/debug/lib/Qt5AxServerd.lib DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib/manual-link)
+file(COPY ${CURRENT_PACKAGES_DIR}/debug/lib/Qt5AxServerd.prl DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib/manual-link)
+file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/lib/Qt5AxServerd.lib)
+file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/lib/Qt5AxServerd.prl)
+#---------------------------------------------------------------------------
+
file(INSTALL ${SOURCE_PATH}/LICENSE.LGPLv3 DESTINATION ${CURRENT_PACKAGES_DIR}/share/qt5 RENAME copyright)
if(EXISTS ${CURRENT_PACKAGES_DIR}/plugins)
file(INSTALL ${CMAKE_CURRENT_LIST_DIR}/qtdeploy.ps1 DESTINATION ${CURRENT_PACKAGES_DIR}/plugins)