Skip to content

Commit 3ca7a12

Browse files
committed
fix android compile issues
1 parent 41412a3 commit 3ca7a12

File tree

12 files changed

+57
-62
lines changed

12 files changed

+57
-62
lines changed

build/android.ini

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ cfg_armv7_toolchain_bin="${ANDROID_NDK}/toolchains/arm-linux-androideabi-${cfg_d
3030

3131
#build arches and build libraries
3232
cfg_all_supported_arches=("arm" "armv7" "x86" "arm64")
33-
cfg_all_supported_libraries=("png" "zlib" "lua" "luajit" "websockets" "curl" "freetype" "jpeg" "tiff" "webp" "chipmunk" "openssl" "edtaa3func" "xxhash" "xxtea" "convertutf" "flatbuffer" "minizip" "tinyxml" "cjson" "luasocket")
33+
cfg_all_supported_libraries=("png" "zlib" "lua" "luajit" "websockets" "curl" "freetype" "jpeg" "tiff" "webp" "chipmunk" "openssl" "edtaa3func" "xxhash" "xxtea" "convertutf" "flatbuffers" "minizip" "tinyxml2" "cjson" "luasocket" "box2d")
3434
cfg_default_arches_all=("arm" "armv7" "x86")
35-
cfg_default_libraries_all=("png" "zlib" "lua" "luajit" "websockets" "curl" "freetype" "jpeg" "tiff" "webp" "chipmunk" "openssl" "edtaa3func" "xxhash" "xxtea" "convertutf" "flatbuffer" "minizip" "tinyxml" "cjson" "luasocket")
35+
cfg_default_libraries_all=("png" "zlib" "lua" "luajit" "websockets" "curl" "freetype" "jpeg" "tiff" "webp" "chipmunk" "openssl" "edtaa3func" "xxhash" "xxtea" "convertutf" "flatbuffers" "minizip" "tinyxml2" "cjson" "luasocket" "box2d")
3636

3737

3838
#whether build fat library, use lipo -S create
@@ -43,6 +43,6 @@ cfg_build_fat_library=no
4343
cfg_curl_arm_use_mthumb=no
4444

4545
#debug and release mode flag
46-
cfg_build_release_mode="-O3 -DNDEBUG"
47-
cfg_build_debug_mode="-O0 -g -DDEBUG"
46+
cfg_build_release_mode="-O3 -DNDEBUG "
47+
cfg_build_debug_mode="-O0 -g -DDEBUG "
4848

build/build.sh

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,11 @@ do
375375
cd -
376376

377377
local_library_install_path=$cfg_platform_name/$archive_name/prebuilt/$original_arch_name
378+
mkdir -p $cfg_platform_name/include/$archive_name
379+
if [ $cfg_platform_name = "android" ];then
380+
local_library_install_path=$cfg_platform_name/$original_arch_name
381+
fi
382+
378383
if [ ! -d $local_library_install_path ]; then
379384
echo "create folder for library with specify arch. $local_library_install_path"
380385
mkdir -p $local_library_install_path
@@ -400,6 +405,9 @@ do
400405
for dep_archive in ${original_dependent_archive_list[@]}
401406
do
402407
local_library_install_path=$cfg_platform_name/${dep_archive}/prebuilt/$original_arch_name
408+
if [ $cfg_platform_name = "android" ];then
409+
local_library_install_path=$cfg_platform_name/$original_arch_name
410+
fi
403411
mkdir -p $local_library_install_path
404412
cp $top_dir/contrib/$install_library_path/$arch/lib/lib${dep_archive}.a $local_library_install_path/lib${dep_archive}.a
405413

