Explorar el Código

OpenJPH: add package (#8276)

* initial openjph

* add claim configs

* add claim configs

* lowcase

* fix detail

* add ndk ver detect

* Update xmake.lua

* limit osx/ios

* Update xmake.lua

* Update xmake.lua

* Update xmake.lua

* Update xmake.lua

* Change default value of 'tools' config to false

---------

Co-authored-by: Saikari <[email protected]>
Co-authored-by: star9029 <[email protected]>
Casinius hace 2 meses
padre
commit
a116da7e95
Se han modificado 1 ficheros con 46 adiciones y 0 borrados
  1. 46 0
      packages/o/openjph/xmake.lua

+ 46 - 0
packages/o/openjph/xmake.lua

@@ -0,0 +1,46 @@
+package("openjph")
+    set_homepage("https://github.com/aous72/OpenJPH")
+    set_description("Open-source implementation of JPEG2000 Part-15 (or JPH or HTJ2K)")
+    set_license("BSD-2-Clause")
+    
+    add_urls("https://github.com/aous72/OpenJPH/archive/refs/tags/$(version).tar.gz",
+             "https://github.com/aous72/OpenJPH.git")
+
+    add_versions("0.24.1", "5e44a809c9ee3dad175da839feaf66746cfc114a625ec61c786de8ad3f5ab472")
+
+    add_configs("tools", {description = "Build tools", default = false, type = "boolean"})
+
+    add_deps("cmake")
+
+    if on_check then
+        on_check("android", function (package)
+            local ndk = package:toolchain("ndk")
+            local ndk_sdkver = ndk:config("ndk_sdkver")
+            assert(ndk_sdkver and tonumber(ndk_sdkver) >= 28, "package(openjph): need ndk api level >= 28")
+        end)
+    end
+
+    on_install("!macosx and !iphoneos", function (package)
+        if package:is_plat("windows", "mingw") and package:config("shared") then
+            io.replace("src/core/common/ojph_arch.h", [[#else
+#define OJPH_EXPORT
+#endif]], [[#else
+#define OJPH_EXPORT __declspec(dllimport)
+#endif]], {plain = true})
+        end
+
+        local configs = {}
+        table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
+        table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
+        table.insert(configs, "-DOJPH_BUILD_EXECUTABLES=" .. (package:config("tools") and "ON" or "OFF"))
+        import("package.tools.cmake").install(package, configs)
+    end)
+
+    on_test(function (package)
+        assert(package:check_cxxsnippets({test = [[
+            void test() {
+                ojph::j2c_outfile file;
+                file.open("file.txt");
+            }
+        ]]}, {languages = "c++11", includes = {"openjph/ojph_file.h"}}))
+    end)