2018-02-08 09:24:33 +08:00
|
|
|
set(cocos_root ${COCOS2DX_ROOT_PATH})
|
2014-11-19 08:28:41 +08:00
|
|
|
|
2018-03-14 13:51:29 +08:00
|
|
|
set(lua_bindings_manual_headers
|
|
|
|
manual/CCComponentLua.h
|
|
|
|
manual/3d/lua_cocos2dx_3d_manual.h
|
|
|
|
manual/CCLuaStack.h
|
|
|
|
manual/CCLuaEngine.h
|
|
|
|
manual/lua_module_register.h
|
|
|
|
manual/CCLuaBridge.h
|
|
|
|
manual/extension/lua_cocos2dx_extension_manual.h
|
|
|
|
manual/LuaBasicConversions.h
|
|
|
|
manual/spine/LuaSkeletonAnimation.h
|
|
|
|
manual/platform/ios/CCLuaObjcBridge.h
|
|
|
|
manual/network/lua_cocos2dx_network_manual.h
|
|
|
|
manual/network/lua_xml_http_request.h
|
2018-10-08 10:42:24 +08:00
|
|
|
manual/network/lua_downloader.h
|
2018-03-14 13:51:29 +08:00
|
|
|
manual/audioengine/lua_cocos2dx_audioengine_manual.h
|
|
|
|
manual/Lua-BindingsExport.h
|
|
|
|
manual/tolua_fix.h
|
|
|
|
manual/navmesh/lua_cocos2dx_navmesh_manual.h
|
|
|
|
manual/navmesh/lua_cocos2dx_navmesh_conversions.h
|
|
|
|
manual/cocos2d/LuaScriptHandlerMgr.h
|
2019-05-05 15:26:34 +08:00
|
|
|
manual/cocos2d/lua_cocos2dx_manual.hpp
|
2018-03-14 13:51:29 +08:00
|
|
|
manual/Cocos2dxLuaLoader.h
|
|
|
|
manual/CCLuaValue.h
|
|
|
|
manual/physics3d/lua_cocos2dx_physics3d_manual.h
|
|
|
|
manual/cocostudio/lua-cocos-studio-conversions.h
|
|
|
|
manual/cocostudio/CustomGUIReader.h
|
|
|
|
manual/ui/lua_cocos2dx_ui_manual.hpp
|
|
|
|
manual/controller/lua_cocos2dx_controller_manual.hpp
|
2018-05-02 15:33:01 +08:00
|
|
|
)
|
2019-05-05 15:26:34 +08:00
|
|
|
|
2014-09-10 03:18:31 +08:00
|
|
|
set(lua_bindings_manual_files
|
|
|
|
manual/CCLuaBridge.cpp
|
|
|
|
manual/CCLuaEngine.cpp
|
|
|
|
manual/CCLuaStack.cpp
|
|
|
|
manual/CCLuaValue.cpp
|
|
|
|
manual/Cocos2dxLuaLoader.cpp
|
|
|
|
manual/LuaBasicConversions.cpp
|
2016-02-18 10:53:33 +08:00
|
|
|
manual/lua_module_register.cpp
|
2014-09-10 03:18:31 +08:00
|
|
|
manual/tolua_fix.cpp
|
2015-09-22 01:34:56 +08:00
|
|
|
manual/CCComponentLua.cpp
|
2014-09-10 03:18:31 +08:00
|
|
|
manual/cocos2d/LuaScriptHandlerMgr.cpp
|
|
|
|
manual/cocos2d/lua_cocos2dx_manual.cpp
|
|
|
|
manual/cocos2d/lua_cocos2dx_physics_manual.cpp
|
2019-05-05 15:26:34 +08:00
|
|
|
manual/3d/lua_cocos2dx_3d_manual.cpp
|
2014-09-10 03:18:31 +08:00
|
|
|
manual/cocostudio/CustomGUIReader.cpp
|
|
|
|
manual/cocostudio/lua_cocos2dx_coco_studio_manual.cpp
|
2015-01-21 11:48:34 +08:00
|
|
|
manual/cocostudio/lua-cocos-studio-conversions.cpp
|
2014-11-26 21:54:18 +08:00
|
|
|
manual/cocostudio/lua_cocos2dx_csloader_manual.cpp
|
2014-09-10 03:18:31 +08:00
|
|
|
manual/controller/lua_cocos2dx_controller_manual.cpp
|
|
|
|
manual/extension/lua_cocos2dx_extension_manual.cpp
|
|
|
|
manual/network/lua_cocos2dx_network_manual.cpp
|
|
|
|
manual/network/lua_xml_http_request.cpp
|
2018-10-08 10:42:24 +08:00
|
|
|
manual/network/lua_downloader.cpp
|
2020-08-05 17:04:57 +08:00
|
|
|
manual/spine/lua_cocos2dx_spine_manual.cpp
|
2014-09-10 03:18:31 +08:00
|
|
|
manual/spine/LuaSkeletonAnimation.cpp
|
|
|
|
manual/ui/lua_cocos2dx_ui_manual.cpp
|
2014-10-18 13:44:19 +08:00
|
|
|
manual/audioengine/lua_cocos2dx_audioengine_manual.cpp
|
2019-03-20 14:34:35 +08:00
|
|
|
manual/physics3d/lua_cocos2dx_physics3d_manual.cpp
|
2015-06-02 18:37:57 +08:00
|
|
|
manual/navmesh/lua_cocos2dx_navmesh_conversions.cpp
|
|
|
|
manual/navmesh/lua_cocos2dx_navmesh_manual.cpp
|
2014-09-10 03:18:31 +08:00
|
|
|
)
|
|
|
|
|
2018-03-14 13:51:29 +08:00
|
|
|
set(lua_bindings_auto_headers
|
|
|
|
auto/lua_cocos2dx_audioengine_auto.hpp
|
|
|
|
auto/lua_cocos2dx_3d_auto.hpp
|
|
|
|
auto/lua_cocos2dx_controller_auto.hpp
|
|
|
|
auto/lua_cocos2dx_spine_auto.hpp
|
|
|
|
auto/lua_cocos2dx_studio_auto.hpp
|
|
|
|
auto/lua_cocos2dx_auto.hpp
|
|
|
|
auto/lua_cocos2dx_navmesh_auto.hpp
|
|
|
|
auto/lua_cocos2dx_csloader_auto.hpp
|
|
|
|
auto/lua_cocos2dx_physics3d_auto.hpp
|
|
|
|
auto/lua_cocos2dx_ui_auto.hpp
|
|
|
|
auto/lua_cocos2dx_physics_auto.hpp
|
|
|
|
auto/lua_cocos2dx_extension_auto.hpp
|
2019-05-05 15:26:34 +08:00
|
|
|
auto/lua_cocos2dx_backend_auto.hpp
|
2018-05-02 15:33:01 +08:00
|
|
|
)
|
2018-03-14 13:51:29 +08:00
|
|
|
|
2014-09-10 03:18:31 +08:00
|
|
|
set(lua_bindings_auto_files
|
2019-05-05 15:26:34 +08:00
|
|
|
auto/lua_cocos2dx_3d_auto.cpp
|
2014-09-10 03:18:31 +08:00
|
|
|
auto/lua_cocos2dx_auto.cpp
|
|
|
|
auto/lua_cocos2dx_controller_auto.cpp
|
2019-05-05 15:26:34 +08:00
|
|
|
auto/lua_cocos2dx_extension_auto.cpp
|
2014-09-10 03:18:31 +08:00
|
|
|
auto/lua_cocos2dx_physics_auto.cpp
|
2020-08-05 17:04:57 +08:00
|
|
|
auto/lua_cocos2dx_spine_auto.cpp
|
2014-09-10 03:18:31 +08:00
|
|
|
auto/lua_cocos2dx_studio_auto.cpp
|
2014-11-27 19:42:32 +08:00
|
|
|
auto/lua_cocos2dx_csloader_auto.cpp
|
2014-09-10 03:18:31 +08:00
|
|
|
auto/lua_cocos2dx_ui_auto.cpp
|
2014-10-18 13:44:19 +08:00
|
|
|
auto/lua_cocos2dx_audioengine_auto.cpp
|
2019-03-20 14:34:35 +08:00
|
|
|
auto/lua_cocos2dx_physics3d_auto.cpp
|
2015-06-02 18:37:57 +08:00
|
|
|
auto/lua_cocos2dx_navmesh_auto.cpp
|
2019-05-05 15:26:34 +08:00
|
|
|
auto/lua_cocos2dx_backend_auto.cpp
|
2014-09-10 03:18:31 +08:00
|
|
|
)
|
|
|
|
|
2018-02-08 09:24:33 +08:00
|
|
|
if(APPLE)
|
|
|
|
# CCLuaObjcBridge.mm needed by ios and mac
|
2018-03-14 13:51:29 +08:00
|
|
|
set(lua_bindings_manual_headers
|
|
|
|
${lua_bindings_manual_headers}
|
|
|
|
manual/platform/ios/CCLuaObjcBridge.h
|
2018-05-02 15:33:01 +08:00
|
|
|
)
|
2016-03-21 21:04:06 +08:00
|
|
|
set(lua_bindings_manual_files
|
2014-09-10 03:18:31 +08:00
|
|
|
${lua_bindings_manual_files}
|
|
|
|
manual/platform/ios/CCLuaObjcBridge.mm
|
2018-05-02 15:33:01 +08:00
|
|
|
)
|
2018-02-08 09:24:33 +08:00
|
|
|
if(IOS)
|
2018-03-14 13:51:29 +08:00
|
|
|
set(lua_bindings_manual_headers
|
|
|
|
${lua_bindings_manual_headers}
|
2019-10-23 14:58:31 +08:00
|
|
|
manual/ui/lua_cocos2dx_webview_manual.hpp
|
|
|
|
auto/lua_cocos2dx_webview_auto.hpp
|
|
|
|
auto/lua_cocos2dx_video_auto.hpp
|
|
|
|
manual/ui/lua_cocos2dx_video_manual.hpp
|
2018-05-02 15:33:01 +08:00
|
|
|
)
|
2018-02-08 09:24:33 +08:00
|
|
|
set(lua_bindings_manual_files
|
2018-03-14 13:51:29 +08:00
|
|
|
${lua_bindings_manual_files}
|
2019-10-23 14:58:31 +08:00
|
|
|
manual/ui/lua_cocos2dx_webview_manual.cpp
|
|
|
|
auto/lua_cocos2dx_webview_auto.cpp
|
|
|
|
manual/ui/lua_cocos2dx_video_manual.cpp
|
|
|
|
auto/lua_cocos2dx_video_auto.cpp
|
2018-05-02 15:33:01 +08:00
|
|
|
)
|
2018-02-08 09:24:33 +08:00
|
|
|
endif()
|
|
|
|
elseif(ANDROID)
|
2018-03-14 13:51:29 +08:00
|
|
|
set(lua_bindings_manual_headers
|
|
|
|
${lua_bindings_manual_headers}
|
2019-10-23 14:58:31 +08:00
|
|
|
manual/ui/lua_cocos2dx_webview_manual.hpp
|
|
|
|
auto/lua_cocos2dx_webview_auto.hpp
|
|
|
|
auto/lua_cocos2dx_video_auto.hpp
|
|
|
|
manual/ui/lua_cocos2dx_video_manual.hpp
|
2018-05-02 15:33:01 +08:00
|
|
|
)
|
2018-02-08 09:24:33 +08:00
|
|
|
set(lua_bindings_manual_files
|
|
|
|
${lua_bindings_manual_files}
|
2019-10-23 14:58:31 +08:00
|
|
|
manual/ui/lua_cocos2dx_webview_manual.cpp
|
|
|
|
auto/lua_cocos2dx_webview_auto.cpp
|
|
|
|
manual/ui/lua_cocos2dx_video_manual.cpp
|
|
|
|
auto/lua_cocos2dx_video_auto.cpp
|
2018-05-02 15:33:01 +08:00
|
|
|
)
|
2014-09-10 03:18:31 +08:00
|
|
|
endif()
|
|
|
|
|
2018-03-14 13:51:29 +08:00
|
|
|
set(lua_bindings_files
|
|
|
|
${lua_bindings_manual_files}
|
|
|
|
${lua_bindings_auto_files}
|
2019-02-28 11:17:05 +08:00
|
|
|
${COCOS_DEPRECATED_SRC}
|
2018-05-02 15:33:01 +08:00
|
|
|
)
|
2018-03-14 13:51:29 +08:00
|
|
|
set(lua_bindings_headers
|
|
|
|
${lua_bindings_manual_headers}
|
|
|
|
${lua_bindings_auto_headers}
|
2019-02-28 11:17:05 +08:00
|
|
|
${COCOS_DEPRECATED_HEADER}
|
2018-05-02 15:33:01 +08:00
|
|
|
)
|
2018-03-14 13:51:29 +08:00
|
|
|
|
2020-10-25 16:14:44 +08:00
|
|
|
# lua-cjson
|
|
|
|
set(lua_bindings_files
|
|
|
|
${lua_bindings_files}
|
|
|
|
lua-cjson/fpconv.c
|
|
|
|
lua-cjson/strbuf.c
|
|
|
|
lua-cjson/lua_cjson.c
|
|
|
|
)
|
|
|
|
|
2020-10-19 23:21:40 +08:00
|
|
|
option(BUILD_YASIO_LUA "Build yasio with cclua support" ON)
|
|
|
|
|
|
|
|
if(BUILD_YASIO_LUA)
|
|
|
|
message(STATUS "BUILD_YASIO_LUA=${BUILD_YASIO_LUA}")
|
|
|
|
set(lua_bindings_files
|
|
|
|
${lua_bindings_files}
|
|
|
|
"${cocos_root}/external/yasio/bindings/lyasio.cpp"
|
|
|
|
"${cocos_root}/external/yasio/bindings/yasio_cclua.cpp")
|
|
|
|
endif()
|
|
|
|
|
2018-03-14 13:51:29 +08:00
|
|
|
list(APPEND lua_bindings_files ${lua_bindings_headers})
|
2014-09-10 03:18:31 +08:00
|
|
|
|
2020-10-24 21:57:36 +08:00
|
|
|
set(ENGINEX_LUA_LIB luacocos2d CACHE INTERNAL "The EGNX lua bindings lib name" )
|
2020-10-17 16:32:16 +08:00
|
|
|
|
2020-10-24 21:57:36 +08:00
|
|
|
add_library(${ENGINEX_LUA_LIB} STATIC ${lua_bindings_files})
|
|
|
|
target_link_libraries(${ENGINEX_LUA_LIB} ${ENGINEX_CORE_LIB})
|
|
|
|
add_dependencies(${ENGINEX_LUA_LIB} ${ENGINEX_CORE_LIB})
|
2018-02-08 09:24:33 +08:00
|
|
|
|
2020-10-17 23:46:59 +08:00
|
|
|
if(BUILD_YASIO_LUA)
|
2020-10-24 21:57:36 +08:00
|
|
|
target_compile_definitions(${ENGINEX_LUA_LIB} PRIVATE CC_ENABLE_YASIO_LUA=1)
|
2020-10-17 23:46:59 +08:00
|
|
|
endif()
|
|
|
|
|
2018-09-25 11:16:04 +08:00
|
|
|
get_target_property(lua_ext_depend external CC_LUA_DEPEND)
|
2020-10-24 21:57:36 +08:00
|
|
|
target_link_libraries(${ENGINEX_LUA_LIB} ${lua_ext_depend})
|
2018-09-25 11:16:04 +08:00
|
|
|
|
2020-10-24 21:57:36 +08:00
|
|
|
target_include_directories(${ENGINEX_LUA_LIB}
|
2018-09-25 11:16:04 +08:00
|
|
|
PRIVATE manual/platform/android
|
|
|
|
PRIVATE manual/platform/android/jni
|
2020-10-17 23:46:59 +08:00
|
|
|
PRIVATE ${cocos_root}/extensions/spine/runtime/include
|
2020-10-21 17:57:50 +08:00
|
|
|
PRIVATE ${cocos_root}/extensions/cocostudio
|
2020-10-17 16:32:16 +08:00
|
|
|
INTERFACE ${cocos_root}/extensions/scripting/lua-bindings/manual
|
2020-10-21 17:57:50 +08:00
|
|
|
PRIVATE ${cocos_root}/extensions/spine/runtime/include
|
2018-09-25 11:16:04 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
if(WINDOWS)
|
2020-10-24 21:57:36 +08:00
|
|
|
target_compile_definitions(${ENGINEX_LUA_LIB} PUBLIC _USRLUASTATIC)
|
2018-09-25 11:16:04 +08:00
|
|
|
endif()
|
|
|
|
|
2020-10-24 21:57:36 +08:00
|
|
|
target_compile_definitions(${ENGINEX_LUA_LIB} PUBLIC LUA_COMPAT_MODULE)
|
2018-02-08 09:24:33 +08:00
|
|
|
|
2020-10-24 21:57:36 +08:00
|
|
|
set_target_properties(${ENGINEX_LUA_LIB}
|
2018-05-02 15:33:01 +08:00
|
|
|
PROPERTIES
|
|
|
|
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
|
|
|
|
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
|
2020-10-17 16:32:16 +08:00
|
|
|
FOLDER "Extensions"
|
2018-05-02 15:33:01 +08:00
|
|
|
)
|
2018-02-08 09:24:33 +08:00
|
|
|
|
|
|
|
if(XCODE OR VS)
|
2020-10-24 21:57:36 +08:00
|
|
|
cocos_mark_code_files("${ENGINEX_LUA_LIB}")
|
2018-02-08 09:24:33 +08:00
|
|
|
endif()
|
|
|
|
|