加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
CMakeLists.txt 5.53 KB
一键复制 编辑 原始数据 按行查看 历史
xiyoufang 提交于 2018-07-08 18:13 . 添加游戏设置
#/****************************************************************************
# Copyright (c) 2013-2014 cocos2d-x.org
# Copyright (c) 2015-2017 Chukong Technologies Inc.
#
# http://www.cocos2d-x.org
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
# ****************************************************************************/
cmake_minimum_required(VERSION 3.1)
set(APP_NAME TemplateCpp)
project(${APP_NAME})
set(COCOS2DX_ROOT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cocos2d)
set(CMAKE_MODULE_PATH ${COCOS2DX_ROOT_PATH}/cmake/Modules/)
include(CocosBuildSet)
if(NOT USE_COCOS_PREBUILT)
add_subdirectory(${COCOS2DX_ROOT_PATH}/cocos ${ENGINE_BINARY_PATH}/cocos/core)
endif()
# record sources, headers, resources...
set(GAME_SOURCE)
set(GAME_HEADER)
set(GAME_RES_FOLDER
"${CMAKE_CURRENT_SOURCE_DIR}/Resources"
)
if(APPLE OR WINDOWS)
cocos_mark_multi_resources(common_res_files RES_TO "Resources" FOLDERS ${GAME_RES_FOLDER})
endif()
include_directories(
Classes
${COCOS2DX_ROOT_PATH}/cocos/audio/include/
)
# add cross-platforms source files and header files
list(APPEND GAME_SOURCE
Classes/AIEngine.cpp
Classes/AIPlayer.cpp
Classes/AlertLayer.cpp
Classes/AppDelegate.cpp
Classes/BaseUILayer.cpp
Classes/GameEngine.cpp
Classes/GameLayer.cpp
Classes/GameLogic.cpp
Classes/GameSceneManager.cpp
Classes/HelloLayer.cpp
Classes/HelloWorldScene.cpp
Classes/RealPlayer.cpp
Classes/UIHelper.cpp
Classes/ViewControl.cpp
Classes/ViewObject.cpp
Classes/SetLayer.cpp
Classes/GameConfig.cpp
)
list(APPEND GAME_HEADER
Classes/AIEngine.h
Classes/AIPlayer.h
Classes/AlertLayer.h
Classes/AppDelegate.h
Classes/BaseUILayer.h
Classes/GameCmd.h
Classes/GameEngine.h
Classes/GameLayer.h
Classes/GameLogic.h
Classes/GameSceneManager.h
Classes/HelloLayer.h
Classes/HelloWorldScene.h
Classes/IPlayer.h
Classes/RealPlayer.h
Classes/UIHelper.h
Classes/Utility.h
Classes/ViewControl.h
Classes/ViewObject.h
Classes/FvMask.h
Classes/SetLayer.h
Classes/GameConfig.h
)
if(ANDROID)
# change APP_NAME to the share library name for Android, it's value depend on AndroidManifest.xml
set(APP_NAME MyGame)
list(APPEND GAME_SOURCE
proj.android/app/jni/hellocpp/main.cpp
)
elseif(LINUX)
list(APPEND GAME_SOURCE
proj.linux/main.cpp
)
elseif(WINDOWS)
list(APPEND GAME_HEADER
proj.win32/main.h
proj.win32/resource.h
)
list(APPEND GAME_SOURCE
proj.win32/main.cpp
proj.win32/game.rc
${common_res_files}
)
elseif(APPLE)
if(IOS)
list(APPEND GAME_HEADER
proj.ios_mac/ios/AppController.h
proj.ios_mac/ios/RootViewController.h
)
set(APP_UI_RES
proj.ios_mac/ios/LaunchScreen.storyboard
proj.ios_mac/ios/LaunchScreenBackground.png
proj.ios_mac/ios/Images.xcassets
)
list(APPEND GAME_SOURCE
proj.ios_mac/ios/main.m
proj.ios_mac/ios/AppController.mm
proj.ios_mac/ios/RootViewController.mm
proj.ios_mac/ios/Prefix.pch
${APP_UI_RES}
)
elseif(MACOSX)
set(APP_UI_RES
proj.ios_mac/mac/Icon.icns
proj.ios_mac/mac/Info.plist
)
list(APPEND GAME_SOURCE
proj.ios_mac/mac/main.cpp
proj.ios_mac/mac/Prefix.pch
${APP_UI_RES}
)
endif()
list(APPEND GAME_SOURCE ${common_res_files})
endif()
# mark app complie info and libs info
set(APP_SRC
${GAME_SOURCE}
${GAME_HEADER}
)
cocos_build_app(${APP_NAME}
APP_SRC "${APP_SRC}"
DEPEND_COMMON_LIBS "cocos2d"
DEPEND_ANDROID_LIBS "cocos2d_android"
)
if(APPLE)
set_target_properties(${APP_NAME} PROPERTIES RESOURCE "${APP_UI_RES}")
if(MACOSX)
set_target_properties(${APP_NAME} PROPERTIES
MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/proj.ios_mac/mac/Info.plist"
)
elseif(IOS)
cocos_pak_xcode(${APP_NAME} INFO_PLIST "iOSBundleInfo.plist.in")
set_xcode_property(${APP_NAME} ASSETCATALOG_COMPILER_APPICON_NAME "AppIcon")
endif()
elseif(WINDOWS)
cocos_copy_target_dll(${APP_NAME} COPY_TO ${APP_BIN_DIR})
endif()
if(LINUX OR WINDOWS)
cocos_copy_target_res(${APP_NAME} COPY_TO ${APP_RES_DIR} FOLDERS ${GAME_RES_FOLDER})
endif()
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化