Explorar o código

add imath (#500)

* add imath

* improve glew
Hoildkv %!s(int64=4) %!d(string=hai) anos
pai
achega
007d30dd1f
Modificáronse 3 ficheiros con 41 adicións e 6 borrados
  1. 4 4
      packages/g/glew/port/xmake.lua
  2. 3 2
      packages/g/glew/xmake.lua
  3. 34 0
      packages/i/imath/xmake.lua

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

@@ -12,9 +12,9 @@ target("glew")
     elseif is_plat("macosx") then
         add_frameworks("OpenGL")
     elseif is_plat("linux") then
-        add_syslinks("GLU", "GL")
+        add_syslinks("GL")
     end
-    add_defines("GLEW_NO_GLU")
+    add_defines("GLEW_NO_GLU", {public = true})
     if is_plat("windows") then
         if is_kind("shared") then
             add_defines("GLEW_BUILD")
@@ -36,7 +36,7 @@ target("glewinfo")
     elseif is_plat("macosx") then
         add_frameworks("OpenGL")
     elseif is_plat("linux") then
-        add_syslinks("GLU", "GL")
+        add_syslinks("GL")
         add_packages("libx11", "xorgproto")
     end
     add_files("src/glewinfo.c")
@@ -49,7 +49,7 @@ target("visualinfo")
     elseif is_plat("macosx") then
         add_frameworks("OpenGL")
     elseif is_plat("linux") then
-        add_syslinks("GLU", "GL")
+        add_syslinks("GL")
         add_packages("libx11", "xorgproto")
     end
     add_files("src/visualinfo.c")

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

@@ -8,11 +8,12 @@ package("glew")
     add_versions("2.2.0", "a9046a913774395a095edcc0b0ac2d81c3aacca61787b39839b941e9be14e0d4")
 
     if is_plat("windows") or is_plat("mingw") then
-        add_syslinks("glu32", "opengl32")
+        add_syslinks("opengl32")
     elseif is_plat("linux") then
-        add_syslinks("GLU", "GL")
+        add_syslinks("GL")
         add_deps("libx11", "xorgproto")
     end
+    add_defines("GLEW_NO_GLU")
 
     on_load("windows", "mingw", function (package)
         if not package:config("shared") then

+ 34 - 0
packages/i/imath/xmake.lua

@@ -0,0 +1,34 @@
+package("imath")
+
+    set_homepage("https://github.com/AcademySoftwareFoundation/Imath/")
+    set_description("Imath is a C++ and python library of 2D and 3D vector, matrix, and math operations for computer graphics")
+    set_license("BSD-3-Clause")
+
+    add_urls("https://github.com/AcademySoftwareFoundation/Imath/archive/refs/tags/$(version).tar.gz",
+             "https://github.com/AcademySoftwareFoundation/Imath.git")
+    add_versions("v3.1.0", "211c907ab26d10bd01e446da42f073ee7381e1913d8fa48084444bc4e1b4ef87")
+
+    on_load(function (package)
+        if not package.is_built or package:is_built() then
+            package:add("deps", "cmake")
+        end
+    end)
+
+    on_install("windows", "macosx", "linux", function (package)
+        local configs = {"-DBUILD_TESTING=OFF"}
+        table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
+        table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
+        import("package.tools.cmake").install(package, configs)
+    end)
+
+    on_test(function (package)
+        assert(package:check_cxxsnippets({test = [[
+            void test() {
+                Imath::V3f a(0, 0, 0);
+                Imath::V3f b(1, 1, 1);
+                Imath::V3f c(2, 9, 2);
+                Imath::Box3f box(a);
+                box.extendBy(c);
+            }
+        ]]}, {configs = {languages = "c++11"}, includes = "Imath/ImathBox.h"}))
+    end)