Skip to content
This repository was archived by the owner on May 6, 2025. It is now read-only.

Commit f65bfd8

Browse files
committed
pretty much the same code diff as
#240 migration from GCC to CLANG on Android
1 parent 2226d53 commit f65bfd8

File tree

9 files changed

+26
-18
lines changed

9 files changed

+26
-18
lines changed

Platform/Android/epub3/Application.mk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
APP_ABI := armeabi-v7a x86
22
APP_PLATFORM := android-24
3-
NDK_TOOLCHAIN_VERSION := 4.9
4-
APP_STL := gnustl_static
3+
NDK_TOOLCHAIN_VERSION := clang
4+
APP_STL := c++_static

Platform/Android/epub3/Experimental.mk

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,14 +115,14 @@ include $(BUILD_STATIC_LIBRARY)
115115

116116
include $(CLEAR_VARS)
117117
LOCAL_MODULE := epub3
118-
LOCAL_CPPFLAGS := -std=gnu++11 -fpermissive -DBUILDING_EPUB3
119-
LOCAL_CFLAGS := -DBUILDING_EPUB3
118+
LOCAL_CPPFLAGS := -std=c++11 -fpermissive -DBUILDING_EPUB3 -D_LIBCPP_INLINE_VISIBILITY_EXCEPT_GCC49=_LIBCPP_INLINE_VISIBILITY
119+
LOCAL_CFLAGS := -DBUILDING_EPUB3 -D_LIBCPP_INLINE_VISIBILITY_EXCEPT_GCC49=_LIBCPP_INLINE_VISIBILITY
120120

121121
ifeq ($(TARGET_ARCH_ABI),x86)
122122
LOCAL_CFLAGS += -mtune=atom -mssse3 -mfpmath=sse
123123
endif
124124

