Changeset View
Changeset View
Standalone View
Standalone View
android/3rdparty/libraw.patch
1 | --- CMakeLists.txt.orig 2017-05-20 20:42:17.997533874 +0300 | 1 | diff --git a/CMakeLists.txt b/CMakeLists.txt | ||
---|---|---|---|---|---|
2 | +++ CMakeLists.txt 2017-05-20 20:43:31.245445501 +0300 | 2 | index 47f3869..2007a3d 100644 | ||
3 | @@ -26,6 +26,8 @@ | 3 | --- a/CMakeLists.txt | ||
4 | 4 | +++ b/CMakeLists.txt | |||
5 | PROJECT(libraw) | 5 | @@ -114,9 +114,13 @@ INCLUDE(MacroLogFeature) | ||
6 | | ||||
7 | +include(${CMAKE_TOOLCHAIN_FILE}) | | |||
8 | + | | |||
9 | # ================================================================================================== | | |||
10 | # Library version info extraction | | |||
11 | | ||||
12 | @@ -114,10 +116,15 @@ | | |||
13 | INCLUDE(MacroOptionalFindPackage) | 6 | INCLUDE(MacroOptionalFindPackage) | ||
14 | INCLUDE(MacroJPEG) | 7 | INCLUDE(MacroJPEG) | ||
15 | 8 | | |||
16 | +IF (ANDROID) | | |||
17 | + INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/android-hack) | 9 | +INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/android-hack) | ||
18 | +ENDIF () | | |||
19 | + | 10 | + | ||
20 | # Math library check | 11 | # Math library check | ||
21 | 12 | | |||
22 | IF(NOT WIN32) | 13 | -IF(NOT WIN32) | ||
23 | - FIND_LIBRARY(MATH_LIBRARY m) | 14 | +IF(${CMAKE_TOOLCHAIN_FILE} MATCHES ".*toolchain-android.cmake") | ||
24 | +# FIND_LIBRARY(MATH_LIBRARY m) | 15 | + set(MATH_LIBRARY -lm) # toolchain-android.cmake can't find libm.so | ||
25 | + set(MATH_LIBRARY -lm) | 16 | +ELSEIF(NOT WIN32) | ||
17 | FIND_LIBRARY(MATH_LIBRARY m) | ||||
26 | ENDIF() | 18 | ENDIF() | ||
27 | 19 | | |||
28 | # LCMS version 1 and 2 library check | 20 | diff --git a/android-hack/swab.h b/android-hack/swab.h | ||
29 | new file mode 100644 | 21 | new file mode 100644 | ||
30 | index 0000000..061c61e | 22 | index 0000000..061c61e | ||
31 | --- /dev/null | 23 | --- /dev/null | ||
32 | +++ android-hack/swab.h | 24 | +++ b/android-hack/swab.h | ||
33 | @@ -0,0 +1,6 @@ | 25 | @@ -0,0 +1,6 @@ | ||
34 | + | 26 | + | ||
35 | +#pragma once | 27 | +#pragma once | ||
36 | + | 28 | + | ||
37 | +#include <stdint.h> | 29 | +#include <stdint.h> | ||
38 | + | 30 | + | ||
39 | +void swab(const void *from, void*to, ssize_t n); | 31 | +void swab(const void *from, void*to, ssize_t n); | ||
40 | --- internal/dcraw_common.cpp | 32 | diff --git a/internal/dcraw_common.cpp b/internal/dcraw_common.cpp | ||
41 | +++ internal/dcraw_common.cpp | 33 | index 608641a..0f991e4 100644 | ||
42 | @@ -21,6 +21,24 @@ | 34 | --- a/internal/dcraw_common.cpp | ||
43 | for more information | 35 | +++ b/internal/dcraw_common.cpp | ||
36 | @@ -19,6 +19,24 @@ it under the terms of the one of two licenses as you choose: | ||||
44 | */ | 37 | */ | ||
45 | 38 | | |||
39 | | ||||
46 | +#ifdef ANDROID | 40 | +#ifdef ANDROID | ||
47 | +#include <swab.h> | 41 | +#include <swab.h> | ||
48 | + | 42 | + | ||
49 | +#include <stdint.h> | 43 | +#include <stdint.h> | ||
50 | +#include <asm/byteorder.h> | 44 | +#include <asm/byteorder.h> | ||
51 | + | 45 | + | ||
52 | +void swab(const void *from, void*to, ssize_t n) | 46 | +void swab(const void *from, void*to, ssize_t n) | ||
53 | +{ | 47 | +{ | ||
54 | + ssize_t i; | 48 | + ssize_t i; | ||
55 | + | 49 | + | ||
56 | + if (n < 0) | 50 | + if (n < 0) | ||
57 | + return; | 51 | + return; | ||
58 | + | 52 | + | ||
59 | + for (i = 0; i < (n/2)*2; i += 2) | 53 | + for (i = 0; i < (n/2)*2; i += 2) | ||
60 | + *((uint16_t*)to+i) = __arch__swab16(*((uint16_t*)from+i)); | 54 | + *((uint16_t*)to+i) = __arch__swab16(*((uint16_t*)from+i)); | ||
61 | +} | 55 | +} | ||
62 | +#endif | 56 | +#endif | ||
63 | + | 57 | + | ||
64 | #include <math.h> | 58 | #include <math.h> | ||
65 | #define CLASS LibRaw:: | 59 | #define CLASS LibRaw:: | ||
66 | #include "libraw/libraw_types.h" | 60 | #include "libraw/libraw_types.h" | ||
67 | --- src/libraw_cxx.cpp 2016-05-14 09:53:59.000000000 +0300 | 61 | diff --git a/src/libraw_cxx.cpp b/src/libraw_cxx.cpp | ||
68 | +++ src/libraw_cxx.cpp 2017-04-18 15:01:21.806381052 +0300 | 62 | index c977302..2112ba8 100644 | ||
69 | @@ -19,6 +19,10 @@ | 63 | --- a/src/libraw_cxx.cpp | ||
64 | +++ b/src/libraw_cxx.cpp | ||||
65 | @@ -16,6 +16,10 @@ it under the terms of the one of two licenses as you choose: | ||||
70 | 66 | | |||
71 | */ | 67 | */ | ||
72 | 68 | | |||
73 | +#if ANDROID | 69 | +#if ANDROID | ||
74 | +#include <swab.h> | 70 | +#include <swab.h> | ||
75 | +#endif | 71 | +#endif | ||
76 | + | 72 | + | ||
77 | #include <math.h> | 73 | #include <math.h> | ||
78 | #include <errno.h> | 74 | #include <errno.h> | ||
79 | #include <float.h> | 75 | #include <float.h> |