[Linux] Updates CMakeLists.txt to re-add lua scripting support.

This commit is contained in:
James Chen 2014-03-10 17:10:08 +08:00
Родитель fd44277e7c
Коммит e39dcd9974
3 изменённых файлов: 118 добавлений и 3 удалений

Просмотреть файл

@ -37,6 +37,7 @@ if(WIN32 OR APPLE)
option(USE_CHIPMUNK "Use chipmunk for physics library" ON)
option(USE_BOX2D "Use box2d for physics library" OFF)
option(DEBUG_MODE "Debug or release?" ON)
option(BUILD_LIBS_LUA "Build lua libraries" OFF)
option(BUILD_GUI "Build GUI library" ON)
option(BUILD_NETWORK "Build network library" ON)
option(BUILD_STORAGE "Build storage library" ON)
@ -46,12 +47,13 @@ option(BUILD_EDITOR_COCOSTUDIO "Build editor support for cocostudio" ON)
option(BUILD_EDITOR_COCOSBUILDER "Build editor support for cocosbuilder" ON)
option(BUILD_TestCpp "Only build TestCpp sample" ON)
option(BUILD_TestLua "Only build TestLua sample" OFF)
else()#temp
option(USE_CHIPMUNK "Use chipmunk for physics library" ON)
option(USE_BOX2D "Use box2d for physics library" OFF)
option(DEBUG_MODE "Debug or release?" ON)
option(BUILD_LIBS_LUA "Build lua libraries" ON)
option(BUILD_GUI "Build GUI library" ON)
option(BUILD_NETWORK "Build network library" ON)
option(BUILD_STORAGE "Build storage library" ON)
@ -61,7 +63,7 @@ option(BUILD_EDITOR_COCOSTUDIO "Build editor support for cocostudio" ON)
option(BUILD_EDITOR_COCOSBUILDER "Build editor support for cocosbuilder" ON)
option(BUILD_TestCpp "Only build TestCpp sample" ON)
option(BUILD_TestLua "Only build TestLua sample" ON)
endif()#temp
@ -273,10 +275,24 @@ if(BUILD_EDITOR_COCOSTUDIO)
add_subdirectory(cocos/editor-support/cocostudio)
endif(BUILD_EDITOR_COCOSTUDIO)
## Scripting
if(BUILD_LIBS_LUA)
# lua
add_subdirectory(external/lua/lua)
# tolua
add_subdirectory(external/lua/tolua)
# luabinding
add_subdirectory(cocos/scripting/lua)
endif(BUILD_LIBS_LUA)
# build tests
if(BUILD_TestCpp)
add_subdirectory(samples/cpp-tests)
endif(BUILD_TestCpp)
if(BUILD_TestLua)
add_subdirectory(samples/lua-tests/project)
endif(BUILD_TestLua)

Просмотреть файл

@ -0,0 +1,56 @@
set(LUABINDING_SRC
auto/lua_cocos2dx_auto.cpp
auto/lua_cocos2dx_extension_auto.cpp
auto/lua_cocos2dx_studio_auto.cpp
auto/lua_cocos2dx_gui_auto.cpp
auto/lua_cocos2dx_spine_auto.cpp
auto/lua_cocos2dx_physics_auto.cpp
manual/tolua_fix.cpp
manual/CCLuaBridge.cpp
manual/CCLuaEngine.cpp
manual/CCLuaStack.cpp
manual/CCLuaValue.cpp
manual/Cocos2dxLuaLoader.cpp
manual/CCBProxy.cpp
manual/LuaOpengl.cpp
manual/LuaScriptHandlerMgr.cpp
manual/LuaBasicConversions.cpp
manual/lua_cocos2dx_manual.cpp
manual/lua_cocos2dx_extension_manual.cpp
manual/lua_cocos2dx_coco_studio_manual.cpp
manual/lua_cocos2dx_gui_manual.cpp
manual/lua_cocos2dx_spine_manual.cpp
manual/lua_cocos2dx_physics_manual.cpp
manual/lua_cocos2dx_deprecated.cpp
manual/lua_xml_http_request.cpp
manual/LuaSkeletonAnimation.cpp
)
include_directories(
auto
manual
../../editor-support/cocosbuilder
../../editor-support/cocostudio
../../editor-support/spine
../../gui
../../../../external/lua/lua
../../../../external/lua/tolua
)
add_library(luabinding STATIC
${LUABINDING_SRC}
)
target_link_libraries(luabinding
tolua
lua
spine
)
set_target_properties(luabinding
PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
)

Просмотреть файл

@ -0,0 +1,43 @@
set(APP_NAME testlua)
set(SAMPLE_SRC
proj.linux/main.cpp
Classes/AppDelegate.cpp
)
include_directories(
Classes
../../../cocos/scripting/lua-bindings/manual
../../../cocos/scripting/lua-bindings/auto
../../../external/lua/lua
../../../external/lua/tolua
)
# add the executable
add_executable(${APP_NAME}
${SAMPLE_SRC}
)
target_link_libraries(${APP_NAME}
luabinding
gui
network
cocostudio
cocosbuilder
extensions
audio
cocos2d
)
set(APP_BIN_DIR "${CMAKE_BINARY_DIR}/bin/${APP_NAME}")
set_target_properties(${APP_NAME} PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${APP_BIN_DIR}")
pre_build(${APP_NAME}
COMMAND ${CMAKE_COMMAND} -E remove_directory ${APP_BIN_DIR}/Resources
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/Resources ${APP_BIN_DIR}/Resources
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/cocos/scripting/lua/script ${APP_BIN_DIR}/Resources
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/tests/test-cpp/Resources ${APP_BIN_DIR}/Resources
)