125-
LOCAL_CXXFLAGS := -std=gnu++11 -fpermissive -DBUILDING_EPUB3
125+
LOCAL_CXXFLAGS := -std=c++11 -fpermissive -DBUILDING_EPUB3 -D_LIBCPP_INLINE_VISIBILITY_EXCEPT_GCC49=_LIBCPP_INLINE_VISIBILITY
126126
LOCAL_CPP_FEATURES += exceptions rtti
127127
LOCAL_STATIC_LIBRARIES := xml2
128128
LOCAL_LDLIBS := -lz -landroid -llog
@@ -227,6 +227,8 @@ LOCAL_SRC_FILES := \
227227
$(EPUB3_PATH)/utilities/ring_buffer.cpp \
228228
$(EPUB3_PATH)/utilities/run_loop_android.cpp \
229229
$(EPUB3_PATH)/utilities/utfstring.cpp \
230+
$(wildcard $(LOCAL_PATH)/src/main/jni/*.cpp) \
231+
$(wildcard $(LOCAL_PATH)/src/main/jni/jni/*.cpp)
230232

231233
include $(BUILD_STATIC_LIBRARY)
232234

Platform/Android/epub3/Stable.mk

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -116,14 +116,14 @@ include $(BUILD_STATIC_LIBRARY)
116116
include $(CLEAR_VARS)
117117
LOCAL_DISABLE_FATAL_LINKER_WARNINGS := true
118118
LOCAL_MODULE := epub3
119-
LOCAL_CPPFLAGS := -std=gnu++11 -fpermissive -DBUILDING_EPUB3
120-
LOCAL_CFLAGS := -DBUILDING_EPUB3
119+
LOCAL_CPPFLAGS := -std=c++11 -fpermissive -DBUILDING_EPUB3 -D_LIBCPP_INLINE_VISIBILITY_EXCEPT_GCC49=_LIBCPP_INLINE_VISIBILITY
120+
LOCAL_CFLAGS := -DBUILDING_EPUB3 -D_LIBCPP_INLINE_VISIBILITY_EXCEPT_GCC49=_LIBCPP_INLINE_VISIBILITY
121121

122122
ifeq ($(TARGET_ARCH_ABI),x86)
123123
LOCAL_CFLAGS += -mtune=atom -mssse3 -mfpmath=sse
124124
endif
125125

126-
LOCAL_CXXFLAGS := -std=gnu++11 -fpermissive -DBUILDING_EPUB3
126+
LOCAL_CXXFLAGS := -std=c++11 -fpermissive -DBUILDING_EPUB3 -D_LIBCPP_INLINE_VISIBILITY_EXCEPT_GCC49=_LIBCPP_INLINE_VISIBILITY
127127
LOCAL_CPP_FEATURES += exceptions rtti
128128
LOCAL_STATIC_LIBRARIES := xml2 crypto
129129
LOCAL_LDLIBS := -lz -landroid -llog
@@ -230,8 +230,8 @@ LOCAL_SRC_FILES := \
230230
$(EPUB3_PATH)/utilities/utfstring.cpp \
231231
$(wildcard $(EPUB3_PATH)/ePub/*.cpp) \
232232
$(wildcard $(LOCAL_PATH)/src/main/jni/*.cpp) \
233-
$(wildcard $(LOCAL_PATH)/src/main/jni/jni/*.cpp) \
234-
$(wildcard $(LOCAL_PATH)/src/main/jni/android/*.cpp)
233+
$(wildcard $(LOCAL_PATH)/src/main/jni/jni/*.cpp)
234+
#$(wildcard $(LOCAL_PATH)/src/main/jni/android/*.cpp)
235235

236236
include $(BUILD_SHARED_LIBRARY)
237237

Platform/Android/epub3/build_experimental.gradle

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,16 @@ model {
2424
android.ndk {
2525
moduleName = "epub3"
2626

27-
stl = "gnustl_shared"
27+
toolchain "clang"
28+
stl = "c++_shared"
2829

2930
cppFlags.addAll([
30-
"-std=gnu++11",
31+
"-std=c++11",
3132
"-fpermissive",
3233
"-fexceptions",
3334
"-frtti",
3435
"-DBUILDING_EPUB3",
36+
"-D_LIBCPP_INLINE_VISIBILITY_EXCEPT_GCC49=_LIBCPP_INLINE_VISIBILITY",
3537
"-I../prefix.h",
3638
"-I${file("./include")}".toString(),
3739
"-I${file("./include/ePub3")}".toString(),

Platform/Android/epub3/src/main/jni/epub3.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ std::shared_ptr<void> getNativePtr(JNIEnv *env, jobject thiz) {
139139
* Optionally it may free the native string if the freeNative argument
140140
* is true.
141141
*/
142-
jstring toJstring(JNIEnv *env, const char* str, bool freeNative = false) {
142+
jstring toJstring(JNIEnv *env, const char* str, bool freeNative) {
143143
if (str == NULL) {
144144
return NULL;
145145
}

Platform/Android/epub3/src/main/jni/jni/jni_ptr.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ namespace jni {
4444
* POINTER_GPS(name) to have a complete dump of the leaks at
4545
* the end of your program execution.
4646
*/
47-
Pointer::Pointer(sptr ptr, std::string name = "") : _id((jlong) ptr.get()), _ptr(ptr), _name(name) {
47+
Pointer::Pointer(sptr ptr, std::string name) : _id((jlong) ptr.get()), _ptr(ptr), _name(name) {
4848
// Prevent from adding nullptr to pointer pool
4949
if(ptr != nullptr) {
5050
PointerPool::add((Pointer)*this);

ePub3/ThirdParty/sha1/sha1.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ class SHA1
2626
void addBytes( const char* data, int num );
2727
unsigned char* getDigest();
2828
// utility methods
29-
static Uint32 SHA1::lrot( Uint32 x, int bits );
30-
static void SHA1::storeBigEndianUint32( unsigned char* byte, Uint32 num );
31-
static void SHA1::hexPrinter( unsigned char* c, int l );
29+
static Uint32 lrot( Uint32 x, int bits );
30+
static void storeBigEndianUint32( unsigned char* byte, Uint32 num );
31+
static void hexPrinter( unsigned char* c, int l );
3232
};
3333

3434
#define SHA1_HEADER

ePub3/_config.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ typedef signed long ssize_t;
109109

110110
#if EPUB_OS(ANDROID)
111111
//# define UTF_USE_ICU 1
112-
# define CXX11_STRING_UNAVAILABLE 1
112+
//# define CXX11_STRING_UNAVAILABLE 1
113113
# if EPUB_COMPILER(CLANG)
114114
# define nan(x) __builtin_nan(x)
115115
# endif

ePub3/_platform.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@
165165
#define EPUB_CPU_ARM 1
166166

167167
#if EPUB_COMPILER(CLANG) && defined(ANDROID)
168+
/*
168169
# define __atomic_fetch_add(mem, val, typ) __sync_fetch_and_add(mem, val)
169170
# define __atomic_fetch_sub(mem, val, typ) __sync_fetch_and_sub(mem, val)
170171
# define __atomic_fetch_and(mem, val, typ) __sync_fetch_and_and(mem, val)
@@ -177,16 +178,19 @@
177178
# define __atomic_or_fetch(mem, val, typ) __sync_or_and_fetch(mem, val)
178179
# define __atomic_xor_fetch(mem, val, typ) __sync_xor_and_fetch(mem, val)
179180
# define __atomic_nand_fetch(mem, val, typ) __sync_nand_and_fetch(mem, val)
181+
*/
180182
/*# define __atomic_load atomic_load
181183
# define __atomic_store atomic_store
182184
# define __atomic_exchange atomic_exchange*/
185+
/*
183186
# define __atomic_load __sw_atomic_load
184187
# define __atomic_load_n(a,m) (*(a))
185188
# define __atomic_store __sw_atomic_store
186189
# define __atomic_store_n(a,m) (*(a))
187190
# define __atomic_exchange __sw_atomic_exchange
188191
# define __atomic_exchange_n __sw_atomic_exchange
189192
# include <backup_atomics.h>
193+
*/
190194
#endif
191195

192196
#if defined(__ARM_PCS_VFP)

0 commit comments

Comments
 (0)