Skip to content

Commit c684fb5

Browse files
author
minggo
committed
Merge pull request #29 from andyque/add_android_stl
add android stl option
2 parents 3e8cbeb + 762deb8 commit c684fb5

File tree

5 files changed

+23
-3
lines changed

5 files changed

+23
-3
lines changed

build/android.ini

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ cfg_default_gcc_version=4.9
99
cfg_arm_alias_folder_name="armeabi"
1010
cfg_armv7_alias_folder_name="armeabi-v7a"
1111
cfg_arm64_alias_folder_name="armeabi-v8a"
12-
12+
#specific the STL version, currently only clang and gnu is supported
13+
cfg_default_build_stl="gnu" #clang is another option
1314

1415
#build machine & build host
1516
cfg_build_machine="x86_64-apple-darwin14"
@@ -30,7 +31,7 @@ cfg_armv7_toolchain_bin="${ANDROID_NDK}/toolchains/arm-linux-androideabi-${cfg_d
3031
#build arches and build libraries
3132
cfg_all_supported_arches=("arm" "armv7" "x86" "arm64")
3233
cfg_all_supported_libraries=("png" "zlib" "lua" "luajit" "websockets" "curl" "freetype" "jpeg" "tiff" "webp" "chipmunk" "openssl" "gafplayer")
33-
cfg_default_arches_all=("arm" "armv7" "x86" "arm64")
34+
cfg_default_arches_all=("arm" "armv7" "x86")
3435
cfg_default_libraries_all=("png" "zlib" "lua" "luajit" "websockets" "curl" "freetype" "jpeg" "tiff" "webp" "chipmunk" "openssl" "gafplayer")
3536

3637

build/build.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,7 @@ do
315315
fi
316316

317317
export ANDROID_USE_MTHUMB=$use_mthumb
318+
export ANDROID_STL_VERSION=$cfg_default_build_stl
318319

319320
install_library_path="install-${cfg_platform_name}"
320321
build_library_path=$cfg_platform_name

contrib/bootstrap

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,13 @@ check_android_sdk()
279279
add_make_enabled "HAVE_x86"
280280
add_make "EXTRA_CFLAGS := -ffunction-sections -funwind-tables -fstack-protector -no-canonical-prefixes -fomit-frame-pointer -fstrict-aliasing -DANDROID -Wa,--noexecstack -Wformat "
281281
fi
282+
283+
if [ ${ANDROID_STL_VERSION} = "gnu" ];then
284+
add_make_enabled "HAVE_STL_GUN"
285+
else
286+
add_make_enabled "HAVE_STL_CLANG"
287+
fi
288+
282289
}
283290

284291
check_tizen_sdk()

contrib/src/gafplayer/rules.mak

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,11 @@ ifdef HAVE_ANDROID
3030
CMAKE_DEFINE=ANDROID
3131
endif
3232

33+
ifndef HAVE_CROSS_COMPILE
3334
ifdef HAVE_LINUX
3435
CMAKE_DEFINE=LINUX
3536
endif
37+
endif
3638

3739
.gafplayer: gafplayer toolchain.cmake
3840
cd $</Library && $(HOSTVARS) CFLAGS="$(CFLAGS) $(EX_ECFLAGS)" ${CMAKE} -D${CMAKE_DEFINE}=1

contrib/src/main.mak

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,9 +419,18 @@ ifdef HAVE_ANDROID
419419
echo "set(CMAKE_SYSTEM_NAME Linux)" >> $@
420420
echo "set(CMAKE_CXX_SYSROOT_FLAG \"\")" >> $@
421421
echo "set(CMAKE_C_SYSROOT_FLAG \"\")" >> $@
422+
ifdef HAVE_STL_GUN
423+
echo "include_directories($(ANDROID_NDK)/sources/cxx-stl/gnu-libstdc++/4.9/include \
424+
$(ANDROID_NDK)/sources/cxx-stl/gnu-libstdc++/4.9/libs/$(MY_TARGET_ARCH)/include \
425+
$(ANDROID_NDK)/sources/cxx-stl/gnu-libstdc++/4.9/include/backward)" >> $@
426+
endif
427+
ifdef HAVE_STL_CLANG
422428
echo "include_directories($(ANDROID_NDK)/sources/android/support/include \
423-
$(ANDROID_NDK)/sources/cxx-stl/llvm-libc++/libcxx/include)" >> $@
429+
$(ANDROID_NDK)/sources/cxx-stl/llvm-libc++/libcxx/include)" >> $@
424430
endif
431+
432+
endif #end of HAVE_ANDROID
433+
425434
ifdef HAVE_TIZEN
426435
echo "set(CMAKE_SYSTEM_NAME Linux)" >> $@
427436
endif

0 commit comments

Comments
 (0)