set(APP_NAME lua_empty_test) set(SAMPLE_SRC Classes/AppDelegate.cpp) if(LINUX) set(SAMPLE_SRC ${SAMPLE_SRC} proj.linux/main.cpp) set(RES_PREFIX "/Resources") elseif(WINDOWS) list(APPEND SAMPLE_SRC proj.win32/main.cpp) set(RES_PREFIX "") elseif(MACOSX OR APPLE) set(SAMPLE_SRC ${SAMPLE_SRC} proj.mac/main.cpp) file(GLOB_RECURSE APP_RESOURCES ../res/*) cocos_mark_resources(FILES ${APP_RESOURCES} BASEDIR ../res RESOURCEBASE Resources/res) file(GLOB_RECURSE APP_SCRIPTS ../src/*) cocos_mark_resources(FILES ${APP_SCRIPTS} BASEDIR ../src RESOURCEBASE Resources/src) file(GLOB_RECURSE COCOS_SCRIPTS ${CMAKE_SOURCE_DIR}/cocos/scripting/lua-bindings/script/*) cocos_mark_resources(FILES ${COCOS_SCRIPTS} BASEDIR ${CMAKE_SOURCE_DIR}/cocos/scripting/lua-bindings/script RESOURCEBASE Resources/src/cocos) list(APPEND SAMPLE_SRC ${APP_RESOURCES} ${APP_SCRIPTS} ${COCOS_SCRIPTS}) endif() include_directories( Classes ../../../cocos/scripting/lua-bindings/manual ../../../external/lua/lua ../../../external/lua/tolua ) # add the executable add_executable(${APP_NAME} ${SAMPLE_SRC}) target_link_libraries(${APP_NAME} cocos2d luacocos2d) if(MACOSX OR APPLE) set_target_properties(${APP_NAME} PROPERTIES MACOSX_BUNDLE 1 RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin" ) else() 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 copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/../res ${APP_BIN_DIR}${RES_PREFIX}/res COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/../src ${APP_BIN_DIR}${RES_PREFIX}/src COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/cocos/scripting/lua-bindings/script/ ${APP_BIN_DIR}${RES_PREFIX}/src/cocos ) endif()