From 47a630f0ade70219e97852cc63e0dc2361b96e70 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Fri, 22 Jan 2016 14:18:45 -0800 Subject: [PATCH] manually install msvc DLLs with Interface/DS/AC --- cmake/macros/InstallBesideConsole.cmake | 1 + cmake/macros/ManuallyInstallMSVC.cmake | 37 +++++++++++++++++++++++++ interface/CMakeLists.txt | 1 + 3 files changed, 39 insertions(+) create mode 100644 cmake/macros/ManuallyInstallMSVC.cmake diff --git a/cmake/macros/InstallBesideConsole.cmake b/cmake/macros/InstallBesideConsole.cmake index e257defcb7..5f1dd00821 100644 --- a/cmake/macros/InstallBesideConsole.cmake +++ b/cmake/macros/InstallBesideConsole.cmake @@ -70,5 +70,6 @@ macro(install_beside_console) set(TARGET_INSTALL_DIR ${COMPONENT_INSTALL_DIR}) set(TARGET_INSTALL_COMPONENT ${SERVER_COMPONENT}) manually_install_ssl_eay() + manually_install_msvc() endmacro() diff --git a/cmake/macros/ManuallyInstallMSVC.cmake b/cmake/macros/ManuallyInstallMSVC.cmake new file mode 100644 index 0000000000..45e9362c91 --- /dev/null +++ b/cmake/macros/ManuallyInstallMSVC.cmake @@ -0,0 +1,37 @@ +# +# ManuallyInstallMSVC.cmake +# cmake/macros +# +# Copyright 2016 High Fidelity, Inc. +# Created by Stephen Birarda on January 22nd, 2016 +# +# Distributed under the Apache License, Version 2.0. +# See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +# + +# On windows fixup_bundle does not find msvcr120.dll and msvcp120.dll that our targets need to be re-distributable. +# We use this macro to find them and manually install them beside the targets + +macro(manually_install_msvc) + if (WIN32) + # look for the msvcr DLLs required by this target + find_path(MSVC_DLL_PATH msvcr120.dll PATHS "C:/Windows/SysWOW64" NO_DEFAULT_PATH) + + if (MSVC_DLL_PATH-NOTFOUND) + # we didn't get the path to the DLLs - on production or PR build this is a fail + if (PRODUCTION_BUILD OR PR_BUILD) + message(FATAL_ERROR "Did not find MSVC_DLL_PATH for msvcr120.dll and msvcp120.dll.\ + Both are required to package re-distributable installer." + ) + endif () + else () + # manually install the two DLLs for this component + install( + FILES "${MSVC_DLL_PATH}/msvcr120.dll" "${MSVC_DLL_PATH}/msvcp120.dll" + DESTINATION ${TARGET_INSTALL_DIR} + COMPONENT ${TARGET_INSTALL_COMPONENT} + ) + endif () + + endif () +endmacro() diff --git a/interface/CMakeLists.txt b/interface/CMakeLists.txt index b4ce53b92a..3ae01f3673 100644 --- a/interface/CMakeLists.txt +++ b/interface/CMakeLists.txt @@ -267,6 +267,7 @@ if (WIN32) set(TARGET_INSTALL_DIR ${INTERFACE_INSTALL_DIR}) set(TARGET_INSTALL_COMPONENT ${CLIENT_COMPONENT}) manually_install_ssl_eay() + manually_install_msvc() package_libraries_for_deployment() endif()