fix wxwidgets with gtk3 (#5247)

* fix wxwidgets with gtk3

* delete the linux condition in the on_load part of gdk-pixbuf

* add bz version

* change the gz version to bz2 version

* change the gtk3 packagedeps to glib harfbuzz and cairo

* delete packagedeps and add cmake version warning

* add gdk-pixbuf shared option

* Remove the manual addition of GTK3's includedir

* specify the cmake version

* change at-spi2-core to linux area

* add gtk3 libdir

* add gtk_cmake.patch

* add link_directories to gtk3_cmake.patch

* add libdir to patch

* add version range to patches
pull/5561/head
benny066567 1 month ago committed by GitHub
parent cbcad8f4a9
commit 629adaa5b4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 11
      packages/g/gdk-pixbuf/xmake.lua
  2. 12
      packages/g/gtk3/xmake.lua
  3. 38
      packages/w/wxwidgets/patches/3.2.5/add_libdir.patch
  4. 50
      packages/w/wxwidgets/xmake.lua

@ -24,7 +24,16 @@ package("gdk-pixbuf")
add_includedirs("include", "include/gdk-pixbuf-2.0")
add_deps("meson", "ninja")
add_deps("libpng", "libjpeg-turbo", "libtiff", "glib", "pcre2")
add_deps("libpng", "libjpeg-turbo", "glib", "pcre2")
on_load(function (package)
if package:config("shared") then
package:add("deps", "libtiff", {configs = {shared = true}})
else
package:add("deps", "libtiff")
end
end)
if is_plat("windows") then
add_syslinks("iphlpapi", "dnsapi")
add_deps("pkgconf", "libintl")

@ -15,13 +15,22 @@ package("gtk3")
if is_plat("linux") then
add_syslinks("rt")
add_syslinks("pthread")
end
add_includedirs("include", "include/gtk-3.0")
on_load("linux", function (package)
if package:config("shared") then
package:add("deps", "gdk-pixbuf", {configs = {shared = true}})
else
package:add("deps", "gdk-pixbuf")
end
end)
add_deps("meson", "ninja")
add_deps("cairo", {configs = {glib = true}})
add_deps("glib", "gdk-pixbuf", "pango", "libepoxy", "graphene", "libxkbcommon", "libxext")
add_deps("glib", "pango", "libepoxy", "graphene", "libxkbcommon", "libxext")
add_deps("libx11", "libxfixes", "libxcursor", "libxi", "libxcomposite", "libxrandr", "libxdamage", "libxinerama", "at-spi2-core")
add_links("gtk-3", "gdk-3", "gailutil-3", "X11", "X11-cxb", "pangocairo-1.0", "pango", "rt")
@ -32,6 +41,7 @@ package("gtk3")
import("package.tools.meson").install(package, configs, {packagedeps = {"libx11",
"libxext",
"libxi",
"pango",
"at-spi2-core",
"cairo",
"libthai",

@ -0,0 +1,38 @@
diff --git a/build/cmake/modules/FindGTK3.cmake b/build/cmake/modules/FindGTK3.cmake
index d2939a1..b8f5fab 100644
--- a/build/cmake/modules/FindGTK3.cmake
+++ b/build/cmake/modules/FindGTK3.cmake
@@ -29,7 +29,7 @@
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
find_package(PkgConfig)
-pkg_check_modules(GTK3 QUIET gtk+-3.0)
+pkg_check_modules(GTK3 REQUIRED IMPORTED_TARGET gtk+-3.0)
set(VERSION_OK TRUE)
if (GTK3_VERSION)
if (GTK3_FIND_VERSION_EXACT)
@@ -45,9 +45,10 @@ endif ()
# Check for GDK Wayland support
include(CheckSymbolExists)
set(CMAKE_REQUIRED_INCLUDES ${GTK3_INCLUDE_DIRS})
+link_directories(${GTK3_LIBRARY_DIRS})
check_symbol_exists(GDK_WINDOWING_WAYLAND "gdk/gdk.h" wxHAVE_GDK_WAYLAND)
check_symbol_exists(GDK_WINDOWING_X11 "gdk/gdk.h" wxHAVE_GDK_X11)
include(FindPackageHandleStandardArgs)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(GTK3 DEFAULT_MSG GTK3_INCLUDE_DIRS GTK3_LIBRARIES VERSION_OK)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(GTK3 DEFAULT_MSG GTK3_INCLUDE_DIRS GTK3_LIBRARY_DIRS GTK3_LIBRARIES VERSION_OK)
-mark_as_advanced(GTK3_INCLUDE_DIRS GTK3_LIBRARIES)
+mark_as_advanced(GTK3_INCLUDE_DIRS GTK3_LIBRARY_DIRS GTK3_LIBRARIES)
diff --git a/build/cmake/modules/FindWAYLANDEGL.cmake b/build/cmake/modules/FindWAYLANDEGL.cmake
index ad23bf9..8208d19 100644
--- a/build/cmake/modules/FindWAYLANDEGL.cmake
+++ b/build/cmake/modules/FindWAYLANDEGL.cmake
@@ -14,6 +14,7 @@ if (WAYLANDEGL_VERSION)
endif ()
endif ()
+link_directories(${WAYLANDEGL_LIBRARY_DIRS})
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(WAYLANDEGL DEFAULT_MSG WAYLANDEGL_LIBRARIES VERSION_OK)

@ -57,17 +57,19 @@ package("wxwidgets")
add_configs("vs_runtime", {description = "Set vs compiler runtime.", default = "MD", readonly = true})
add_configs("debug", {description = "Enable debug symbols.", default = false, type = "boolean", readonly = true})
else
add_urls("https://github.com/wxWidgets/wxWidgets/archive/refs/tags/$(version).tar.gz",
add_urls("https://github.com/wxWidgets/wxWidgets/releases/download/v$(version)/wxWidgets-$(version).tar.bz2",
"https://github.com/wxWidgets/wxWidgets.git")
add_versions("v3.2.0", "43480e3887f32924246eb439520a3a2bc04d7947712de1ea0590c5b58dedadd9")
add_versions("v3.2.2", "2a4ec4d1af3f22fbfd0a40b051385a5d82628d9f28bae8427f5c30d72bdaade7")
add_versions("v3.2.3", "0eb9499c06778c6746dbd4aee2a124f1995a5db331e282d15237b0046c1788af")
add_versions("v3.2.4", "b358b7f59f5b7cb934265120d114e5fd510a8b40802d00a111a85911eb5100d1")
add_versions("3.2.0", "356e9b55f1ae3d58ae1fed61478e9b754d46b820913e3bfbc971c50377c1903a")
add_versions("3.2.2", "8edf18672b7bc0996ee6b7caa2bee017a9be604aad1ee471e243df7471f5db5d")
add_versions("3.2.3", "c170ab67c7e167387162276aea84e055ee58424486404bba692c401730d1a67a")
add_versions("3.2.4", "0640e1ab716db5af2ecb7389dbef6138d7679261fbff730d23845ba838ca133e")
add_versions("3.2.5", "0ad86a3ad3e2e519b6a705248fc9226e3a09bbf069c6c692a02acf7c2d1c6b51")
add_deps("cmake")
add_deps("libjpeg", "libpng", "nanosvg", "expat", "zlib")
add_deps("libjpeg", "libpng", "nanosvg", "expat", "zlib", "pango", "glib")
if is_plat("linux") then
add_deps("gtk+3", "opengl")
add_deps("opengl", "at-spi2-core")
add_patches("<=3.2.5", "patches/3.2.5/add_libdir.patch", "9a9fe4d745b4b6b09998ec7a93642d69761a8779d203fbb42a3df8c3d62adeb0")
end
end
@ -79,6 +81,9 @@ package("wxwidgets")
add_defines("__WXGTK3__", "__WXGTK__")
add_syslinks("pthread", "m", "dl")
add_syslinks("X11", "Xext", "Xtst", "xkbcommon")
add_links(
"pango-1.0", "pangoxft-1.0", "pangocairo-1.0", "pangoft2-1.0"
)
elseif is_plat("windows") then
add_defines("WXUSINGDLL", "__WXMSW__", "wxSUFFIX=u", "wxMSVC_VERSION=14x")
add_links(
@ -107,8 +112,18 @@ package("wxwidgets")
if package:config("shared") then
package:add("defines", "WXUSINGDLL")
package:add("deps", "libtiff", {configs = {shared = true}})
package:add("deps", "gdk-pixbuf", {configs = {shared = true}})
else
package:add("deps", "libtiff")
package:add("deps", "gdk-pixbuf")
end
if is_plat("linux") then
if package:config("shared") then
package:add("deps", "gtk3", {configs = {shared = true}})
else
package:add("deps", "gtk3")
end
end
end
end)
@ -124,6 +139,17 @@ package("wxwidgets")
end)
on_install("macosx", "linux", function (package)
-- Notify the user about issues caused by the CMake version.
local cmake = package:dep("cmake")
local cmake_fetch = cmake:fetch()
local major, minor, patch = cmake_fetch.version:match("^(%d+)%.(%d+)%.(%d+)$")
local cmake_version = tonumber(major.. minor.. patch)
if cmake_version > 3280 then
wprint("\ncmake may not find Cmath detail in https://github.com/prusa3d/PrusaSlicer/issues/12169\n")
end
io.replace("build/cmake/modules/FindGTK3.cmake", "FIND_PACKAGE_HANDLE_STANDARD_ARGS(GTK3 DEFAULT_MSG GTK3_INCLUDE_DIRS GTK3_LIBRARIES VERSION_OK)",
[[FIND_PACKAGE_HANDLE_STANDARD_ARGS(GTK3 DEFAULT_MSG GTK3_INCLUDE_DIRS GTK3_LIBRARY_DIRS GTK3_LIBRARIES VERSION_OK)]], {plain = true})
local configs = {"-DwxBUILD_TESTS=OFF",
"-DwxBUILD_SAMPLES=OFF",
"-DwxBUILD_DEMOS=OFF",
@ -135,19 +161,13 @@ package("wxwidgets")
"-DwxUSE_LIBJPEG=sys",
"-DwxUSE_LIBPNG=sys",
"-DwxUSE_NANOSVG=sys",
"-DwxUSE_LIBTIFF=sys"}
"-DwxUSE_LIBTIFF=builtin"}
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
if package:debug() then
table.insert(configs, "-DwxBUILD_DEBUG_LEVEL=2")
end
table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
if package:is_plat("linux") then
local libgtk3 = package:dep("gtk+3"):fetch()
if libgtk3 then
table.insert(configs, "-DGTK3_INCLUDE_DIRS=" .. table.concat(libgtk3.sysincludedirs, ";"))
table.insert(configs, "-DGTK3_LIBRARIES=" .. table.concat(libgtk3.links, ";"))
end
end
import("package.tools.cmake").install(package, configs)
local version = package:version()
local subdir = "wx-" .. version:major() .. "." .. version:minor()

Loading…
Cancel
Save