CMake+PortableApps: Include the VC runtime (second try).

Move the code that finds the Visual C++ redistributable DLLs to its
own module. Run it before we create our NSIS and PortableApps targets.
Add a PortableApps target that copies the redistributable

This reverts commit 403fa9fbe0cdba3f443ec4674cda40092525ffe4.

Bug: 11800
Change-Id: I081d8fd3f5f37dd590659ca8f2bd309642a9a9df
Reviewed-on: https://code.wireshark.org/review/12431
Reviewed-by: Gerald Combs <gerald@wireshark.org>
(cherry picked from commit 5b580834aeeee8477039bc099c49c21aeeb3b71f)
Reviewed-on: https://code.wireshark.org/review/12432
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
This commit is contained in:
Gerald Combs 2015-12-04 09:02:35 -08:00
parent 4b206d1b06
commit 42333aa353
6 changed files with 42 additions and 18 deletions

View File

@ -2281,6 +2281,8 @@ if(BUILD_dumpcap AND PCAP_FOUND)
endif()
if (WIN32)
find_package( MSVC_REDIST )
# Must come after executable targets are defined.
find_package( NSIS )

View File

@ -1328,6 +1328,7 @@ EXTRA_DIST = \
cmake/modules/FindLUA.cmake \
cmake/modules/FindLYNX.cmake \
cmake/modules/FindM.cmake \
cmake/modules/FindMSVC_REDIST.cmake \
cmake/modules/FindNL.cmake \
cmake/modules/FindNSIS.cmake \
cmake/modules/FindOS_X_FRAMEWORKS.cmake \

View File

@ -0,0 +1,23 @@
#
# Find the Microsoft Visual C++ library DLLs.
# These are included with the full frontal (Professional, Enterprise) editions
# of Visual Studio but not Express.
#
# MSVCR_DLL - Path to the redistributable DLLs.
#
set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP TRUE)
include(InstallRequiredSystemLibraries)
# CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS will likely give us a list of DLL
# paths containing spaces. We'll assume that they're all in the same
# directory and use it to create something that's easier to pass to
# NSIS.
set(MSVCR_DLL)
list(GET CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS 0 _msvcr_dll)
if(_msvcr_dll)
get_filename_component(_msvcr_dir ${_msvcr_dll} DIRECTORY)
set(MSVCR_DLL "${_msvcr_dir}/*.*")
file(TO_NATIVE_PATH "${MSVCR_DLL}" MSVCR_DLL)
endif()

View File

@ -10,6 +10,3 @@ find_program(MAKENSIS_EXECUTABLE makensis
PATH "$ENV{PROGRAMFILES}/NSIS" "$ENV{PROGRAMW6432}/NSIS"
DOC "Path to the makensis utility."
)
set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP TRUE)
include(InstallRequiredSystemLibraries)

View File

@ -102,18 +102,6 @@ if(BUILD_wireshark_gtk AND GTK_FOUND)
set (GTK_DIR "\${STAGING_DIR}")
endif()
# CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS will likely give us a list of DLL
# paths containing spaces. We'll assume that they're all in the same
# directory and use it to create something that's easier to pass to
# NSIS.
set(MSVCR_DLL)
list(GET CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS 0 _msvcr_dll)
if(_msvcr_dll)
get_filename_component(_msvcr_dir ${_msvcr_dll} DIRECTORY)
set(MSVCR_DLL "${_msvcr_dir}/*.*")
file(TO_NATIVE_PATH "${MSVCR_DLL}" MSVCR_DLL)
endif()
# This *should* be compatible with the way we currently do things.
if(MSVC12)
set(_vcredist_name "vcredist_${TARGET_MACHINE}.exe")

View File

@ -21,7 +21,6 @@
# To do:
# - Use CPack to generate the PortableApps package.
# - Copy the C runtime DLLs if they're available.
set(PORTABLEAPPS_NAME "${CMAKE_PROJECT_NAME}Portable")
set(PORTABLEAPPS_NAME ${PORTABLEAPPS_NAME} PARENT_SCOPE)
@ -46,6 +45,7 @@ macro( ADD_PORTABLEAPPS_PACKAGE_TARGET )
file(TO_NATIVE_PATH "${_portableapps_app_dir}" _portableapps_app_dir_native)
file(TO_NATIVE_PATH "${DATAFILE_DIR}" _datafile_dir_native)
file(TO_NATIVE_PATH "${CMAKE_SOURCE_DIR}/packaging/portableapps/xcopy-deploy-exclude.txt" _xcopy_deploy_exclude)
add_custom_target(portableapps_app_dir
# We "Deploy using XCopy," which is described at
# https://msdn.microsoft.com/en-us/library/ms235291.aspx
@ -53,16 +53,29 @@ macro( ADD_PORTABLEAPPS_PACKAGE_TARGET )
COMMAND ${CMAKE_COMMAND} -E remove_directory ${_portableapps_app_dir}
COMMAND ${CMAKE_COMMAND} -E make_directory ${_portableapps_app_dir}
COMMAND xcopy ${_datafile_dir_native} ${_portableapps_app_dir_native} /D /I /E /Y /exclude:${_xcopy_deploy_exclude}
# XXX Copy C runtime DLLs.
)
set_target_properties(portableapps_app_dir PROPERTIES FOLDER "Packaging")
if(MSVCR_DLL)
add_custom_target(portableapps_runtime
COMMAND xcopy "${MSVCR_DLL}" ${_portableapps_app_dir_native} /D /I /Y
)
else(MSVCR_DLL)
add_custom_target(portableapps_runtime
COMMAND ${CMAKE_COMMAND} -E echo "C Runtime MUST be installed on target system."
)
endif(MSVCR_DLL)
set_target_properties(portableapps_runtime PROPERTIES FOLDER "Packaging")
add_dependencies(portableapps_runtime portableapps_app_dir)
# Build the PortableApps package.
# nsis_package_prep must be built prior to this.
set (_portableapps_package ${CMAKE_BINARY_DIR}/packaging/portableapps/WiresharkPortable_$(VERSION).exe)
add_custom_target(portableapps_package
DEPENDS
portableapps_app_dir
portableapps_runtime
${_portableapps_package}
)
set_target_properties(portableapps_package PROPERTIES FOLDER "Packaging")