对链接的补充
https://blog.csdn.net/u013654125/article/details/73381633
下面是CMakeLists.txt文件内容
cmake_minimum_required(VERSION 3.6)
set(lib_name pbc)
set(target_name ext_${lib_name})
project(${lib_name})
include(../cmake/CocosExternalConfig.cmake)
set(${target_name}_src
alloc.c
array.c
bootstrap.c
context.c
decode.c
map.c
pattern.c
proto.c
register.c
rmessage.c
stringpool.c
varint.c
wmessage.c
)
add_library(${target_name} STATIC
${${target_name}_src}
)
target_include_directories(${target_name} PUBLIC ..)
if(WINDOWS)
set_target_properties(${sub_target_name} PROPERTIES
IMPORTED_LOCATION "${platform_spec_path}/lib${target_name}-1_1.dll"
IMPORTED_IMPLIB "${platform_spec_path}/lib${target_name}.lib"
)
else()
set_target_properties(${sub_target_name} PROPERTIES
IMPORTED_LOCATION "${target_name}.a"
)
endif()
frameworks\cocos2d-x\cocos\scripting\lua-bindings
CMakeLists.txt
添加以下代码
set(lua_bindings_manual_headers
...
manual/pbc/pbc-lua.h
manual/pbc/lua_cocos2dx_pbc_manual.h
)
set(lua_bindings_manual_files
manual/CCLuaBridge.cpp
...
manual/pbc/pbc-lua.c
manual/pbc/lua_cocos2dx_pbc_manual.cpp
)
frameworks\cocos2d-x\external\CMakeLists.txt
添加
add_subdirectory(md5)下面添加代码
add_subdirectory(pbc)
ext_md5下面添加
ext_pbc
然后使用CMake 编译方式的打包apk就可以了