jxrlib: add package (#5947)
parent
f644dd8984
commit
00be0f5a12
4 changed files with 192 additions and 0 deletions
@ -0,0 +1,52 @@ |
|||||||
|
diff --git a/common/include/wmspecstrings_adt.h b/common/include/wmspecstrings_adt.h
|
||||||
|
index ca7f25f..d5eb028 100644
|
||||||
|
--- a/common/include/wmspecstrings_adt.h
|
||||||
|
+++ b/common/include/wmspecstrings_adt.h
|
||||||
|
@@ -36,6 +36,10 @@
|
||||||
|
__type_has_adt_prop(compname,valid_schars) \
|
||||||
|
__type_has_adt_prop(compname,correct_len) \
|
||||||
|
__nullterminated
|
||||||
|
+#ifdef __MINGW32__
|
||||||
|
+#undef __$compname_props
|
||||||
|
+#define __$compname_props
|
||||||
|
+#endif
|
||||||
|
#if defined(UNICODE) || defined(_UNICODE)
|
||||||
|
#define __$TCHAR unsigned short
|
||||||
|
#else
|
||||||
|
diff --git a/image/sys/strcodec.h b/image/sys/strcodec.h
|
||||||
|
index 695a454..9fad5b6 100644
|
||||||
|
--- a/image/sys/strcodec.h
|
||||||
|
+++ b/image/sys/strcodec.h
|
||||||
|
@@ -59,7 +59,7 @@
|
||||||
|
//#ifdef WIN32
|
||||||
|
#if defined(WIN32) && !defined(UNDER_CE) // WIN32 seems to be defined always in VS2005 for ARM platform
|
||||||
|
#define PLATFORM_X86
|
||||||
|
-#include "..\x86\x86.h"
|
||||||
|
+#include "../x86/x86.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef UNREFERENCED_PARAMETER
|
||||||
|
diff --git a/jxrgluelib/JXRMeta.h b/jxrgluelib/JXRMeta.h
|
||||||
|
index b7b5880..7c9d653 100644
|
||||||
|
--- a/jxrgluelib/JXRMeta.h
|
||||||
|
+++ b/jxrgluelib/JXRMeta.h
|
||||||
|
@@ -111,6 +111,18 @@
|
||||||
|
#define __out_win __out
|
||||||
|
#endif
|
||||||
|
|
||||||
|
+#ifndef __in
|
||||||
|
+#define __in
|
||||||
|
+#endif
|
||||||
|
+#ifndef __out
|
||||||
|
+#define __out
|
||||||
|
+#endif
|
||||||
|
+#ifndef __in_ecount
|
||||||
|
+#define __in_ecount(x)
|
||||||
|
+#endif
|
||||||
|
+#ifndef __out_ecount
|
||||||
|
+#define __out_ecount(x)
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
//================================================================
|
||||||
|
|
||||||
|
|
@ -0,0 +1,27 @@ |
|||||||
|
--- a/image/decode/segdec.c
|
||||||
|
+++ b/image/decode/segdec.c
|
||||||
|
@@ -52,6 +52,13 @@ static Int DecodeSignificantAbsLevel (struct CAdaptiveHuffman *pAHexpt, BitIOInf
|
||||||
|
//================================================================
|
||||||
|
// Memory access functions
|
||||||
|
//================================================================
|
||||||
|
+#ifndef _BIG__ENDIAN_
|
||||||
|
+#if (defined(WIN32) && !defined(UNDER_CE)) || (defined(UNDER_CE) && defined(_ARM_))
|
||||||
|
+// WinCE ARM and Desktop x86
|
||||||
|
+#else
|
||||||
|
+U32 _byteswap_ulong(U32 bits);
|
||||||
|
+#endif
|
||||||
|
+#endif
|
||||||
|
static U32 _FORCEINLINE _load4(void* pv)
|
||||||
|
{
|
||||||
|
#ifdef _BIG__ENDIAN_
|
||||||
|
--- a/jxrgluelib/JXRGlueJxr.c
|
||||||
|
+++ b/jxrgluelib/JXRGlueJxr.c
|
||||||
|
@@ -27,6 +27,7 @@
|
||||||
|
//
|
||||||
|
//*@@@---@@@@******************************************************************
|
||||||
|
#include <limits.h>
|
||||||
|
+#include <wchar.h>
|
||||||
|
#include <JXRGlue.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,77 @@ |
|||||||
|
option("tools", {default = false}) |
||||||
|
|
||||||
|
add_rules("mode.release", "mode.debug", "jxrlib") |
||||||
|
|
||||||
|
add_includedirs( |
||||||
|
"common/include", |
||||||
|
"image/sys", |
||||||
|
"jxrgluelib", |
||||||
|
"jxrtestlib" |
||||||
|
) |
||||||
|
|
||||||
|
add_headerfiles("common/include/*.h", "image/sys/windowsmediaphoto.h", {prefixdir = "jxrlib"}) |
||||||
|
|
||||||
|
target("jpegxr") |
||||||
|
set_kind("$(kind)") |
||||||
|
add_files("image/**.c") |
||||||
|
|
||||||
|
if is_plat("windows") and is_kind("shared") then |
||||||
|
add_rules("utils.symbols.export_all") |
||||||
|
end |
||||||
|
|
||||||
|
target("jxrglue") |
||||||
|
set_kind("$(kind)") |
||||||
|
add_files("jxrgluelib/*.c", "jxrtestlib/*.c") |
||||||
|
|
||||||
|
if is_plat("windows") and is_kind("shared") then |
||||||
|
add_rules("utils.symbols.export_all") |
||||||
|
end |
||||||
|
|
||||||
|
add_deps("jpegxr") |
||||||
|
|
||||||
|
add_headerfiles( |
||||||
|
"jxrgluelib/JXRGlue.h", |
||||||
|
"jxrgluelib/JXRMeta.h", |
||||||
|
"jxrtestlib/JXRTest.h", {prefixdir = "jxrlib"} |
||||||
|
) |
||||||
|
|
||||||
|
target("JxrEncApp") |
||||||
|
add_rules("tools") |
||||||
|
add_files("jxrencoderdecoder/JxrEncApp.c") |
||||||
|
|
||||||
|
target("JxrDecApp") |
||||||
|
add_rules("tools") |
||||||
|
add_files("jxrencoderdecoder/JxrDecApp.c") |
||||||
|
|
||||||
|
rule("jxrlib") |
||||||
|
on_config(function (target) |
||||||
|
target:add("defines", "DISABLE_PERF_MEASUREMENT") |
||||||
|
if target:is_plat("windows", "mingw", "msys") then |
||||||
|
target:add("defines", "WIN32") |
||||||
|
else |
||||||
|
target:add("defines", "__ANSI__") |
||||||
|
end |
||||||
|
if target:check_bigendian() then |
||||||
|
target:add("defines", "_BIG__ENDIAN_") |
||||||
|
end |
||||||
|
|
||||||
|
if not target:has_tool("cxx", "cl") then |
||||||
|
target:add("cxflags", |
||||||
|
"-Wno-error=implicit-function-declaration", |
||||||
|
"-Wno-endif-labels", |
||||||
|
-- https://gcc.gnu.org/gcc-14/porting_to.html#incompatible-pointer-types |
||||||
|
"-Wno-incompatible-pointer-types" |
||||||
|
) |
||||||
|
end |
||||||
|
end) |
||||||
|
|
||||||
|
rule("tools") |
||||||
|
on_load(function (target) |
||||||
|
if not get_config("tools") then |
||||||
|
target:set("enabled", false) |
||||||
|
return |
||||||
|
end |
||||||
|
|
||||||
|
target:add("kind", "binary") |
||||||
|
target:add("deps", "jxrglue") |
||||||
|
end) |
@ -0,0 +1,36 @@ |
|||||||
|
package("jxrlib") |
||||||
|
set_homepage("https://github.com/4creators/jxrlib") |
||||||
|
set_description("jxrlib is JPEG XR Image Codec reference implementation library released by Microsoft under BSD-2-Clause License. This repo is a clone of jxrlib as released by Microsoft from it's original Codeplex location https://jxrlib.codeplex.com. The only changes comprise addition of LICENSE and README.md in repo root.") |
||||||
|
set_license("BSD-2-Clause") |
||||||
|
|
||||||
|
add_urls("https://github.com/4creators/jxrlib/archive/refs/tags/$(version).tar.gz", |
||||||
|
"https://github.com/4creators/jxrlib.git") |
||||||
|
|
||||||
|
add_versions("v2019.10.9", "555c006e27c5cb66f99c05dcbb2feb197199ca9018dbd06d3467d37cd29a79cd") |
||||||
|
|
||||||
|
-- https://github.com/conan-io/conan-center-index/tree/master/recipes/jxrlib/all/patches |
||||||
|
add_patches("2019.10.9", "patches/missing-declarations.patch", "5f92269d5aef7abdae7fdd2df42259cdce1f41b394f204768a234d462f3a9ae6") |
||||||
|
-- https://github.com/microsoft/vcpkg/blob/b9f5f9c4fd0088a7e56ae357a4ba39bc3f8be2de/ports/jxrlib/fix-mingw.patch |
||||||
|
add_patches("2019.10.9", "patches/mingw.patch", "00b06017562d618832943e02d914f39ff5480a8917dd8147b2c26fd15f68ddaa") |
||||||
|
|
||||||
|
add_configs("tools", {description = "Build tools", default = false, type = "boolean"}) |
||||||
|
|
||||||
|
add_includedirs("include", "include/jxrlib") |
||||||
|
|
||||||
|
on_load(function (package) |
||||||
|
package:add("links", "jxrglue", "jpegxr") |
||||||
|
if package:is_plat("windows", "mingw", "msys") then |
||||||
|
package:add("defines", "WIN32") |
||||||
|
else |
||||||
|
package:add("defines", "__ANSI__") |
||||||
|
end |
||||||
|
end) |
||||||
|
|
||||||
|
on_install(function (package) |
||||||
|
os.cp(path.join(package:scriptdir(), "port", "xmake.lua"), "xmake.lua") |
||||||
|
import("package.tools.xmake").install(package, {tools = package:config("tools")}) |
||||||
|
end) |
||||||
|
|
||||||
|
on_test(function (package) |
||||||
|
assert(package:has_cfuncs("PKCreateCodecFactory", {includes = "JXRTest.h"})) |
||||||
|
end) |
Loading…
Reference in new issue