add opengl, glu and glut (#533)

pull/536/head
ruki 3 years ago committed by GitHub
parent 3e0b10e5e5
commit d1c3a87994
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 11
      packages/f/freeglut/xmake.lua
  2. 4
      packages/g/glfw/xmake.lua
  3. 17
      packages/g/glu/xmake.lua
  4. 21
      packages/g/glut/xmake.lua
  5. 12
      packages/g/glx/xmake.lua
  6. 18
      packages/o/opengl/xmake.lua
  7. 1
      packages/p/pkg-config/xmake.lua

@ -16,15 +16,22 @@ package("freeglut")
if is_plat("linux") then
add_deps("libx11", "libxi", "libxxf86vm", "libxrandr", "libxrender")
add_syslinks("GLU", "GL")
add_deps("glx", {optional = true})
end
add_deps("glu", "opengl", {optional = true})
on_load("windows", function (package)
if not package:config("shared") then
package:add("defines", "FREEGLUT_STATIC=1")
end
package:add("defines", "FREEGLUT_LIB_PRAGMAS=0")
package:add("syslinks", "glu32", "opengl32", "gdi32", "winmm", "user32", "advapi32")
package:add("syslinks", "gdi32", "winmm", "user32", "advapi32")
end)
on_fetch("linux", function (package, opt)
if package.find_package then
return package:find_package("pkgconfig::glut", opt)
end
end)
on_install("linux", "windows", function (package)

@ -10,7 +10,7 @@ package("glfw")
add_configs("glfw_include", {description = "Choose submodules enabled in glfw", default = "none", type = "string", values = {"none", "vulkan", "glu", "glext", "es2", "es3"}})
on_fetch(function (package, opt)
on_fetch(function (package, opt)
if opt.system and package.find_package then
if package:is_plat("linux") then
return package:find_package("apt::libglfw3-dev", opt)
@ -19,7 +19,7 @@ package("glfw")
end)
add_deps("cmake")
add_deps("opengl", {optional = true})
if is_plat("macosx") then
add_frameworks("Cocoa", "IOKit")
elseif is_plat("windows") then

@ -0,0 +1,17 @@
package("glu")
set_homepage("https://gitlab.freedesktop.org/mesa/glu")
set_description("OpenGL utility library")
on_fetch(function (package, opt)
if package:is_plat("macosx") then
return {frameworks = "OpenGL", defines = "GL_SILENCE_DEPRECATION"}
elseif package:is_plat("windows", "mingw") then
return {links = "glu32"}
end
if opt.system then
if package:is_plat("linux") and package.find_package then
return package:find_package("glu", opt) or package:find_package("libglu", opt)
end
end
end)

@ -0,0 +1,21 @@
package("glut")
set_homepage("https://www.opengl.org/resources/libraries/glut/")
set_description("OpenGL utility toolkit")
if not is_plat("macosx") then
add_deps("freeglut")
end
on_fetch(function (package, opt)
if opt.system then
if package:is_plat("macosx") then
return {frameworks = {"GLUT", "OpenGL"}, defines = "GL_SILENCE_DEPRECATION"}
end
else
local freeglut = package:dep("freeglut")
if freeglut then
return freeglut:fetch(opt)
end
end
end)

@ -0,0 +1,12 @@
package("glx")
set_homepage("https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/glXIntro.xml")
set_description("an extension to the X Window System core protocol providing an interface between OpenGL and the X Window System")
on_fetch(function (package, opt)
if opt.system then
if package:is_plat("linux") and package.find_package then
return package:find_package("glx", opt) or package:find_package("libglx", opt)
end
end
end)

@ -0,0 +1,18 @@
package("opengl")
set_homepage("https://opengl.org/")
set_description("OpenGL - The Industry Standard for High Performance Graphics")
on_fetch(function (package, opt)
-- we always get it from compiler toolchain
if package:is_plat("macosx") then
return {frameworks = "OpenGL", defines = "GL_SILENCE_DEPRECATION"}
elseif package:is_plat("windows", "mingw") then
return {links = "opengl32"}
end
if opt.system then
if package:is_plat("linux") and package.find_package then
return package:find_package("opengl", opt) or package:find_package("libgl", opt)
end
end
end)

@ -13,6 +13,7 @@ package("pkg-config")
on_install("@macosx", "@linux", "@bsd", function (package)
local pcpath = {"/usr/local/lib/pkgconfig", "/usr/lib/pkgconfig"}
if package:is_plat("linux") and package:is_arch("x86_64") then
table.insert(pcpath, "/usr/lib64/pkgconfig")
table.insert(pcpath, "/usr/lib/x86_64-linux-gnu/pkgconfig")
end
if is_host("macosx") then

Loading…
Cancel
Save