瀏覽代碼

improve glew to support mingw (#399)

* glew

* fix glew for mingw
ruki 4 年之前
父節點
當前提交
69cafbc69d
共有 2 個文件被更改,包括 8 次插入6 次删除
  1. 6 4
      packages/g/glew/port/xmake.lua
  2. 2 2
      packages/g/glew/xmake.lua

+ 6 - 4
packages/g/glew/port/xmake.lua

@@ -6,7 +6,7 @@ end
 
 target("glew")
     set_kind("$(kind)")
-    if is_plat("windows") or is_plat("mingw") then
+    if is_plat("windows", "mingw") then
         set_basename("glew32")
         add_syslinks("glu32", "opengl32")
     elseif is_plat("macosx") then
@@ -16,11 +16,13 @@ target("glew")
     end
     add_defines("GLEW_NO_GLU")
     if is_plat("windows") then
-        if get_config("kind") == "shared" then
+        if is_kind("shared") then
             add_defines("GLEW_BUILD")
         else
             add_defines("GLEW_STATIC", {public = true})
         end
+    elseif is_plat("mingw") and not is_kind("shared") then
+        add_defines("GLEW_STATIC", {public = true})
     end
     add_files("src/glew.c")
     add_includedirs("include", {public = true})
@@ -29,7 +31,7 @@ target("glew")
 target("glewinfo")
     set_kind("binary")
     add_deps("glew")
-    if is_plat("windows") or is_plat("mingw") then
+    if is_plat("windows", "mingw") then
         add_syslinks("user32", "gdi32", "glu32", "opengl32")
     elseif is_plat("macosx") then
         add_frameworks("OpenGL")
@@ -42,7 +44,7 @@ target("glewinfo")
 target("visualinfo")
     set_kind("binary")
     add_deps("glew")
-    if is_plat("windows") or is_plat("mingw") then
+    if is_plat("windows", "mingw") then
         add_syslinks("user32", "gdi32", "glu32", "opengl32")
     elseif is_plat("macosx") then
         add_frameworks("OpenGL")

+ 2 - 2
packages/g/glew/xmake.lua

@@ -14,13 +14,13 @@ package("glew")
         add_deps("libx11", "xorgproto")
     end
 
-    on_load("windows", "mingw@windows", function (package)
+    on_load("windows", "mingw", function (package)
         if not package:config("shared") then
             package:add("defines", "GLEW_STATIC")
         end
     end)
 
-    on_install("linux", "macosx", "mingw@windows", "windows", function (package)
+    on_install("linux", "macosx", "mingw", "windows", function (package)
         local configs = {}
         configs.mode = package:debug() and "debug" or "release"
         if package:config("shared") then