Merge pull request #87 from xmake-io/glew

improve glew with x11
pull/89/head
ruki 5 years ago committed by GitHub
commit 50f658fb8d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 32
      packages/g/glew/xmake.lua

@ -16,6 +16,7 @@ package("glew")
else
add_links("GLEW")
if is_plat("linux") then
add_deps("libx11", "xorgproto")
add_syslinks("GLU", "GL")
elseif is_plat("macosx") then
add_frameworks("OpenGL")
@ -23,16 +24,9 @@ package("glew")
end
on_load(function (package)
if package:config("shared") then
package:add("defines", "GLEW_BUILD")
if package:is_plat("windows", "mingw") then
package:add("links", "glew32")
end
else
package:add("defines", "GLEW_STATIC")
if package:is_plat("windows", "mingw") then
package:add("links", "glew32s")
end
package:add("defines", "GLEW_BUILD")
if package:is_plat("windows", "mingw") then
package:add("links", "glew32")
end
end)
@ -52,7 +46,23 @@ package("glew")
end)
on_install("linux", "macosx", function (package)
os.vrun("make", {"glew.lib." .. (package:config("shared") and "shared" or "static")})
local configs = {"glew.lib." .. (package:config("shared") and "shared" or "static")}
local cflags = {}
for _, dep in ipairs(package:orderdeps()) do
local fetchinfo = dep:fetch()
if fetchinfo then
for _, includedir in ipairs(fetchinfo.includedirs) do
table.insert(cflags, "-I" .. includedir)
end
end
end
if package:config("shared") then
table.insert(cflags, "-fPIC")
end
if #cflags > 0 then
table.insert(configs, "CFLAGS.EXTRA=" .. table.concat(cflags, " "))
end
import("package.tools.make").build(package, configs)
os.cp("lib", package:installdir())
os.cp("include", package:installdir())
end)

Loading…
Cancel
Save