2018-02-08 09:24:33 +08:00
|
|
|
set(cocos_root ${COCOS2DX_ROOT_PATH})
|
2014-11-19 08:28:41 +08:00
|
|
|
|
2014-08-24 18:52:51 +08:00
|
|
|
include_directories(
|
2018-05-02 15:33:01 +08:00
|
|
|
${cocos_root}/external/lua
|
|
|
|
${cocos_root}/external/lua/tolua
|
|
|
|
${cocos_root}/external/xxtea
|
|
|
|
${cocos_root}/external
|
|
|
|
${cocos_root}/cocos
|
|
|
|
${cocos_root}/cocos/editor-support
|
2014-08-24 18:52:51 +08:00
|
|
|
)
|
|
|
|
|
2018-02-08 09:24:33 +08:00
|
|
|
if(ANDROID)
|
|
|
|
include_directories(
|
2018-05-02 15:33:01 +08:00
|
|
|
manual/platform/android
|
|
|
|
manual/platform/android/jni
|
2018-03-14 13:51:29 +08:00
|
|
|
)
|
2018-02-08 09:24:33 +08:00
|
|
|
endif()
|
|
|
|
|
2014-09-10 03:18:31 +08:00
|
|
|
file(GLOB lua_cocos2d_source_files
|
2018-05-02 15:33:01 +08:00
|
|
|
"${cocos_root}/external/lua/tolua/*.c"
|
|
|
|
"${cocos_root}/external/xxtea/xxtea.cpp"
|
|
|
|
)
|
2014-08-24 18:52:51 +08:00
|
|
|
|
2014-11-17 06:42:04 +08:00
|
|
|
list(APPEND lua_cocos2d_source_files
|
2018-05-02 15:33:01 +08:00
|
|
|
${cocos_root}/external/lua/luasocket/luasocket.c
|
|
|
|
${cocos_root}/external/lua/luasocket/timeout.c
|
|
|
|
${cocos_root}/external/lua/luasocket/buffer.c
|
|
|
|
${cocos_root}/external/lua/luasocket/io.c
|
|
|
|
${cocos_root}/external/lua/luasocket/auxiliar.c
|
|
|
|
${cocos_root}/external/lua/luasocket/options.c
|
|
|
|
${cocos_root}/external/lua/luasocket/inet.c
|
|
|
|
${cocos_root}/external/lua/luasocket/except.c
|
|
|
|
${cocos_root}/external/lua/luasocket/select.c
|
|
|
|
${cocos_root}/external/lua/luasocket/tcp.c
|
|
|
|
${cocos_root}/external/lua/luasocket/udp.c
|
|
|
|
${cocos_root}/external/lua/luasocket/mime.c
|
|
|
|
${cocos_root}/external/lua/luasocket/luasocket_scripts.c
|
|
|
|
)
|
2014-11-17 06:42:04 +08:00
|
|
|
|
|
|
|
if(WINDOWS)
|
2014-12-21 22:23:44 +08:00
|
|
|
if(MINGW)
|
|
|
|
add_definitions(-DLUASOCKET_INET_ATON -DLUASOCKET_INET_PTON)
|
|
|
|
endif()
|
cmake support win32 ,and support generate&use prebuilt libs (#18683)
* fix win32 prebuilt error, and set cmake as default android native build
* cpp-template support msvc
* add msvc version check
* add -D_USRLUASTATIC, fix lua lib cmake compile error
* fix cpp-empty-test res copy dir, add function needed
* improve msvc res copy
* refactor cmake copy dll logic
* fix cpp-tests compile error
* refactor copy dll temp
* refactor win32 exe using dlls
* js-project compile support cmake using msvc
* improve res mark for win32
* update the way of lua project res mark
* add D_USRLUASTATIC for lua project
* unify RELEASE Release to Release, add CMAKE_CONFIGURATION_TYPES
* improve VS shows targets, add folder
* improve mac/ios res mark
* reduce useless comments
* unify cpp src include variable
* refactor cpp test project package logic
* improve pkg app logic
* start support prebuilt libs for cpp project using cmake
* improve prebuilt libs generate
* expand js/lua support prebuilt libs on mac
* adapt IDE generate libs path
* start do prebuilt for android
* improve the way of using external libs for prebuilt
* prebuilt libs support cpp-empty-test on android studio
* cpp-tests prebuilt libs, and remove useless
* start to improve libs using, to adapt prebuilt
* improve cpp tests prebuilt on android
* prebuilt support lua & js test on android
* prebuilt support cpp&js template
* rename prebuilt variabl, detail androd config
* finish android support prebuilt using cmake
* fix cmake script run in windows error
* reduce variable name length
* improve the way of win32 use dlls to adapt prebuilt
* loosen pick js/lua engine lib condition
* self review and start check linux build
* unify compile option location
* strict copy dlls condition
* improve libs link order
* start redo the way of copy dlls
* unify dlls copy logic
* fix linux res copy error
* update cmake copy file path in linux
* make prebuilt dir if needed, and divide Debug and Release dir
* cmake win32 divide Debug and Release dir well
* comment Lua Template project, for the unfinished lua simulator support
* add simulator cmake file
* start support simulator
* simulator support cmake build on macOS
* fix simulator compile error on win32
* add simulator prebuilt support
* improve mark cocos app macro
* improve cmake template project format
* improve cmake app files format
* fix format improve mistake
* detail cmake readme
* improve readme, useless comments
* add game.rc to template project
* check travis openssl version
* try update travis openssl
* upgrade travis openssl
* change openssl link
* change to upgrade openssl
* re install python with upgrade openssl
* add comment for macro and func, improve variable name
2018-03-08 09:47:57 +08:00
|
|
|
add_definitions(-D_USRLUASTATIC)
|
2014-11-17 06:42:04 +08:00
|
|
|
list(APPEND lua_cocos2d_source_files
|
2018-05-02 15:33:01 +08:00
|
|
|
${cocos_root}/external/lua/luasocket/wsocket.c
|
|
|
|
)
|
2018-02-08 09:24:33 +08:00
|
|
|
elseif(UNIX OR ANDROID)
|
2014-11-21 23:30:53 +08:00
|
|
|
# because we have -std=c99
|
2014-11-24 20:52:30 +08:00
|
|
|
add_definitions(-D_POSIX_C_SOURCE=200809L)
|
2018-02-08 09:24:33 +08:00
|
|
|
if(LINUX OR ANDROID)
|
2016-09-20 14:48:00 +08:00
|
|
|
add_definitions(-D_BSD_SOURCE -D_DEFAULT_SOURCE)
|
2014-11-24 20:52:30 +08:00
|
|
|
endif()
|
|
|
|
if(APPLE)
|
2014-11-21 23:30:53 +08:00
|
|
|
add_definitions(-D_DARWIN_C_SOURCE)
|
2014-11-21 04:20:02 +08:00
|
|
|
endif()
|
2014-11-21 23:30:53 +08:00
|
|
|
|
2014-11-17 06:42:04 +08:00
|
|
|
list(APPEND lua_cocos2d_source_files
|
2018-05-02 15:33:01 +08:00
|
|
|
${cocos_root}/external/lua/luasocket/serial.c
|
|
|
|
${cocos_root}/external/lua/luasocket/unix.c
|
|
|
|
${cocos_root}/external/lua/luasocket/usocket.c
|
|
|
|
)
|
2014-09-10 03:18:31 +08:00
|
|
|
endif()
|
|
|
|
|
2018-03-14 13:51:29 +08:00
|
|
|
set(lua_bindings_manual_headers
|
|
|
|
manual/CCComponentLua.h
|
|
|
|
manual/3d/lua_cocos2dx_3d_manual.h
|
|
|
|
manual/cocosbuilder/CCBProxy.h
|
|
|
|
manual/cocosbuilder/lua_cocos2dx_cocosbuilder_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
|
|
|
|
manual/network/Lua_web_socket.h
|
|
|
|
manual/network/lua_extensions.h
|
|
|
|
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/lua_cocos2dx_deprecated.h
|
|
|
|
manual/cocos2d/LuaOpengl.h
|
|
|
|
manual/cocos2d/LuaScriptHandlerMgr.h
|
|
|
|
manual/cocosdenshion/lua_cocos2dx_cocosdenshion_manual.h
|
|
|
|
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/ui/lua_cocos2dx_experimental_video_manual.hpp
|
|
|
|
manual/controller/lua_cocos2dx_controller_manual.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_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/LuaOpengl.cpp
|
|
|
|
manual/cocos2d/LuaScriptHandlerMgr.cpp
|
|
|
|
manual/cocos2d/lua_cocos2dx_deprecated.cpp
|
|
|
|
manual/cocos2d/lua_cocos2dx_experimental_manual.cpp
|
|
|
|
manual/cocos2d/lua_cocos2dx_manual.cpp
|
|
|
|
manual/cocos2d/lua_cocos2dx_physics_manual.cpp
|
|
|
|
manual/cocosdenshion/lua_cocos2dx_cocosdenshion_manual.cpp
|
|
|
|
manual/3d/lua_cocos2dx_3d_manual.cpp
|
|
|
|
manual/cocosbuilder/CCBProxy.cpp
|
|
|
|
manual/cocosbuilder/lua_cocos2dx_cocosbuilder_manual.cpp
|
|
|
|
manual/cocosdenshion/lua_cocos2dx_cocosdenshion_manual.cpp
|
|
|
|
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_extensions.c
|
|
|
|
manual/network/lua_cocos2dx_network_manual.cpp
|
|
|
|
manual/network/Lua_web_socket.cpp
|
|
|
|
manual/network/lua_xml_http_request.cpp
|
|
|
|
manual/spine/lua_cocos2dx_spine_manual.cpp
|
|
|
|
manual/spine/LuaSkeletonAnimation.cpp
|
|
|
|
manual/ui/lua_cocos2dx_experimental_video_manual.cpp
|
|
|
|
manual/ui/lua_cocos2dx_ui_manual.cpp
|
2014-10-18 13:44:19 +08:00
|
|
|
manual/audioengine/lua_cocos2dx_audioengine_manual.cpp
|
2015-05-15 09:28:03 +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_cocosdenshion_auto.hpp
|
|
|
|
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_experimental_webview_auto.hpp
|
|
|
|
auto/lua_cocos2dx_studio_auto.hpp
|
|
|
|
auto/lua_cocos2dx_auto.hpp
|
|
|
|
auto/lua_cocos2dx_experimental_video_auto.hpp
|
|
|
|
auto/lua_cocos2dx_navmesh_auto.hpp
|
|
|
|
auto/lua_cocos2dx_csloader_auto.hpp
|
|
|
|
auto/lua_cocos2dx_experimental_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
|
|
|
|
auto/lua_cocos2dx_cocosbuilder_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
|
|
|
|
auto/lua_cocos2dx_3d_auto.cpp
|
|
|
|
auto/lua_cocos2dx_auto.cpp
|
|
|
|
auto/lua_cocos2dx_cocosbuilder_auto.cpp
|
|
|
|
auto/lua_cocos2dx_cocosdenshion_auto.cpp
|
|
|
|
auto/lua_cocos2dx_controller_auto.cpp
|
|
|
|
auto/lua_cocos2dx_experimental_auto.cpp
|
|
|
|
auto/lua_cocos2dx_experimental_video_auto.cpp
|
|
|
|
auto/lua_cocos2dx_extension_auto.cpp
|
|
|
|
auto/lua_cocos2dx_physics_auto.cpp
|
|
|
|
auto/lua_cocos2dx_spine_auto.cpp
|
|
|
|
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
|
2015-05-15 09:28:03 +08:00
|
|
|
auto/lua_cocos2dx_physics3d_auto.cpp
|
2015-06-02 18:37:57 +08:00
|
|
|
auto/lua_cocos2dx_navmesh_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}
|
|
|
|
auto/lua_cocos2dx_experimental_webview_auto.hpp
|
|
|
|
manual/ui/lua_cocos2dx_experimental_webview_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}
|
|
|
|
auto/lua_cocos2dx_experimental_webview_auto.cpp
|
|
|
|
manual/ui/lua_cocos2dx_experimental_webview_manual.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}
|
|
|
|
manual/platform/android/CCLuaJavaBridge.h
|
|
|
|
manual/platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxLuaJavaBridge.h
|
|
|
|
auto/lua_cocos2dx_experimental_webview_auto.hpp
|
|
|
|
manual/ui/lua_cocos2dx_experimental_webview_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}
|
|
|
|
manual/platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxLuaJavaBridge.cpp
|
|
|
|
manual/platform/android/CCLuaJavaBridge.cpp
|
|
|
|
auto/lua_cocos2dx_experimental_webview_auto.cpp
|
|
|
|
manual/ui/lua_cocos2dx_experimental_webview_manual.cpp
|
2018-05-02 15:33:01 +08:00
|
|
|
)
|
2014-09-10 03:18:31 +08:00
|
|
|
endif()
|
|
|
|
|
2017-06-21 13:39:38 +08:00
|
|
|
if(USE_BULLET)
|
2018-05-02 15:33:01 +08:00
|
|
|
include_directories(${BULLET_INCLUDE_DIRS})
|
2017-06-21 13:39:38 +08:00
|
|
|
endif()
|
|
|
|
|
2018-03-14 13:51:29 +08:00
|
|
|
set(lua_bindings_files
|
|
|
|
${lua_cocos2d_source_files}
|
|
|
|
${lua_bindings_manual_files}
|
|
|
|
${lua_bindings_auto_files}
|
2018-05-02 15:33:01 +08:00
|
|
|
)
|
2018-03-14 13:51:29 +08:00
|
|
|
set(lua_bindings_headers
|
|
|
|
${lua_cocos2d_source_headers}
|
|
|
|
${lua_bindings_manual_headers}
|
|
|
|
${lua_bindings_auto_headers}
|
2018-05-02 15:33:01 +08:00
|
|
|
)
|
2018-03-14 13:51:29 +08:00
|
|
|
|
|
|
|
list(APPEND lua_bindings_files ${lua_bindings_headers})
|
2014-09-10 03:18:31 +08:00
|
|
|
|
2014-11-19 08:28:41 +08:00
|
|
|
add_library(luacocos2d ${lua_bindings_files})
|
2014-08-24 18:52:51 +08:00
|
|
|
target_link_libraries(luacocos2d cocos2d)
|
2018-02-08 09:24:33 +08:00
|
|
|
add_dependencies(luacocos2d cocos2d)
|
|
|
|
|
cmake support win32 ,and support generate&use prebuilt libs (#18683)
* fix win32 prebuilt error, and set cmake as default android native build
* cpp-template support msvc
* add msvc version check
* add -D_USRLUASTATIC, fix lua lib cmake compile error
* fix cpp-empty-test res copy dir, add function needed
* improve msvc res copy
* refactor cmake copy dll logic
* fix cpp-tests compile error
* refactor copy dll temp
* refactor win32 exe using dlls
* js-project compile support cmake using msvc
* improve res mark for win32
* update the way of lua project res mark
* add D_USRLUASTATIC for lua project
* unify RELEASE Release to Release, add CMAKE_CONFIGURATION_TYPES
* improve VS shows targets, add folder
* improve mac/ios res mark
* reduce useless comments
* unify cpp src include variable
* refactor cpp test project package logic
* improve pkg app logic
* start support prebuilt libs for cpp project using cmake
* improve prebuilt libs generate
* expand js/lua support prebuilt libs on mac
* adapt IDE generate libs path
* start do prebuilt for android
* improve the way of using external libs for prebuilt
* prebuilt libs support cpp-empty-test on android studio
* cpp-tests prebuilt libs, and remove useless
* start to improve libs using, to adapt prebuilt
* improve cpp tests prebuilt on android
* prebuilt support lua & js test on android
* prebuilt support cpp&js template
* rename prebuilt variabl, detail androd config
* finish android support prebuilt using cmake
* fix cmake script run in windows error
* reduce variable name length
* improve the way of win32 use dlls to adapt prebuilt
* loosen pick js/lua engine lib condition
* self review and start check linux build
* unify compile option location
* strict copy dlls condition
* improve libs link order
* start redo the way of copy dlls
* unify dlls copy logic
* fix linux res copy error
* update cmake copy file path in linux
* make prebuilt dir if needed, and divide Debug and Release dir
* cmake win32 divide Debug and Release dir well
* comment Lua Template project, for the unfinished lua simulator support
* add simulator cmake file
* start support simulator
* simulator support cmake build on macOS
* fix simulator compile error on win32
* add simulator prebuilt support
* improve mark cocos app macro
* improve cmake template project format
* improve cmake app files format
* fix format improve mistake
* detail cmake readme
* improve readme, useless comments
* add game.rc to template project
* check travis openssl version
* try update travis openssl
* upgrade travis openssl
* change openssl link
* change to upgrade openssl
* re install python with upgrade openssl
* add comment for macro and func, improve variable name
2018-03-08 09:47:57 +08:00
|
|
|
# use necessary external libs and system libs
|
|
|
|
target_use_luacocos2d_depend_libs(luacocos2d)
|
2018-02-08 09:24:33 +08:00
|
|
|
|
2014-08-06 00:15:44 +08:00
|
|
|
set_target_properties(luacocos2d
|
2018-05-02 15:33:01 +08:00
|
|
|
PROPERTIES
|
|
|
|
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
|
|
|
|
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
|
|
|
|
FOLDER "Internal"
|
|
|
|
)
|
2018-02-08 09:24:33 +08:00
|
|
|
|
|
|
|
if(XCODE OR VS)
|
|
|
|
cocos_mark_code_files("luacocos2d")
|
|
|
|
endif()
|
|
|
|
|