浏览代码

fix wxwidgets linux build (#2896)

* fix wxwidgets linux build

* Update xmake.lua

* Update xmake.lua

* Update xmake.lua

* modify workflow

* Update xmake.lua

* Update xmake.lua
xpxz 1 年之前
父节点
当前提交
d1732bed33

+ 1 - 1
.github/workflows/archlinux.yml

@@ -23,7 +23,7 @@ jobs:
         run: |
           pacman -Syu --noconfirm --needed openssl
           pacman -Sy --noconfirm --needed glibc git base-devel perl make unzip p7zip
-          pacman -Sy --noconfirm --needed mesa gcc-fortran glu libc++
+          pacman -Sy --noconfirm --needed mesa gcc-fortran glu libc++ gtk3
           git config --global --add safe.directory /__w/xmake/xmake
           git config --global --add safe.directory /__w/xmake-repo/xmake-repo
       - uses: actions/checkout@v1

+ 1 - 1
.github/workflows/fedora.yml

@@ -28,7 +28,7 @@ jobs:
           dnf -y install copr-cli make gcc-c++ libatomic libcxx-devel
           dnf -y upgrade git
           dnf -y install perl
-          dnf -y install glibc-static libstdc++-static
+          dnf -y install glibc-static libstdc++-static gtk3-devel
           git config --global --add safe.directory /__w/xmake-repo/xmake-repo
       - uses: actions/checkout@v1
       - uses: xmake-io/github-action-setup-xmake@v1

+ 1 - 1
.github/workflows/ubuntu.yml

@@ -29,7 +29,7 @@ jobs:
         run: |
           # TODO we will remove it later
           sudo apt-get update
-          sudo apt-get install -y libgl1-mesa-dev libglu1-mesa-dev p7zip gobjc gcc g++
+          sudo apt-get install -y libgl1-mesa-dev libglu1-mesa-dev p7zip gobjc gcc g++ libgtk-3-dev
 
       - name: Tests
         run: |

+ 1 - 1
.github/workflows/ubuntu_clang.yml

@@ -28,7 +28,7 @@ jobs:
         run: |
           # TODO we will remove it later
           sudo apt-get update
-          sudo apt-get install -y libgl1-mesa-dev libglu1-mesa-dev clang libomp-dev libc++-dev p7zip
+          sudo apt-get install -y libgl1-mesa-dev libglu1-mesa-dev clang libomp-dev libc++-dev p7zip libgtk-3-dev
 
       - name: Tests
         run: |

+ 41 - 3
packages/w/wxwidgets/xmake.lua

@@ -13,6 +13,14 @@ package("wxwidgets")
             add_resources("3.2.2", "releaseDLL",
                 "https://github.com/wxWidgets/wxWidgets/releases/download/v3.2.2/wxMSW-3.2.2_vc14x_x64_ReleaseDLL.7z",
                 "34e11c8d493e4f2856441942a88296864243db320e3f9057633d50b89a4f2848")
+            add_versions("3.2.3", "b8a6be72378d9947e303d7075a58c9bbc161d5debd25a187b654373b4d204873")
+            add_resources("3.2.3", "releaseDLL",
+                "https://github.com/wxWidgets/wxWidgets/releases/download/v3.2.3/wxMSW-3.2.3_vc14x_x64_ReleaseDLL.7z",
+                "ee0fde533b7ac8eac6ec112da2e3a488675aa8c1dda483eb8a9a2d4f8e5bb734")
+            add_versions("3.2.4", "b8be152f08031aed2bfeffd17d8409209c38667859094b319818e08f7a4ad065")
+            add_resources("3.2.4", "releaseDLL",
+                "https://github.com/wxWidgets/wxWidgets/releases/download/v3.2.4/wxMSW-3.2.4_vc14x_x64_ReleaseDLL.7z",
+                "0f9108e64f98978580fee2d4b3a53451ab4333e4b47dde45b82e7867d0bbfc2c")
         else
             add_urls("https://github.com/wxWidgets/wxWidgets/releases/download/v$(version)/wxMSW-$(version)_vc14x_Dev.7z")
             add_versions("3.2.0", "0cd2387edcf1f26924d59efcc3ea4c8a00783ee01bf396756dabdd7967e4b37b")
@@ -23,6 +31,14 @@ package("wxwidgets")
             add_resources("3.2.2", "releaseDLL",
                 "https://github.com/wxWidgets/wxWidgets/releases/download/v3.2.2/wxMSW-3.2.2_vc14x_ReleaseDLL.7z",
                 "1a8d387fae963d2242b0fc628699d34bb6141751fb05dec8fa9c0e2784833426")
+            add_versions("3.2.3", "8961f24abb16362a542140912f3c6cb75b8f95111816311ecf5b00ea1e0c55f3")
+            add_resources("3.2.3", "releaseDLL",
+                "https://github.com/wxWidgets/wxWidgets/releases/download/v3.2.3/wxMSW-3.2.3_vc14x_ReleaseDLL.7z",
+                "b1b22d43509c2e1fe427d038210076dcb1d9953e5fef09ffa04e49f49c78a9a7")
+            add_versions("3.2.4", "efa6bf76d42373e7930af18a176e5e52fbdd43f5da41b9bf6cd3b347d820f8b7")
+            add_resources("3.2.4", "releaseDLL",
+                "https://github.com/wxWidgets/wxWidgets/releases/download/v3.2.4/wxMSW-3.2.4_vc14x_ReleaseDLL.7z",
+                "240308cb9ffb718ab2f1298238c6e6aea7708cb16aca5801a03bffee6f9ef673")
         end
         add_resources("3.2.0", "headers",
             "https://github.com/wxWidgets/wxWidgets/releases/download/v3.2.0/wxWidgets-3.2.0-headers.7z",
@@ -30,6 +46,12 @@ package("wxwidgets")
         add_resources("3.2.2", "headers",
             "https://github.com/wxWidgets/wxWidgets/releases/download/v3.2.2/wxWidgets-3.2.2-headers.7z",
             "affad097f2c274f796bf08494c1624d999d75727e73959bce5a3d366aeebc721")
+        add_resources("3.2.3", "headers",
+            "https://github.com/wxWidgets/wxWidgets/releases/download/v3.2.3/wxWidgets-3.2.3-headers.7z",
+            "a610f1a044b93f4d8d5439c67fc42b3feb168d854bc4725aa2b5ff4569d89a06")
+        add_resources("3.2.4", "headers",
+            "https://github.com/wxWidgets/wxWidgets/releases/download/v3.2.4/wxWidgets-3.2.4-headers.7z",
+            "b8c4fd1a62c104c65089a088670d80e827b3893b7425c1cab8d7e49879797326")
 
         add_configs("shared",     {description = "Build shared library.", default = true, type = "boolean", readonly = true})
         add_configs("vs_runtime", {description = "Set vs compiler runtime.", default = "MD", readonly = true})
@@ -39,12 +61,13 @@ package("wxwidgets")
                  "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_deps("cmake")
         add_deps("libjpeg", "libpng", "nanosvg", "expat", "zlib")
         if is_plat("linux") then
-            add_deps("libx11", "libxext", "libxtst")
-            add_deps("gtk+3", "opengl", {optional = true})
+            add_deps("gtk+3", "opengl")
         end
     end
 
@@ -55,6 +78,7 @@ package("wxwidgets")
     elseif is_plat("linux") then
         add_defines("__WXGTK3__", "__WXGTK__")
         add_syslinks("pthread", "m", "dl")
+        add_syslinks("X11", "Xext", "Xtst", "xkbcommon")
     elseif is_plat("windows") then
         add_defines("WXUSINGDLL", "__WXMSW__", "wxSUFFIX=u", "wxMSVC_VERSION=14x")
         add_links(
@@ -117,17 +141,31 @@ package("wxwidgets")
             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()
         local setupdir = package:is_plat("macosx") and "osx" or "gtk"
         os.cp(path.join(package:installdir("include", subdir, "wx", setupdir, "setup.h")),
               path.join(package:installdir("include", subdir, "wx")))
+        local lib_suffix = version:major() .. "." .. version:minor()
+        if package:is_plat("linux") then
+            package:add("links", "wx_gtk3u_xrc-" .. lib_suffix, "wx_gtk3u_html-" .. lib_suffix, "wx_gtk3u_qa-" .. lib_suffix, "wx_gtk3u_core-" .. lib_suffix, "wx_baseu_xml-" .. lib_suffix, "wx_baseu_net-" .. lib_suffix, "wx_baseu-" .. lib_suffix)
+        end
     end)
 
     on_test(function (package)
         assert(package:check_cxxsnippets({test = [[
-            #include "wx/wx.h"
+            #include <wx/wxprec.h>
+            #ifndef WX_PRECOMP
+                #include <wx/wx.h>
+            #endif
             #include "wx/app.h"
             #include "wx/cmdline.h"
             void test() {