add libheif and openimageio (#563)

* add libheif

* add openimageio

* unblock mingw for openexr

* update lcms

* fix lcms
pull/565/head
Hoildkv 3 years ago committed by GitHub
parent 3e7b00fdc5
commit d5113078b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      packages/b/boost/xmake.lua
  2. 15
      packages/l/lcms/xmake.lua
  3. 41
      packages/l/libheif/xmake.lua
  4. 14
      packages/o/openexr/xmake.lua
  5. 87
      packages/o/openimageio/xmake.lua
  6. 5
      packages/p/pugixml/xmake.lua

@ -20,8 +20,7 @@ package("boost")
if is_plat("linux") then
add_deps("bzip2", "zlib")
elseif is_plat("windows") then
add_cxflags("/EHsc")
add_syslinks("dl")
end
local libnames = {"filesystem",

@ -6,6 +6,13 @@ package("lcms")
add_urls("https://github.com/mm2/Little-CMS/archive/$(version).tar.gz")
add_versions("2.11", "478c9c3938d7a91b1171de4616f8b04308a8676d73eadc19505b7ace41327f28")
add_versions("2.12", "e501f1482fc424550ef3abbf86bf1c66090e1661249e89552d39ed5bf935df66")
on_load("windows", function (package)
if package:config("shared") then
package:add("defines", "CMS_DLL")
end
end)
on_install("windows", function (package)
io.writefile("xmake.lua", [[
@ -13,6 +20,9 @@ package("lcms")
target("lcms2")
set_kind("$(kind)")
add_files("src/*.c")
if is_kind("shared") then
add_defines("CMS_DLL_BUILD")
end
add_includedirs("include")
add_headerfiles("include/(*.h)")
]])
@ -20,7 +30,7 @@ package("lcms")
end)
on_install("macosx", "linux", function (package)
local configs = {"--with-pic"}
local configs = {}
if package:config("shared") then
table.insert(configs, "--enable-shared=yes")
table.insert(configs, "--enable-static=no")
@ -28,6 +38,9 @@ package("lcms")
table.insert(configs, "--enable-static=yes")
table.insert(configs, "--enable-shared=no")
end
if package:config("pic") then
table.insert(configs, "--with-pic")
end
import("package.tools.autoconf").install(package, configs)
end)

@ -0,0 +1,41 @@
package("libheif")
set_homepage("https://github.com/strukturag/libheif")
set_description("libheif is an HEIF and AVIF file format decoder and encoder.")
set_license("LGPL-3.0")
add_urls("https://github.com/strukturag/libheif/releases/download/v$(version)/libheif-$(version).tar.gz")
add_versions("1.12.0", "e1ac2abb354fdc8ccdca71363ebad7503ad731c84022cf460837f0839e171718")
add_deps("cmake")
local configdeps = {"libde265", "x265", "dav1d"}
for _, conf in ipairs(configdeps) do
add_configs(conf, {description = "Build " .. conf .. " encoder/decoder.", default = false, type = "boolean"})
end
on_load("windows", function (package)
if not package:config("shared") then
package:add("defines", "LIBHEIF_STATIC_BUILD")
end
for _, conf in ipairs(configdeps) do
if package:config(conf) then
package:add("deps", conf)
end
end
end)
on_install("windows", "macosx", "linux", function (package)
local configs = {"-DWITH_EXAMPLES=OFF",
"-DWITH_AOM=OFF",
"-DWITH_RAV1E=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"))
for _, conf in ipairs(configdeps) do
table.insert(configs, "-DWITH_" .. conf:upper() .. "=" .. (package:config(conf) and "ON" or "OFF"))
end
import("package.tools.cmake").install(package, configs)
end)
on_test(function (package)
assert(package:has_cfuncs("heif_get_version_number", {includes = "libheif/heif.h"}))
end)

@ -18,8 +18,17 @@ package("openexr")
add_configs("build_both", {description = "Build both static library and shared library.", default = false, type = "boolean"})
on_load("windows", "macosx", "linux", "mingw@windows", "mingw@msys", function (package)
if package:version():ge("3.0") then
local ver = package:version()
local suffix = format("-%d_%d", ver:major(), ver:minor())
local links = {}
if ver:ge("3.0") then
package:add("deps", "imath")
links = {"OpenEXRUtil", "OpenEXR", "OpenEXRCore", "IlmThread", "Iex"}
else
links = {"IlmImfUtil", "IlmImf", "IlmThread", "Imath", "Half", "IexMath", "Iex"}
end
for _, link in ipairs(links) do
package:add("links", link .. suffix)
end
if package:is_plat("windows") and package:config("shared") then
package:add("defines", "OPENEXR_DLL")
@ -30,9 +39,6 @@ package("openexr")
local configs = {"-DBUILD_TESTING=OFF", "-DINSTALL_OPENEXR_EXAMPLES=OFF", "-DINSTALL_OPENEXR_DOCS=OFF", "-DOPENEXR_BUILD_UTILS=ON"}
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
if package:version():ge("3.0") then
if package:is_plat("mingw") then
raise("mingw is not supported in version 3.0")
end
table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
else
if package:config("build_both") then

@ -0,0 +1,87 @@
package("openimageio")
set_homepage("https://sites.google.com/site/openimageio/home")
set_description("OpenImageIO is a library for reading and writing images, and a bunch of related classes, utilities, and applications.")
set_license("BSD-3-Clause")
add_urls("https://github.com/OpenImageIO/oiio/archive/refs/tags/v$(version).tar.gz", {version = function (version) return version:gsub("%+", ".") end})
add_versions("2.2.17+0", "b570da8928c3e8cde29bdb0e0320e727789e141c48375fb69a2548d642462396")
add_deps("cmake")
add_deps("boost", {configs = {filesystem = true, system = true, thread = true}})
add_deps("zlib", "libtiff", "openexr", "libjpeg-turbo", "pugixml", "libpng", "robin-map", "libsquish", "fmt")
local configdeps = {bzip2 = "BZip2",
freetype = "Freetype",
hdf5 = "HDF5",
opencv = "OpenCV",
tbb = "TBB",
giflib = "GIF",
libheif = "Libheif",
openjpeg = "OpenJPEG",
openvdb = "OpenVDB",
ptex = "Ptex",
libwebp = "WebP",
libraw = "LibRaw"}
for conf, dep in pairs(configdeps) do
add_configs(conf, {description = "Build with " .. conf .. " support.", default = (conf == "libwebp"), type = "boolean"})
end
add_configs("python", {description = "Build python bindings.", default = false, type = "boolean"})
if is_plat("windows") then
add_syslinks("shell32")
end
on_load("windows", "macosx", "linux", function (package)
if package:is_plat("windows") and not package:config("shared") then
package:add("defines", "OIIO_STATIC_DEFINE")
end
for conf, dep in pairs(configdeps) do
if package:config(conf) then
package:add("deps", conf)
end
end
if package:config("python") then
package:add("deps", "python 3.x")
package:add("deps", "pybind11")
end
end)
on_install("windows", "macosx", "linux", function (package)
io.replace("CMakeLists.txt", "NOT ${PROJECT_NAME}_IS_SUBPROJECT", "TRUE", {plain = true})
local configs = {"-DBUILD_DOCS=OFF",
"-DINSTALL_DOCS=OFF",
"-DUSE_QT=OFF",
"-DUSE_EXTERNAL_PUGIXML=ON",
"-DLINKSTATIC=ON",
"-DCMAKE_DISABLE_FIND_PACKAGE_Nuke=ON",
"-DCMAKE_DISABLE_FIND_PACKAGE_DCMTK=ON",
"-DCMAKE_DISABLE_FIND_PACKAGE_Field3D=ON",
"-DCMAKE_DISABLE_FIND_PACKAGE_R3DSDK=ON"}
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"))
if package:is_plat("windows") then
table.insert(configs, "-DBoost_USE_STATIC_RUNTIME=" .. (package:config("vs_runtime"):startswith("MT") and "ON" or "OFF"))
end
for conf, dep in pairs(configdeps) do
table.insert(configs, "-DCMAKE_DISABLE_FIND_PACKAGE_" .. dep .. "=" .. (package:config(conf) and "OFF" or "ON"))
end
table.insert(configs, "-DUSE_PYTHON=" .. (package:config("python") and "ON" or "OFF"))
if package:config("python") then
os.vrunv("python", {"-m", "pip", "install", "numpy"})
end
import("package.tools.cmake").install(package, configs)
end)
on_test(function (package)
assert(package:check_cxxsnippets({test = [[
void test() {
using namespace OIIO;
unsigned char pixels[640*480*3];
std::unique_ptr<ImageOutput> out = ImageOutput::create("foo.jpg");
ImageSpec spec(640, 480, 3, TypeDesc::UINT8);
out->open("foo.jpg", spec);
out->write_image(TypeDesc::UINT8, pixels);
out->close();
}
]]}, {configs = {languages = "c++11"}, includes = "OpenImageIO/imageio.h"}))
end)

@ -11,8 +11,11 @@ package("pugixml")
on_install("windows", "linux", "macosx", function (package)
local configs = {}
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"))
table.insert(configs, "-DSTATIC_CRT=" .. (package:config("vs_runtime"):startswith("MT") and "ON" or "OFF"))
if package:is_plat("windows") then
table.insert(configs, "-DSTATIC_CRT=" .. (package:config("vs_runtime"):startswith("MT") and "ON" or "OFF"))
end
import("package.tools.cmake").install(package, configs)
end)

Loading…
Cancel
Save