cocos2d-x 4.0 Spine 3.8编译环境配置(高级篇)

cocos2d-x各种的环境配置这里就不做解释

首先准备spine的运行库http://zh.esotericsoftware.com/spine-runtimes

是一个github代码托管,clone到本地或者download到本地,好的资源准备了开始配置吧

1.创建目录(保存旧和新的配置文件)

2.往"spine新"拷贝运行库文件保证了备份旧文件也备份新文件

把"include/spine"文件夹下的和"src/spine"文件夹下的所有文件拷贝到"spine新"

把"src/spine"文件夹下的所有文件拷贝到"spine新"

-------------------------------------------

把"cocos2d-x-4.0/cocos/editor-support/spine/"下的所有文件都拷贝到"cocos2dx替换文件/cocos/editor-support/spine旧/"

3.配置spine

在"spine新"创建"CMakeLists.txt"文件,输入内容:

set(COCOS_SPINE_HEADER

    editor-support/spine/Animation.h

    )

set(COCOS_SPINE_SRC

    editor-support/spine/Animation.cpp

)

把所有文件都以"editor-support/spine/文件名"往"CMakeLists.txt"文件输入.h对应COCOS_SPINE_HEADER,.cpp对应COCOS_SPINE_SRC

-------------------------------------------

把"cocos2d-x-4.0/cocos/CMakeLists.txt"文件拷贝到"cocos2dx替换文件/cocos/"下重新命名为"CMakeLists.txt旧",再拷贝一次这次重新命名为"CMakeLists.txt新"

打开"CMakeLists.txt新"第52行option(BUILD_EDITOR_SPINE "Build editor support for spine" OFF)改为option(BUILD_EDITOR_SPINE "Build editor support for spine" ON)

-------------------------------------------

把"cocos2d-x-4.0/templates/cocos2dx_files.json"文件拷贝到"cocos2dx替换文件/templates/"下重新命名为"cocos2dx_files.json旧",再拷贝一次这次重新命名为"cocos2dx_files.json新"

打开"cocos2dx_files.json新"把所有以"cocos/editor-support/spine/"开头的字符都删除,在该位置输入"cocos/editor-support/spine/"+(spine新)里所有的文件,注意不要忘记了"cocos/editor-support/spine/CMakeLists.txt"

4.替换文件

把“cocos2dx替换文件”里文件或文件带新的拷贝到"cocos2d-x-4.0"对应的文件夹里,记得把“新”字去掉

5.创建cocos2d-x项目

cocos new 项目名称 -p (iOS bundle id或Android包名) -l cpp -d 存储位置路径

6.等待编译通过

cd 项目目录

cocos compile -p android -m release -j 2

你可能感兴趣的:(cocos2d-x 4.0 Spine 3.8编译环境配置(高级篇))