aboutsummaryrefslogtreecommitdiffstats
path: root/cmake/modules
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2019-01-04 15:37:46 -0800
committerGerald Combs <gerald@wireshark.org>2019-03-18 22:22:44 +0000
commitacc96e5206ca731c791dcae537fc7ae3a08b4e65 (patch)
treee53240afd4463cb13316cb0394126d0e2c011504 /cmake/modules
parentf57a73d688cbbc1207a4ad6ceb41933ebf17171c (diff)
Windows: Start using a `vcpkg export` bundle.
Create a library bundle using `vcpkg export ... --zip` as described at https://vcpkg.readthedocs.io/en/latest/users/integration/#export-command. The bundle includes the following packages: gettext 0.19-8 glib 2.52.3-13 libffi 3.1-4 libiconv 1.15-5 liblzma 5.2.4 libxml2 2.9.9-4 pcre 8.41-1 zlib 1.2.11-5 It also includes a CMake toolchain file which we might want to make use of in the future. This means we no longer compile Zlib locally. Update the CMake environment accordingly and remove zlib from win-setup.ps1. It includes PDBs, so add them to the PDB .zip. Change-Id: I0a94904a86d836e990019dab62af506573be1f35 Reviewed-on: https://code.wireshark.org/review/31377 Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot Reviewed-by: Gerald Combs <gerald@wireshark.org>
Diffstat (limited to 'cmake/modules')
-rw-r--r--cmake/modules/FindGLIB2.cmake47
-rw-r--r--cmake/modules/FindGMODULE2.cmake2
-rw-r--r--cmake/modules/FindGTHREAD2.cmake2
-rw-r--r--cmake/modules/FindLibXml2.cmake4
-rw-r--r--cmake/modules/FindWSWinLibs.cmake45
-rw-r--r--cmake/modules/FindZLIB.cmake33
6 files changed, 91 insertions, 42 deletions
diff --git a/cmake/modules/FindGLIB2.cmake b/cmake/modules/FindGLIB2.cmake
index db2de9297a..2b55b742fe 100644
--- a/cmake/modules/FindGLIB2.cmake
+++ b/cmake/modules/FindGLIB2.cmake
@@ -20,7 +20,7 @@ if( GLIB2_MAIN_INCLUDE_DIR AND GLIB2_LIBRARIES )
endif()
include( FindWSWinLibs )
-FindWSWinLibs( "glib2-*" "GLIB2_HINTS" )
+FindWSWinLibs( "vcpkg-export-*" "GLIB2_HINTS" )
if (NOT WIN32)
find_package(PkgConfig)
@@ -74,6 +74,7 @@ find_path( GLIB2_INTERNAL_INCLUDE_DIR
glibconfig.h
HINTS
"${GLIB2_INCLUDEDIR}"
+ "${GLIB2_HINTS}/include"
"${glib2LibDir}"
${CMAKE_SYSTEM_LIBRARY_PATH}
PATH_SUFFIXES
@@ -100,25 +101,45 @@ if( GLIB2_FOUND )
set( GLIB2_INCLUDE_DIRS ${GLIB2_MAIN_INCLUDE_DIR} ${GLIB2_INTERNAL_INCLUDE_DIR} )
if ( WIN32 AND GLIB2_FOUND )
set ( GLIB2_DLL_DIR "${GLIB2_HINTS}/bin"
- CACHE PATH "Path to GLib 2 DLLs"
+ CACHE PATH "Path to GLib2 DLLs"
)
- # XXX Are GIO and GObject really necessary?
- # libglib and libgio in glib2-2.52.2-1.34-win32ws depend on
- # libgcc_s_sjlj-1.dll, now included with gnutls-3.6.3-1-win32ws.
- # (64-bit GLib does not depend on libgcc_s).
+ # GTK+ required GObject and GIO. We probably don't.
file( GLOB _glib2_dlls RELATIVE "${GLIB2_DLL_DIR}"
- "${GLIB2_DLL_DIR}/libglib-*.dll"
- "${GLIB2_DLL_DIR}/libgio-*.dll"
- "${GLIB2_DLL_DIR}/libgmodule-*.dll"
- "${GLIB2_DLL_DIR}/libgobject-*.dll"
- "${GLIB2_DLL_DIR}/libintl-*.dll"
- #"${GLIB2_DLL_DIR}/libgcc_s_*.dll"
+ # "${GLIB2_DLL_DIR}/gio-2.dll"
+ "${GLIB2_DLL_DIR}/glib-2.dll"
+ "${GLIB2_DLL_DIR}/gmodule-2.dll"
+ # "${GLIB2_DLL_DIR}/gobject-2.dll"
+ "${GLIB2_DLL_DIR}/gthread-2.dll"
+ "${GLIB2_DLL_DIR}/libcharset.dll"
+ # gnutls-3.6.3-1-win64ws ships with libffi-6.dll
+ # "${GLIB2_DLL_DIR}/libffi.dll"
+ "${GLIB2_DLL_DIR}/libiconv.dll"
+ "${GLIB2_DLL_DIR}/libintl.dll"
+ "${GLIB2_DLL_DIR}/pcre.dll"
+ # "${GLIB2_DLL_DIR}/pcre16.dll"
+ # "${GLIB2_DLL_DIR}/pcre32.dll"
+ # "${GLIB2_DLL_DIR}/pcrecpp.dll"
+ # "${GLIB2_DLL_DIR}/pcreposix.dll"
)
set ( GLIB2_DLLS ${_glib2_dlls}
# We're storing filenames only. Should we use STRING instead?
CACHE FILEPATH "GLib 2 DLL list"
)
- mark_as_advanced( GLIB2_DLL_DIR GLIB2_DLLS )
+
+ file( GLOB _glib2_pdbs RELATIVE "${GLIB2_DLL_DIR}"
+ "${GLIB2_DLL_DIR}/glib-2.pdb"
+ "${GLIB2_DLL_DIR}/gmodule-2.pdb"
+ "${GLIB2_DLL_DIR}/gthread-2.pdb"
+ "${GLIB2_DLL_DIR}/libcharset.pdb"
+ "${GLIB2_DLL_DIR}/libiconv.pdb"
+ "${GLIB2_DLL_DIR}/libintl.pdb"
+ "${GLIB2_DLL_DIR}/pcre.pdb"
+ )
+ set ( GLIB2_PDBS ${_glib2_pdbs}
+ CACHE FILEPATH "GLib2 PDB list"
+ )
+
+ mark_as_advanced( GLIB2_DLL_DIR GLIB2_DLLS GLIB2_PDBS )
endif()
elseif( GLIB2_FIND_REQUIRED )
message( SEND_ERROR "Package required but not found" )
diff --git a/cmake/modules/FindGMODULE2.cmake b/cmake/modules/FindGMODULE2.cmake
index 5f22f81444..5bcfec7be3 100644
--- a/cmake/modules/FindGMODULE2.cmake
+++ b/cmake/modules/FindGMODULE2.cmake
@@ -8,7 +8,7 @@
#
include(FindWSWinLibs)
-FindWSWinLibs("glib2-*" "GMODULE2_HINTS")
+FindWSWinLibs("vcpkg-export-*" "GMODULE2_HINTS")
if(NOT WIN32)
find_package(PkgConfig QUIET)
diff --git a/cmake/modules/FindGTHREAD2.cmake b/cmake/modules/FindGTHREAD2.cmake
index 57cc5c17b6..57f8640007 100644
--- a/cmake/modules/FindGTHREAD2.cmake
+++ b/cmake/modules/FindGTHREAD2.cmake
@@ -8,7 +8,7 @@
#
include(FindWSWinLibs)
-FindWSWinLibs("glib2-*" "GTHREAD2_HINTS")
+FindWSWinLibs("vcpkg-export-*" "GTHREAD2_HINTS")
if(NOT WIN32)
find_package(PkgConfig QUIET)
diff --git a/cmake/modules/FindLibXml2.cmake b/cmake/modules/FindLibXml2.cmake
index 1f8becaea7..99d70af57d 100644
--- a/cmake/modules/FindLibXml2.cmake
+++ b/cmake/modules/FindLibXml2.cmake
@@ -48,7 +48,7 @@ The following cache variables may also be set:
#]=======================================================================]
include(FindWSWinLibs)
-FindWSWinLibs("libxml2-.*" LIBXML2_HINTS)
+FindWSWinLibs("vcpkg-export-.*" LIBXML2_HINTS)
# use pkg-config to get the directories and then use these values
# in the find_path() and find_library() calls
@@ -112,4 +112,4 @@ if(LibXml2_FOUND AND NOT TARGET LibXml2::LibXml2)
set_property(TARGET LibXml2::LibXml2 APPEND PROPERTY IMPORTED_LOCATION "${LIBXML2_LIBRARY}")
endif()
-AddWSWinDLL(LibXml2 LIBXML2_HINTS "libxml2-*")
+AddWSWinDLLS(LibXml2 LIBXML2_HINTS "libxml2*" "lzma*")
diff --git a/cmake/modules/FindWSWinLibs.cmake b/cmake/modules/FindWSWinLibs.cmake
index 088a020810..60f5a2ac8e 100644
--- a/cmake/modules/FindWSWinLibs.cmake
+++ b/cmake/modules/FindWSWinLibs.cmake
@@ -42,6 +42,7 @@ function( FindWSWinLibs _WS_LIB_SEARCH_PATH _LIB_HINT_VAR )
endif()
endfunction()
+# Add a single DLL
function(AddWSWinDLL _PKG_NAME _PKG_HINTS _DLL_GLOB)
if(WIN32 AND ${_PKG_NAME}_FOUND)
string(TOUPPER ${_PKG_NAME} _PKG_VAR)
@@ -54,9 +55,51 @@ function(AddWSWinDLL _PKG_NAME _PKG_HINTS _DLL_GLOB)
set ( ${_PKG_VAR}_DLL ${_pkg_dll}
CACHE STRING "${_PKG_NAME} DLL file name"
)
- mark_as_advanced( ${_PKG_VAR}_DLL_DIR ${_PKG_VAR}_DLL )
+ file( GLOB _pkg_pdb RELATIVE "${${_PKG_VAR}_DLL_DIR}"
+ "${${_PKG_VAR}_DLL_DIR}/${_DLL_GLOB}.pdb"
+ )
+ set ( ${_PKG_VAR}_PDB ${_pkg_pdb}
+ CACHE STRING "${_PKG_NAME} PDB file name"
+ )
+ mark_as_advanced( ${_PKG_VAR}_DLL_DIR ${_PKG_VAR}_DLL ${_PKG_VAR}_PDB )
else()
set( ${_PKG_VAR}_DLL_DIR )
set( ${_PKG_VAR}_DLL )
endif()
endfunction()
+
+# Add a list of DLLs
+function(AddWSWinDLLS _PKG_NAME _PKG_HINTS) # ...DLL globs
+ if(WIN32 AND ${_PKG_NAME}_FOUND)
+ string(TOUPPER ${_PKG_NAME} _PKG_VAR)
+ set ( ${_PKG_VAR}_DLL_DIR "${${_PKG_HINTS}}/bin"
+ CACHE PATH "Path to ${_PKG_NAME} DLLs"
+ )
+
+ set (_pkg_dlls)
+ set (_pkg_pdbs)
+ foreach(_dll_glob ${ARGN})
+ file( GLOB _pkg_dll RELATIVE "${${_PKG_VAR}_DLL_DIR}"
+ "${${_PKG_VAR}_DLL_DIR}/${_dll_glob}.dll"
+ )
+ list(APPEND _pkg_dlls "${_pkg_dll}")
+ file( GLOB _pkg_pdb RELATIVE "${${_PKG_VAR}_DLL_DIR}"
+ "${${_PKG_VAR}_DLL_DIR}/${_dll_glob}.pdb"
+ )
+ list(APPEND _pkg_pdbs "${_pkg_pdb}")
+ endforeach()
+
+ set ( ${_PKG_VAR}_DLLS ${_pkg_dlls}
+ CACHE FILEPATH "${_PKG_NAME} DLL list"
+ )
+ set ( ${_PKG_VAR}_PDBS ${_pkg_pdbs}
+ CACHE FILEPATH "${_PKG_NAME} PDB list"
+ )
+
+ mark_as_advanced( ${_PKG_VAR}_DLL_DIR ${_PKG_VAR}_DLLS ${_PKG_VAR}_PDBS )
+ else()
+ set( ${_PKG_VAR}_DLL_DIR )
+ set( ${_PKG_VAR}_DLLS )
+ set( ${_PKG_VAR}_PDBS )
+ endif()
+endfunction()
diff --git a/cmake/modules/FindZLIB.cmake b/cmake/modules/FindZLIB.cmake
index 909961b8eb..ceeea6d0d2 100644
--- a/cmake/modules/FindZLIB.cmake
+++ b/cmake/modules/FindZLIB.cmake
@@ -8,6 +8,7 @@
# ZLIB_FOUND - True if zlib found.
# ZLIB_DLL_DIR - (Windows) Path to the zlib DLL.
# ZLIB_DLL - (Windows) Name of the zlib DLL.
+# ZLIB_PDB - (Windows) Name of the zlib PDB.
#
# ZLIB_VERSION_STRING - The version of zlib found (x.y.z)
# ZLIB_VERSION_MAJOR - The major version of zlib
@@ -34,9 +35,9 @@
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
-# We set these manually on Windows.
-#INCLUDE(FindWSWinLibs)
-#FindWSWinLibs("zlib" "ZLIB_HINTS")
+include( FindWSWinLibs )
+# Zlib is included with GLib2
+FindWSWinLibs( "vcpkg-export-*" "ZLIB_HINTS" )
if (NOT ZLIB_INCLUDE_DIR OR NOT ZLIB_LIBRARY)
find_package(PkgConfig)
@@ -88,16 +89,10 @@ IF(ZLIB_INCLUDE_DIR AND EXISTS "${ZLIB_INCLUDE_DIR}/zlib.h")
ENDIF()
#
-# Sigh. On Windows, we build libz as part of the Wireshark build
-# process, so we don't necessarily *have* a libz library to search
-# for inflatePrime() at this point; the search fails on the buildbots,
-# for example. See bug 13850.
-#
-# So, on Windows, we just assume we have a new enough version of
-# libz, so that it has inflatePrime().
+# inflatePrime was added in zlib 1.2.2.4 in 2005. We're guaranteed
+# to have it on Windows.
#
IF(WIN32)
- MESSAGE(STATUS "Zlib might not be built yet; assume it contains inflatePrime")
SET(HAVE_INFLATEPRIME ON)
ELSE()
INCLUDE(CMakePushCheckState)
@@ -133,24 +128,14 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(ZLIB REQUIRED_VARS ZLIB_LIBRARY ZLIB_INCLUDE_D
VERSION_VAR ZLIB_VERSION_STRING)
IF(ZLIB_FOUND)
+ AddWSWinDLL(ZLIB ZLIB_HINTS "zlib*")
SET(ZLIB_INCLUDE_DIRS ${ZLIB_INCLUDE_DIR})
SET(ZLIB_LIBRARIES ${ZLIB_LIBRARY})
- #if (WIN32)
- # set ( ZLIB_DLL_DIR "${ZLIB_HINTS}"
- # CACHE PATH "Path to the Zlib DLL"
- # )
- # file( GLOB _zlib_dll RELATIVE "${ZLIB_DLL_DIR}"
- # "${ZLIB_DLL_DIR}/zlib1.dll"
- # )
- # set ( ZLIB_DLL ${_zlib_dll}
- # # We're storing filenames only. Should we use STRING instead?
- # CACHE FILEPATH "Zlib DLL file name"
- # )
- # mark_as_advanced( ZLIB_DLL_DIR ZLIB_DLL )
- #endif()
ELSE()
SET(ZLIB_INCLUDE_DIRS )
SET(ZLIB_LIBRARIES )
SET(ZLIB_DLL_DIR )
SET(ZLIB_DLL )
+ SET(ZLIB_PDB )
ENDIF()
+