-
Notifications
You must be signed in to change notification settings - Fork 0
/
jsoncpp.sh
executable file
·104 lines (67 loc) · 1.73 KB
/
jsoncpp.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#!/usr/bin/env bash
export ANDROID_NDK_ROOT=$ANDROID_HOME/ndk/$NDK_VERSION
export PATH=$ANDROID_NDK_ROOT:$PATH
ACTIONDIR=$(pwd)
cd jsoncpp || exit
mkdir jni
mkdir -p ./target/static
mkdir -p ./target/shared
mkdir -p ./target/include/jsoncpp
cat << 'EOF' > jni/Application.mk
APP_ABI := armeabi-v7a arm64-v8a x86 x86_64
APP_PLATFORM := android-21
APP_STL := c++_static
EOF
cat << 'EOF' > jni/Android.mk
#BASE_PATH := $(call my-dir)
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
JSONCPP_SRC:= \
src/lib_json/json_reader.cpp \
src/lib_json/json_value.cpp \
src/lib_json/json_writer.cpp
LOCAL_SRC_FILES := $(addprefix ../, $(JSONCPP_SRC))
LOCAL_C_INCLUDES:= \
$(LOCAL_PATH)/../include \
$(LOCAL_PATH)/../src/lib_json
LOCAL_EXPORT_C_INCLUDE_DIRS := \
$(LOCAL_PATH)/../include
LOCAL_CFLAGS := \
-DJSON_USE_EXCEPTION=0
LOCAL_MODULE_TAGS := \
tests
LOCAL_MODULE := \
libjsoncpp
include $(BUILD_STATIC_LIBRARY)
EOF
ndk-build clean
ndk-build
find obj/local/ -type d -name 'objs' -exec rm -rf {} +
mv obj/local/* target/static/
cat << 'EOF' > jni/Android.mk
#BASE_PATH := $(call my-dir)
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
JSONCPP_SRC:= \
src/lib_json/json_reader.cpp \
src/lib_json/json_value.cpp \
src/lib_json/json_writer.cpp
LOCAL_SRC_FILES := $(addprefix ../, $(JSONCPP_SRC))
LOCAL_C_INCLUDES:= \
$(LOCAL_PATH)/../include \
$(LOCAL_PATH)/../src/lib_json
LOCAL_EXPORT_C_INCLUDE_DIRS := \
$(LOCAL_PATH)/../include
LOCAL_CFLAGS := \
-DJSON_USE_EXCEPTION=0
LOCAL_MODULE_TAGS := \
tests
LOCAL_MODULE := \
libjsoncpp
include $(BUILD_SHARED_LIBRARY)
EOF
ndk-build clean
ndk-build
mv libs/* target/shared/
cp -r include/json/* target/include/jsoncpp/
# cd jsoncpp && zip -r "$ACTIONDIR"/jsoncpp-android.zip .