[wxwidgets] Use vcpkg gtk3 for linux et al., fix mingw cross builds (#27087)

* Minor port corrections

* Use vcpkg gtk3 for linux et al.

* Update versions

* Update cmake-user

* Use vcpkg sdl2 cmake config

* Update versions

* Add direct cairo dependency

* Declare maybe-unused variables

* Fix mingw cross builds

* Update versions
This commit is contained in:
Kai Pastor 2022-10-09 06:26:00 +02:00 committed by GitHub
parent b0956f6170
commit 2909a549a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 79 additions and 46 deletions

View File

@ -11,31 +11,16 @@ vcpkg_from_github(
fix-libs-export.patch
fix-pcre2.patch
gtk3-link-libraries.patch
sdl2.patch
)
if(VCPKG_TARGET_IS_LINUX)
message(WARNING [[
Port wxwidgets currently requires the following packages from the system package manager:
pkg-config
GTK 3
libsecret
libgcrypt
libsystemd
These development packages can be installed on Ubuntu systems via
sudo apt-get install pkg-config libgtk-3-dev libsecret-1-dev libgcrypt20-dev libsystemd-dev
]])
foreach(conflicting_port IN ITEMS freetype glib)
if(EXISTS "${CURRENT_INSTALLED_DIR}/share/${conflicting_port}/copyright")
message(FATAL_ERROR "Port ${conflicting_port} must not be installed when building ${PORT}:${TARGET_TRIPLET}.")
endif()
endforeach()
endif()
vcpkg_check_features(
OUT_FEATURE_OPTIONS FEATURE_OPTIONS
FEATURES
sound wxUSE_SOUND
fonts wxUSE_PRIVATE_FONTS
media wxUSE_MEDIACTRL
sound wxUSE_SOUND
webview wxUSE_WEBVIEW
webview wxUSE_WEBVIEW_EDGE
)
@ -58,19 +43,6 @@ else()
list(APPEND OPTIONS -DwxUSE_WEBREQUEST_CURL=ON)
endif()
if(DEFINED ENV{PKG_CONFIG})
set(PKGCONFIG "$ENV{PKG_CONFIG}")
elseif(VCPKG_TARGET_IS_LINUX AND NOT VCPKG_CROSSCOMPILING)
# wxWidgets on Linux currently needs to find the system's `gtk+-3.0.pc`.
# vcpkg's port pkgconf would prevent this lookup.
find_program(system_pkg_config NAMES pkg-config)
if(system_pkg_config)
set(PKGCONFIG "${system_pkg_config}")
endif()
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
list(APPEND OPTIONS -DPKG_CONFIG_ARGN=--static)
endif()
endif()
vcpkg_find_acquire_program(PKGCONFIG)
# This may be set to ON by users in a custom triplet.
@ -95,9 +67,14 @@ vcpkg_cmake_configure(
-DwxUSE_LIBPNG=sys
-DwxUSE_LIBTIFF=sys
-DwxUSE_NANOSVG=sys
-DwxUSE_SECRETSTORE=FALSE
-DwxUSE_LIBGNOMEVFS=OFF
-DwxUSE_LIBNOTIFY=OFF
-DwxUSE_SECRETSTORE=OFF
-DwxUSE_STL=${WXWIDGETS_USE_STL}
-DwxUSE_STD_CONTAINERS=${WXWIDGETS_USE_STD_CONTAINERS}
-DwxUSE_UIACTIONSIMULATOR=OFF
-DCMAKE_DISABLE_FIND_PACKAGE_GSPELL=ON
-DCMAKE_DISABLE_FIND_PACKAGE_MSPACK=ON
${OPTIONS}
"-DPKG_CONFIG_EXECUTABLE=${PKGCONFIG}"
# The minimum cmake version requirement for Cotire is 2.8.12.
@ -105,6 +82,9 @@ vcpkg_cmake_configure(
-DPKG_CONFIG_USE_CMAKE_PREFIX_PATH=ON
OPTIONS_RELEASE
${OPTIONS_RELEASE}
MAYBE_UNUSED_VARIABLES
CMAKE_DISABLE_FIND_PACKAGE_GSPELL
CMAKE_DISABLE_FIND_PACKAGE_MSPACK
)
vcpkg_cmake_install()
@ -117,7 +97,7 @@ file(REMOVE_RECURSE
)
set(tools wxrc)
if(NOT VCPKG_TARGET_IS_WINDOWS OR NOT VCPKG_HOST_IS_WINDOWS)
if(NOT VCPKG_TARGET_IS_WINDOWS)
list(APPEND tools wxrc-3.2)
file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/tools/${PORT}")
file(RENAME "${CURRENT_PACKAGES_DIR}/bin/wx-config" "${CURRENT_PACKAGES_DIR}/tools/${PORT}/wx-config")
@ -189,7 +169,7 @@ if(EXISTS "${CURRENT_PACKAGES_DIR}/debug/lib/mswud/wx/setup.h")
endif()
if(NOT "debug-support" IN_LIST FEATURES)
if(VCPKG_TARGET_IS_WINDOWS AND VCPKG_HOST_IS_WINDOWS)
if(VCPKG_TARGET_IS_WINDOWS)
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/wx/debug.h" "#define wxDEBUG_LEVEL 1" "#define wxDEBUG_LEVEL 0")
else()
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/wx-3.2/wx/debug.h" "#define wxDEBUG_LEVEL 1" "#define wxDEBUG_LEVEL 0")

View File

@ -0,0 +1,29 @@
diff --git a/build/cmake/init.cmake b/build/cmake/init.cmake
index 7bd00d3..d903584 100644
--- a/build/cmake/init.cmake
+++ b/build/cmake/init.cmake
@@ -493,7 +493,9 @@ if(wxUSE_GUI)
endif()
if(wxUSE_SOUND AND wxUSE_LIBSDL AND UNIX AND NOT APPLE)
- find_package(SDL2)
+ find_package(SDL2 CONFIG REQUIRED)
+ set(SDL2_INCLUDE_DIR "" CACHE INTERNAL "")
+ set(SDL2_LIBRARY SDL2::SDL2 CACHE INTERNAL "")
if(NOT SDL2_FOUND)
find_package(SDL)
endif()
diff --git a/build/cmake/wxWidgetsConfig.cmake.in b/build/cmake/wxWidgetsConfig.cmake.in
index 248a701..f617dc4 100644
--- a/build/cmake/wxWidgetsConfig.cmake.in
+++ b/build/cmake/wxWidgetsConfig.cmake.in
@@ -2,6 +2,9 @@
include(CMakeFindDependencyMacro)
find_dependency(unofficial-nanosvg CONFIG)
+if("@wxUSE_LIBSDL@")
+ find_dependency(SDL2 CONFIG)
+endif()
# determine target from compiler, platform and library type
if(WIN32 AND NOT CYGWIN AND NOT MSYS)

View File

@ -7,7 +7,7 @@ set(wxWidgets_ROOT_DIR "${_vcpkg_wx_root}" CACHE INTERNAL "")
set(WX_ROOT_DIR "${_vcpkg_wx_root}" CACHE INTERNAL "")
unset(_vcpkg_wx_root)
if(WIN32 AND CMAKE_HOST_WIN32)
if(WIN32)
# Find all libs with "32" infix which is unknown to FindwxWidgets.cmake
function(z_vcpkg_wxwidgets_find_base_library BASENAME)
find_library(WX_${BASENAME}d wx${BASENAME}32ud NAMES wx${BASENAME}d PATHS "${wxWidgets_ROOT_DIR}/debug/lib" NO_DEFAULT_PATH)
@ -31,11 +31,6 @@ if(WIN32 AND CMAKE_HOST_WIN32)
set(wxWidgets_LIB_DIR "${wxWidgets_ROOT_DIR}/lib" CACHE INTERNAL "")
else()
# FindwxWidgets.cmake unix mode, single-config
if(MINGW)
# Force FindwxWidgets.cmake unix mode for mingw cross builds
set(_vcpkg_wxwidgets_backup_crosscompiling "${CMAKE_CROSSCOMPILING}")
set(CMAKE_CROSSCOMPILING 1)
endif()
set(_vcpkg_wxconfig "")
if(CMAKE_BUILD_TYPE STREQUAL "Debug" OR "Debug" IN_LIST MAP_IMPORTED_CONFIG_${CMAKE_BUILD_TYPE})
# Debug
@ -59,7 +54,7 @@ if(DEFINED _vcpkg_wxwidgets_backup_crosscompiling)
unset(_vcpkg_wxwidgets_backup_crosscompiling)
endif()
if(WIN32 AND CMAKE_HOST_WIN32 AND "@VCPKG_LIBRARY_LINKAGE@" STREQUAL "static" AND NOT "wx::core" IN_LIST wxWidgets_LIBRARIES)
if(WIN32 AND "@VCPKG_LIBRARY_LINKAGE@" STREQUAL "static" AND NOT "wx::core" IN_LIST wxWidgets_LIBRARIES)
find_package(EXPAT QUIET)
find_package(JPEG QUIET)
find_package(PNG QUIET)

View File

@ -1,6 +1,7 @@
{
"name": "wxwidgets",
"version": "3.2.1",
"port-version": 1,
"description": [
"Widget toolkit and tools library for creating graphical user interfaces (GUIs) for cross-platform applications. ",
"Set WXWIDGETS_USE_STL in a custom triplet to build with the wxUSE_STL build option.",
@ -10,12 +11,25 @@
"license": "LGPL-2.0-or-later WITH WxWindows-exception-3.1",
"supports": "!uwp",
"dependencies": [
{
"name": "cairo",
"default-features": false,
"platform": "!windows & !osx & !ios"
},
{
"name": "curl",
"default-features": false,
"platform": "!windows & !osx"
},
"expat",
{
"name": "gtk3",
"platform": "!windows & !osx & !ios"
},
{
"name": "libiconv",
"platform": "!windows"
},
"libjpeg-turbo",
"libpng",
"nanosvg",
@ -55,13 +69,23 @@
}
]
},
"media": {
"description": "Build wxMediaCtrl support",
"dependencies": [
{
"name": "gstreamer",
"default-features": false,
"platform": "!windows & !osx & !ios"
}
]
},
"sound": {
"description": "Build wxSound support",
"dependencies": [
{
"name": "sdl2",
"default-features": false,
"platform": "!windows & !osx"
"platform": "!windows & !osx & !ios"
}
]
},

View File

@ -1176,7 +1176,6 @@ wpilib:arm64-windows=fail
wpilib:x64-osx=fail
wincrypt:arm64-windows=skip # https://github.com/microsoft/vcpkg-tool/pull/599
wxchartdir:x64-osx=fail
wxwidgets:x64-linux=fail
x265:arm64-windows=fail
x265:arm-uwp=fail
x265:x64-uwp=fail
@ -1293,6 +1292,7 @@ vcpkg-ci-paraview:x64-windows-static=pass
vcpkg-ci-paraview:x64-windows=pass
vcpkg-ci-paraview:x86-windows=pass
vcpkg-ci-wxwidgets:arm64-windows=pass
vcpkg-ci-wxwidgets:x64-linux=pass
vcpkg-ci-wxwidgets:x64-osx=pass
vcpkg-ci-wxwidgets:x64-windows-static-md=pass
vcpkg-ci-wxwidgets:x64-windows-static=pass

View File

@ -122,7 +122,7 @@
"$package": "wxWidgets",
"name": "wxwidgets",
"default-features": false,
"platform": "!linux & !uwp"
"platform": "!uwp"
},
{
"$package": "ZLIB",

View File

@ -7894,7 +7894,7 @@
},
"wxwidgets": {
"baseline": "3.2.1",
"port-version": 0
"port-version": 1
},
"x-plane": {
"baseline": "3.0.3",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "3a640144a98d7909a92ba363114f95bcaff554e5",
"version": "3.2.1",
"port-version": 1
},
{
"git-tree": "a113e248e95bf2305a91b4d7c2a93579cc911b15",
"version": "3.2.1",