|
@@ -10,7 +10,13 @@ package("freeimage")
|
|
|
|
|
|
add_patches("3.18.0", path.join(os.scriptdir(), "patches", "3.18.0", "libjxr.patch"), "fddbb9fa736da383f54352dc0ab848d083d9279b66cc6ac53910236144ad75ab")
|
|
|
add_patches("3.18.0", path.join(os.scriptdir(), "patches", "3.18.0", "openexr.patch"), "051940ec58fd5ae85b65c67b83fd46eda807c9039f0f5207769ac871350af830")
|
|
|
+ add_patches("3.18.0", path.join(os.scriptdir(), "patches", "3.18.0", "pluginbmp.patch"), "2029f95478c8ce77f83671fe8e1889c11caa04eef2584abf0cd0a9f6a7047db0")
|
|
|
|
|
|
+ add_configs("rgb", {description = "Use RGB instead of BGR.", default = false})
|
|
|
+
|
|
|
+ if is_plat("macosx") then
|
|
|
+ add_deps("libpng")
|
|
|
+ end
|
|
|
on_load("windows", function (package)
|
|
|
if not package:config("shared") then
|
|
|
package:add("defines", "FREEIMAGE_LIB")
|
|
@@ -28,18 +34,25 @@ package("freeimage")
|
|
|
local content = io.readfile("Makefile.srcs")
|
|
|
sources = content:match("SRCS = (.-)\n"):split(" ")
|
|
|
includes = content:match("INCLUDE = (.-)\n"):gsub("%-I", ""):split(" ")
|
|
|
+ local rgb_type = package:config("rgb") and "FREEIMAGE_COLORORDER=1" or "FREEIMAGE_COLORORDER=0"
|
|
|
io.writefile("xmake.lua", format([[
|
|
|
add_rules("mode.debug", "mode.release")
|
|
|
includes("check_cincludes.lua")
|
|
|
+ if is_plat("macosx") then
|
|
|
+ add_requires("libpng")
|
|
|
+ end
|
|
|
target("freeimage")
|
|
|
set_kind("$(kind)")
|
|
|
set_languages("c++11")
|
|
|
+ if is_plat("macosx") then
|
|
|
+ add_packages("libpng")
|
|
|
+ end
|
|
|
add_files({"%s"})
|
|
|
add_headerfiles("Source/FreeImage.h", "Source/FreeImageIO.h")
|
|
|
set_symbols("hidden")
|
|
|
add_includedirs({"%s"})
|
|
|
check_cincludes("Z_HAVE_UNISTD_H", "unistd.h")
|
|
|
- add_defines("OPJ_STATIC", "NO_LCMS", "LIBRAW_NODLL", "DISABLE_PERF_MEASUREMENT")
|
|
|
+ add_defines("OPJ_STATIC", "NO_LCMS", "LIBRAW_NODLL", "DISABLE_PERF_MEASUREMENT", "]] .. rgb_type .. [[")
|
|
|
if is_plat("windows") then
|
|
|
add_files("FreeImage.rc")
|
|
|
add_defines("WIN32", "_CRT_SECURE_NO_DEPRECATE")
|
|
@@ -53,4 +66,4 @@ package("freeimage")
|
|
|
|
|
|
on_test(function (package)
|
|
|
assert(package:has_cfuncs("FreeImage_Initialise", {includes = "FreeImage.h"}))
|
|
|
- end)
|
|
|
+ end)
|