@@ -411,10 +419,11 @@ do
411419
copy_include_file_path=${lib}_header_files
412420
src_directory=$top_dir/contrib/$install_library_path/$arch/include/${!copy_include_file_path}
413421
echo $src_directory
422+
destination_header_path=$cfg_platform_name/include/$archive_name/
414423
if [ -d $src_directory ];then
415-
cp -r $src_directory/* $cfg_platform_name/$archive_name/
424+
cp -r $src_directory/* $destination_header_path
416425
else
417-
cp $src_directory $cfg_platform_name/$archive_name/
426+
cp $src_directory $destination_header_path
418427
fi
419428

420429

build/ios.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ cfg_armv7s_host_machine="arm-apple-darwin"
1414
cfg_arm64_host_machine="arm-apple-darwin"
1515

1616
cfg_all_supported_arches=("armv7" "armv7s" "i386" "arm64" "x86_64")
17-
cfg_all_supported_libraries=("png" "zlib" "lua" "luajit" "websockets" "curl" "freetype" "jpeg" "tiff" "webp" "chipmunk" "openssl" "edtaa3func" "xxhash" "xxtea" "convertutf" "flatbuffer" "minizip" "tinyxml2" "cjson" "luasocket" "box2d")
17+
cfg_all_supported_libraries=("png" "zlib" "lua" "luajit" "websockets" "curl" "freetype" "jpeg" "tiff" "webp" "chipmunk" "openssl" "edtaa3func" "xxhash" "xxtea" "convertutf" "flatbuffers" "minizip" "tinyxml2" "cjson" "luasocket" "box2d")
1818
cfg_default_arches_all=("armv7" "armv7s" "i386" "arm64" "x86_64")
19-
cfg_default_libraries_all=("png" "zlib" "lua" "luajit" "websockets" "curl" "freetype" "jpeg" "tiff" "webp" "chipmunk" "openssl" "edtaa3func" "xxhash" "xxtea" "convertutf" "flatbuffer" "minizip" "tinyxml2" "cjson" "luasocket" "box2d")
19+
cfg_default_libraries_all=("png" "zlib" "lua" "luajit" "websockets" "curl" "freetype" "jpeg" "tiff" "webp" "chipmunk" "openssl" "edtaa3func" "xxhash" "xxtea" "convertutf" "flatbuffers" "minizip" "tinyxml2" "cjson" "luasocket" "box2d")
2020

2121

2222
cfg_build_fat_library=yes

build/mac.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ cfg_is_cross_compile=no
2020

2121
#build arches and build libraries
2222
cfg_all_supported_arches=("i386" "x86_64")
23-
cfg_all_supported_libraries=("png" "zlib" "lua" "luajit" "websockets" "curl" "freetype" "jpeg" "tiff" "webp" "chipmunk" "glfw" "openssl" "edtaa3func" "xxhash" "xxtea" "convertutf" "flatbuffer" "minizip" "tinyxml2" "cjson" "luasocket")
23+
cfg_all_supported_libraries=("png" "zlib" "lua" "luajit" "websockets" "curl" "freetype" "jpeg" "tiff" "webp" "chipmunk" "glfw" "openssl" "edtaa3func" "xxhash" "xxtea" "convertutf" "flatbuffers" "minizip" "tinyxml2" "cjson" "luasocket" "box2d")
2424
cfg_default_arches_all=("x86_64")
25-
cfg_default_libraries_all=("png" "zlib" "lua" "luajit" "websockets" "curl" "freetype" "jpeg" "tiff" "webp" "chipmunk" "glfw" "openssl" "edtaa3func" "xxhash" "xxtea" "convertutf" "flatbuffer" "minizip" "tinyxml2" "cjson" "luasocket")
25+
cfg_default_libraries_all=("png" "zlib" "lua" "luajit" "websockets" "curl" "freetype" "jpeg" "tiff" "webp" "chipmunk" "glfw" "openssl" "edtaa3func" "xxhash" "xxtea" "convertutf" "flatbuffers" "minizip" "tinyxml2" "cjson" "luasocket" "box2d")
2626

2727

2828
#whether build fat library, use lipo -S create

build/main.ini

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ edtaa3func_header_files=edtaa3func.h
1818
xxhash_header_files=xxhash.h
1919
xxtea_header_files=xxtea.h
2020
convertutf_header_files=ConvertUTF.h
21-
flatbuffer_header_files=flatbuffers
21+
flatbuffers_header_files=flatbuffers
2222
minizip_header_files=minizip
2323
tinyxml2_header_files=tinyxml2.h
2424
cjson_header_files=cjson
@@ -31,6 +31,8 @@ glfw_header_files=GLFW
3131
##archive prebuilt name
3232
luajit_original_name=luajit-5.1
3333
box2d_original_name=Box2D
34+
flatbuffers_original_name=flatbuffer
35+
glfw_original_name=glfw3
3436

3537
##archive_alias
3638
zlib_archive_alias=z

contrib/src/cjson/cmake-patch.patch

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,41 @@
11
diff --git a/CMakeLists.txt b/CMakeLists.txt
2-
index c17239b..bd95e5a 100644
2+
index c17239b..a51818e 100644
33
--- a/CMakeLists.txt
44
+++ b/CMakeLists.txt
5-
@@ -68,9 +68,15 @@ else()
6-
set(_lua_module_dir "${_lua_lib_dir}/lua/5.1")
5+
@@ -15,7 +15,6 @@ if(NOT CMAKE_BUILD_TYPE)
6+
FORCE)
77
endif()
88

9+
-find_package(Lua51 REQUIRED)
10+
include_directories(${LUA_INCLUDE_DIR})
11+
12+
if(NOT USE_INTERNAL_FPCONV)
13+
@@ -51,26 +50,22 @@ if(NOT HAVE_ISINF)
14+
endif()
15+
16+
set(_MODULE_LINK "${CMAKE_THREAD_LIBS_INIT}")
17+
-get_filename_component(_lua_lib_dir ${LUA_LIBRARY} PATH)
18+
19+
if(APPLE)
20+
set(CMAKE_SHARED_MODULE_CREATE_C_FLAGS
21+
"${CMAKE_SHARED_MODULE_CREATE_C_FLAGS} -undefined dynamic_lookup")
22+
endif()
23+
24+
-if(WIN32)
25+
- # Win32 modules need to be linked to the Lua library.
26+
- set(_MODULE_LINK ${LUA_LIBRARY} ${_MODULE_LINK})
27+
- set(_lua_module_dir "${_lua_lib_dir}")
28+
- # Windows sprintf()/strtod() handle NaN/inf differently. Not supported.
29+
- add_definitions(-DDISABLE_INVALID_NUMBERS)
30+
-else()
31+
- set(_lua_module_dir "${_lua_lib_dir}/lua/5.1")
32+
-endif()
33+
-
934
-add_library(cjson MODULE lua_cjson.c strbuf.c ${FPCONV_SOURCES})
1035
-set_target_properties(cjson PROPERTIES PREFIX "")
1136
-target_link_libraries(cjson ${_MODULE_LINK})
1237
-install(TARGETS cjson DESTINATION "${_lua_module_dir}")
13-
-
38+
1439
+add_library(libcjson STATIC lua_cjson.c strbuf.c ${FPCONV_SOURCES})
1540
+set_target_properties(libcjson PROPERTIES PREFIX "")
1641
+target_link_libraries(libcjson ${_MODULE_LINK})

contrib/src/cjson/rules.mak

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ cjson: libcjson-git.tar.xz .sum-cjson
1616
$(APPLY) $(SRC)/cjson/cmake-patch.patch
1717
$(MOVE)
1818

19-
DEPS_cjson = lua $(DEPS_lua)
19+
# DEPS_cjson = lua $(DEPS_lua)
2020

2121
.cjson: cjson toolchain.cmake
22-
cd $< && $(HOSTVARS) ${CMAKE} -DUSE_INTERNAL_FPCONV=1
22+
cd $< && $(HOSTVARS) ${CMAKE} -DUSE_INTERNAL_FPCONV=1 -DLUA_INCLUDE_DIR=$(PREFIX)
2323
cd $< && $(MAKE) VERBOSE=1 install
2424
touch $@

contrib/src/flatbuffer/add-library.patch

Lines changed: 0 additions & 22 deletions
This file was deleted.

contrib/src/flatbuffer/rules.mak

Lines changed: 0 additions & 21 deletions
This file was deleted.

contrib/src/luasocket/rules.mak

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ luasocket: libluasocket-git.tar.xz .sum-luasocket
1515
$(UNPACK)
1616
$(MOVE)
1717

18-
DEPS_luasocket = lua $(DEPS_lua)
18+
# DEPS_luasocket = lua $(DEPS_lua)
1919

2020
.luasocket: luasocket toolchain.cmake
21-
cd $< && $(HOSTVARS) ${CMAKE}
21+
cd $< && $(HOSTVARS) ${CMAKE} -DLUA_INCLUDE_DIR=$(PREFIX)
2222
cd $< && $(MAKE) VERBOSE=1 install
2323
touch $@

0 commit comments

Comments
 (0)