Преглед изворни кода

add field3d (#584)

* add field3d

* update moltenvk

* improve boost
Hoildkv пре 4 година
родитељ
комит
59ae4ab724

+ 1 - 1
packages/b/boost/xmake.lua

@@ -20,7 +20,7 @@ package("boost")
 
     if is_plat("linux") then
         add_deps("bzip2", "zlib")
-        add_syslinks("dl")
+        add_syslinks("pthread", "dl")
     end
 
     local libnames = {"filesystem",

+ 47 - 0
packages/f/field3d/patches/1.7.3/msvc.patch

@@ -0,0 +1,47 @@
+diff --git a/include/UtilFoundation.h b/include/UtilFoundation.h
+index 2eb6290..a449b5b 100644
+--- a/include/UtilFoundation.h
++++ b/include/UtilFoundation.h
+@@ -70,3 +70,3 @@
+ 
+-#include <half.h>
++#include <OpenEXR/half.h>
+ 
+@@ -90,6 +90,9 @@
+ #ifndef WIN32_LEAN_AND_MEAN
+ #define WIN32_LEAN_AND_MEAN
+ #endif
++#ifndef NOMINMAX
++#define NOMINMAX
++#endif
+ 
+ // needed for mutex stuff
+ #include <Windows.h>
+diff --git a/src/FieldMapping.cpp b/src/FieldMapping.cpp
+index b1f1a1f..90612b1 100644
+--- a/src/FieldMapping.cpp
++++ b/src/FieldMapping.cpp
+@@ -49,9 +49,6 @@
+ #include "FieldMapping.h"
+ #include "Types.h"
+ 
+-#ifdef WIN32
+-#define isnan(__x__) _isnan(__x__) 
+-#endif
+ 
+ //----------------------------------------------------------------------------//
+ 
+diff --git a/src/Log.cpp b/src/Log.cpp
+index f78229c..d095a50 100644
+--- a/src/Log.cpp
++++ b/src/Log.cpp
+@@ -40,7 +40,8 @@
+ */
+ 
+ //----------------------------------------------------------------------------//
+-
++#ifndef _WIN32
+ #include <unistd.h>
++#endif
+ #include <ios>
+ #include <fstream>

+ 65 - 0
packages/f/field3d/xmake.lua

@@ -0,0 +1,65 @@
+package("field3d")
+
+    set_homepage("https://sites.google.com/site/field3d/")
+    set_description("Field3D is an open source library for storing voxel data.")
+    set_license("BSD-3-Clause")
+
+    add_urls("https://github.com/imageworks/Field3D/archive/refs/tags/$(version).tar.gz")
+    add_versions("v1.7.3", "b6168bc27abe0f5e9b8d01af7794b3268ae301ac72b753712df93125d51a0fd4")
+
+    add_patches("v1.7.3", path.join(os.scriptdir(), "patches", "1.7.3", "msvc.patch"), "330d067c39f084218925667a420e24c38e13fcb1663623218b17ed616bb1ca0e")
+
+    add_deps("boost", {configs = {regex = true, thread = true}})
+    add_deps("hdf5", "openexr 2.x")
+
+    if is_plat("windows") then
+        add_syslinks("shlwapi")
+    end
+
+    on_load("windows", function (package)
+        if not package:config("shared") then
+            package:add("defines", "FIELD3D_STATIC")
+        end
+    end)
+
+    on_install("windows", "macosx", "linux", function (package)
+        if is_plat("windows") then
+            local vs = import("core.tool.toolchain").load("msvc"):config("vs")
+            if tonumber(vs) < 2019 then
+                raise("Your compiler is too old to use this library.")
+            end
+        end
+        io.writefile("xmake.lua", [[
+            add_rules("mode.debug", "mode.release")
+            set_languages("c++14")
+            add_requires("boost", {configs = {regex = true, thread = true}})
+            add_requires("hdf5", "openexr 2.x")
+            target("Field3D")
+                set_kind("$(kind)")
+                add_files("src/*.cpp")
+                add_packages("boost", "hdf5", "openexr")
+                add_includedirs("export", "include")
+                add_headerfiles("export/*.h", "include/*.h", {prefixdir = "Field3D"})
+                add_defines("H5_USE_110_API")
+                if is_plat("windows") then
+                    add_defines("WIN32")
+                    add_syslinks("shlwapi")
+                    if is_kind("static") then
+                        add_defines("FIELD3D_STATIC")
+                    else
+                        add_defines("FIELD3D_EXPORT")
+                    end
+                end
+        ]])
+        import("package.tools.xmake").install(package)
+    end)
+
+    on_test(function (package)
+        assert(package:check_cxxsnippets({test = [[
+            void test() {
+                Field3D::V3i res(100, 100, 100);
+                Field3D::DenseFieldf::Ptr field(new Field3D::DenseFieldf);
+                field->setSize(res);
+            }
+        ]]}, {configs = {languages = "c++14"}, includes = "Field3D/DenseField.h"}))
+    end)

+ 1 - 0
packages/m/moltenvk/xmake.lua

@@ -6,6 +6,7 @@ package("moltenvk")
 
     add_urls("https://github.com/KhronosGroup/MoltenVK/archive/v$(version).tar.gz")
     add_versions("1.1.0", "0538fa1c23ddae495c7f82ccd0db90790a90b7017a258ca7575fbae8021f3058")
+    add_versions("1.1.4", "f9bba6d3bf3648e7685c247cb6d126d62508af614bc549cedd5859a7da64967e")
 
     on_install("macosx", function (package)
         local configs = {"--macos"}