Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync with master #18

Merged
merged 124 commits into from
Dec 10, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
124 commits
Select commit Hold shift + click to select a range
49a3b5b
fix auto test fails (#20183)
Mee-gu Oct 8, 2019
ab04e03
fix PhysicsContactTest (#20171)
Mee-gu Oct 8, 2019
c7020fb
fix C4244 warning (#20173)
Mee-gu Oct 9, 2019
a91091e
fix triangle batch (#20185)
Mee-gu Oct 10, 2019
68aedd7
revert error caused by fixC4244Warning (#20190)
Mee-gu Oct 11, 2019
b553648
remove unused code (#20195)
Mee-gu Oct 12, 2019
327407d
fix full screen issue (#20202)
Mee-gu Oct 15, 2019
67ae2e7
fix ProgramState and Program performance (#20189)
Mee-gu Oct 15, 2019
bdf3967
[ci skip][AUTO]: updating luabinding & cocos_file.json automatically …
CocosRobot Oct 16, 2019
b8cf680
update ProgramState usage in lua (#20204)
Mee-gu Oct 16, 2019
0a227ef
Don't use MTL_ pixelformat when building for iOS Simulator. (#20198)
trojanfoe Oct 16, 2019
4003802
[ci skip][AUTO]: updating luabinding & cocos_file.json automatically …
CocosRobot Oct 16, 2019
8a64e6f
fix RotateTo animation when angle is bigger than 360 (#20009) (#20211)
minggo Oct 16, 2019
24b04e5
sync #20007 to v4 (#20210)
minggo Oct 17, 2019
99e984d
fix crash when plist filename hasn't suffix (#19999) (#20212)
minggo Oct 17, 2019
fafd16e
refactor Quaternion class (#20031) (#20213)
minggo Oct 17, 2019
fae3ef8
fix memory leak (#20110) (#20214)
minggo Oct 17, 2019
d29adb3
sync #19914 (#20215)
minggo Oct 17, 2019
c816d29
Fix include order for Win32. (#20216)
minggo Oct 17, 2019
e86f229
Remove tinyxml2 from CCSaxParser implement. (#20141) (#20217)
minggo Oct 17, 2019
cbf3233
Rename cocos2d::MessageBox to cocos2d::ccMessageBox. (#20159) (#20218)
minggo Oct 17, 2019
1a04787
Rework CMake Xcode support. (#20205)
trojanfoe Oct 22, 2019
11a1f82
[v4] add unzip test code (#20219)
PatriceJiang Oct 22, 2019
f210576
[ci skip][AUTO]: updating luabinding & cocos_file.json automatically …
CocosRobot Oct 22, 2019
ee44326
fix label text word wrong warp issue (#20226)
Mee-gu Oct 23, 2019
6b1e55f
Remove experimental namespace (#20229)
minggo Oct 23, 2019
8a191d5
[ci skip][AUTO]: updating luabinding & cocos_file.json automatically …
CocosRobot Oct 23, 2019
1898d47
[ci skip]Release note (#20234)
minggo Oct 24, 2019
8bf83dc
Sync 20209 (#20233)
minggo Oct 24, 2019
b5f1b0e
support iphone simulator (#20235)
Mee-gu Oct 24, 2019
c2c6aa4
don't compile codes for binding generator if it is a pull request (#2…
minggo Oct 24, 2019
a2eeb25
update bullet (#20239)
Mee-gu Oct 24, 2019
4b1cecd
[ci skip][AUTO]: updating luabinding & cocos_file.json automatically …
CocosRobot Oct 24, 2019
d7f2ae3
fix TODO (#20245)
Mee-gu Oct 25, 2019
4c3d7b4
remove deprecated setBlendFunc (#20244)
Mee-gu Oct 25, 2019
be038d9
fix some warnings (#20236)
minggo Oct 25, 2019
b849fce
remove box2d tests (#20246)
Mee-gu Oct 25, 2019
6dbbb4c
remove the comment of enableRetina for mac (#20249)
Mee-gu Oct 25, 2019
c9af873
fix some warnings (#20247)
minggo Oct 25, 2019
a09806f
Fix todo (#20248)
Mee-gu Oct 25, 2019
8878303
[ci skip][AUTO]: updating luabinding & cocos_file.json automatically …
CocosRobot Oct 25, 2019
2501f53
add CameraTest (#20253)
Mee-gu Oct 25, 2019
7f79693
Revert "fix RotateTo animation when angle is bigger than 360 (#20009)…
minggo Oct 28, 2019
c85cfcb
fix crash
Mee-gu Oct 28, 2019
2d42aa1
fix memory leak (#20258)
Mee-gu Oct 28, 2019
d9f8296
update reivew
Mee-gu Oct 28, 2019
84feb1f
update default ABI
minggo Oct 28, 2019
eb23e1f
needs update texture info
Mee-gu Oct 28, 2019
a0d7751
rename to make function name more clear
Mee-gu Oct 28, 2019
35b2469
update review
Mee-gu Oct 28, 2019
4af28a2
revert cpp-empty-test (#20262)
minggo Oct 29, 2019
3b7a85c
needs update texture info (#20260)
minggo Oct 29, 2019
c17c0cd
Merge pull request #20259 from Mee-gu/fixCrash
minggo Oct 29, 2019
2f79eb1
fix installation error on some Android devices
minggo Oct 29, 2019
30407bc
Merge pull request #20263 from minggo/android-installation-issue
minggo Oct 29, 2019
d77cd8f
fix experimental namespace
Mee-gu Oct 29, 2019
487634b
Merge pull request #20264 from Mee-gu/fixLua
minggo Oct 29, 2019
4f48652
fix walking boundary of 3D test in lua
Mee-gu Oct 29, 2019
8f57137
Merge pull request #20265 from Mee-gu/fix3DBoundary
minggo Oct 30, 2019
d35a1de
fix crash due to iOS13 UIWindowScene
Mee-gu Oct 30, 2019
ffb3955
Merge pull request #20269 from Mee-gu/fixiOSCrash
minggo Oct 30, 2019
d41457d
comment spine codes in lua (#20272)
Mee-gu Oct 30, 2019
251eaa2
fix crash due to iOS13 UIWindowScene (#20271)
Mee-gu Oct 30, 2019
dddcdf3
Fixes so that in the web view we are able to navigate different links…
minggo Oct 31, 2019
4914dff
fix AudioSwitchStateTest subtile (#20278)
Mee-gu Oct 31, 2019
29e50a8
remove extern "C" from base/base64.h for avoiding base64 function sym…
minggo Nov 1, 2019
b852fc3
Revert "don't compile codes for binding generator if it is a pull req…
minggo Nov 1, 2019
8126cfa
add defualt ios deloyment target (#20282)
Mee-gu Nov 1, 2019
29e0372
fix issue that can not run release mode with lua projects (#20291)
minggo Nov 5, 2019
f52df59
update cocos console (#20293)
minggo Nov 5, 2019
5acc952
fix iOS build issue (#20292)
minggo Nov 5, 2019
01ff6dd
delete useless files and clean codes (#20279)
minggo Nov 6, 2019
0942895
[ci skip][AUTO]: updating luabinding & cocos_file.json automatically …
CocosRobot Nov 6, 2019
0cbaec9
don't set glview transparent, it many cause afterimage (#20298) (#20299)
minggo Nov 6, 2019
afbf817
fix testfiled issue on iOS13 (#20296)
minggo Nov 6, 2019
292e4c3
fix effect test (#20286)
Mee-gu Nov 6, 2019
98ab6d2
set iOS default deployment version in correct place (#20307)
minggo Nov 8, 2019
3aa7a73
Sync 20303 (#20308)
minggo Nov 8, 2019
48239ee
update external (#20310)
PatriceJiang Nov 8, 2019
4d16f31
[ci skip][AUTO]: updating luabinding & cocos_file.json automatically …
CocosRobot Nov 8, 2019
ac30586
Support multiple build configurations (#20314)
crazyhappygame Nov 11, 2019
e03192b
update 3rd bin (#20316)
minggo Nov 12, 2019
6a53b31
[bugfix] add pagezero_size link flags (#20321)
PatriceJiang Nov 13, 2019
facf78a
add opengl header since Texture2D and Image will use opengl define (#…
Mee-gu Nov 13, 2019
d03411d
update submodule (#20324)
Mee-gu Nov 14, 2019
5688852
set default minimum deployment target (#20323)
Mee-gu Nov 14, 2019
3a36e2d
Fixing a crash in iOS 9.3.5 when we have a layer with WebView getting…
minggo Nov 14, 2019
bb5cf54
fix videoplayer crash in release mode (#20327)
minggo Nov 14, 2019
a6f73e2
adjust testItem relative position (#20331)
Mee-gu Nov 14, 2019
dde4780
decrease the font size or it will be conflict (#20333)
Mee-gu Nov 14, 2019
e3c636c
Sync resource automatically on Windows and Linux (#20319)
PatriceJiang Nov 15, 2019
9049ddb
manually maintain reference count (#20329)
minggo Nov 15, 2019
49bca67
[ci skip][AUTO]: updating luabinding & cocos_file.json automatically …
CocosRobot Nov 15, 2019
587bcab
fix asan reported errors (#20332)
PatriceJiang Nov 15, 2019
83b5219
fix issue that can not close keyboard if using EditBox on iOS (#20336…
minggo Nov 15, 2019
b294094
implement setProgramState for SpriteBatchNode (#20344)
Mee-gu Nov 18, 2019
977510f
fix issue that videoplayer may crash on iOS (#20345)
minggo Nov 18, 2019
d05967b
fix setScissorRect crash (#20348)
zhongfq Nov 20, 2019
912ba30
remove duplicated PrgramState instance in the derived class of Node (…
Mee-gu Nov 20, 2019
3b47480
use copy instead of linkis (#20356)
PatriceJiang Nov 21, 2019
5b15737
fix walking boundary of terrain (#20364)
Mee-gu Nov 22, 2019
b9df4bd
format spelling (#20360)
zhongfq Nov 22, 2019
c81b7a0
support load asset in internal storage or sdcard (#20359)
zhongfq Nov 22, 2019
191b2b8
[ci skip][AUTO]: updating luabinding & cocos_file.json automatically …
CocosRobot Nov 22, 2019
9b8a72a
fix AudioEngine maybe crash on android (#20361)
zhongfq Nov 23, 2019
c048d6b
no need to update color (#20363)
Mee-gu Nov 23, 2019
e930543
fix edit box position error (#20358)
zhongfq Nov 23, 2019
2743222
missing implementation for TiledGrid3DAction::create (#20370)
zhongfq Nov 26, 2019
c3f1fbd
use sprite to create editbox (#20371)
minggo Nov 26, 2019
ed49d6b
update submodule (#20362)
PatriceJiang Nov 26, 2019
fd11827
adjust ralative position of tested item in TouchTest (#20369)
Mee-gu Nov 26, 2019
9ea4ade
fix appvenyor env (#20372)
PatriceJiang Nov 26, 2019
138843c
Fix to properly delete easingParams array (#20375)
sabify Nov 27, 2019
2659f80
fix incorrect hash structure for RenderPipeline (#20373)
Mee-gu Nov 27, 2019
b35a20c
fix template (#20377)
PatriceJiang Nov 27, 2019
61ff9ed
[ci skip][AUTO]: updating luabinding & cocos_file.json automatically …
CocosRobot Nov 27, 2019
31510ee
[CI ]add cocos new for iOS (#20380)
PatriceJiang Nov 29, 2019
e3438ed
fix flicker of fast tilemap (#20387)
minggo Nov 29, 2019
7234ef9
update to v4 (#20392)
minggo Dec 4, 2019
3ac72c0
[ci skip][AUTO]: updating luabinding & cocos_file.json automatically …
CocosRobot Dec 4, 2019
b53528c
removed old URLs I could not fine, replaced 404 with new URLS (#20398)
slackmoehrle Dec 5, 2019
f20b14a
no need to convert to RGBA8888 when it is DEFAULT (#20397)
Mee-gu Dec 6, 2019
ff333f7
update error link
minggo Dec 8, 2019
8214f27
[bugfix] set Info.plist path (#20405)
PatriceJiang Dec 10, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
10 changes: 10 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,16 @@ matrix:
env: BUILD_TARGET=linux_cocos_new_test
language: cpp
sudo: required
- os: osx
env: BUILD_TARGET=ios_cocos_new_lua_test
language: cpp
osx_image: xcode11
sudo: required
- os: osx
env: BUILD_TARGET=ios_cocos_new_cpp_test
language: cpp
osx_image: xcode11
sudo: required

script:
- tools/travis-scripts/run-script.sh
Expand Down
10 changes: 9 additions & 1 deletion CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
cocos2d-x-4.0 ??
cocos2d-x-4.0 Dec.3 2019

[HIGHLIGHT] Support metal
[HIGHLIGHT] Use CMake for all platforms

[REFINE] Update glfw to 3.3
[REFINE] Update minizip to 1.2

[CHANGE] remove deprecated functions
[CHANGE] remove h5 engine and JSB
[CHANGE] remove tiff
[CHANGE] remove `experimental` namespace

[FIX] system font can not work correctly on macOS 15
[FIX] TextField can not work if using system input to get Chinese characters with iOS13
[FIX] UIWebView uses WKWebView instead
[FIX] VideoPlayer uses AVPlayerController instead
[FX] lua crashes on 64it devcices

cocos2d-x-3.17 May.21 2018

Expand Down
7 changes: 7 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@ cmake_minimum_required(VERSION 3.6)

project(Cocos2d-x)

# set default minimum deployment target
if(XCODE)
if(NOT DEFINED CMAKE_XCODE_ATTRIBUTE_IPHONEOS_DEPLOYMENT_TARGET)
SET (CMAKE_XCODE_ATTRIBUTE_IPHONEOS_DEPLOYMENT_TARGET 8.0)
endif()
endif()

# cocos2dx root path
set(COCOS2DX_ROOT_PATH ${CMAKE_CURRENT_SOURCE_DIR})
set(CMAKE_MODULE_PATH ${COCOS2DX_ROOT_PATH}/cmake/Modules/)
Expand Down
39 changes: 14 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ cocos2d-x

|Win32|Others|
| ----|------|
[![Build status](https://ci.appveyor.com/api/projects/status/nlgirox464j6ldg5/branch/v3?svg=true)](https://ci.appveyor.com/project/minggo/cocos2d-x/branch/v3)|[![Build Status](https://travis-ci.org/cocos2d/cocos2d-x.svg?branch=v3)](https://travis-ci.org/cocos2d/cocos2d-x)
[![Build status](https://ci.appveyor.com/api/projects/status/nlgirox464j6ldg5/branch/v4?svg=true)](https://ci.appveyor.com/project/minggo/cocos2d-x/branch/v4)|[![Build Status](https://travis-ci.org/cocos2d/cocos2d-x.svg?branch=v4)](https://travis-ci.org/cocos2d/cocos2d-x)


[cocos2d-x][1] is a multi-platform framework for building 2d games, interactive books, demos and other graphical applications.
It is based on [cocos2d-iphone][2], but instead of using Objective-C, it uses C++.
It works on iOS, Android, OS X, Windows and Linux.
It is based on __cocos2d-iphone__, but instead of using Objective-C, it uses C++.
It works on iOS, Android, macOS, Windows and Linux.

**Cocos2d-x Framework Architecture**:

Expand Down Expand Up @@ -47,11 +47,11 @@ Download stable versions

Documentations and samples
-------------
* [All Docs in a single place!](http://cocos2d-x.org/docs/)
* [Online API Reference](http://cocos2d-x.org/docs/api-ref/index.html) _Note that Cocos2d-x and Cocos Creator have different API set_
* [Programmers Guide](http://cocos2d-x.org/docs/programmers-guide/2/index.html)
* [Latest Release Note](https://github.com/cocos2d/cocos2d-x/blob/v3/docs/RELEASE_NOTES.md)
* [Changelog](https://github.com/cocos2d/cocos2d-x/blob/v3/CHANGELOG)
* [All Docs in a single place!](http://docs.cocos2d-x.org/)
* [Online API Reference](http://docs.cocos2d-x.org/api-ref/index.html) _Note that Cocos2d-x and Cocos Creator have different API set_
* [Programmers Guide](https://docs.cocos2d-x.org/cocos2d-x/v4/en/basic_concepts/)
* [Latest Release Note](https://github.com/cocos2d/cocos2d-x/blob/v4/docs/RELEASE_NOTES.md)
* [Changelog](https://github.com/cocos2d/cocos2d-x/blob/v4/CHANGELOG)

Main features
-------------
Expand Down Expand Up @@ -156,12 +156,10 @@ For Android, the Android Studio project file lies in `PROJECT_DIR/proj.android`.
Learning Resources
--------------------------------

* [Programmers Guide](http://cocos2d-x.org/docs/programmers-guide/2/index.html)
* [Sonar Systems Videos](https://www.youtube.com/user/sonarsystemslimited/search?query=cocos2d-x)
* [Programmers Guide](https://docs.cocos2d-x.org/cocos2d-x/v4/en/basic_concepts/)
* [Android Fundamentals](https://developer.android.com/guide/components/fundamentals.html)
* [Make School Tutorials](https://www.makeschool.com/tutorials/)
* [Games From Scratch](http://www.gamefromscratch.com/page/Cocos2d-x-CPP-Game-Programming-Tutorial-Series.aspx)
* [Cocos2d sample games](https://github.com/cocos2d/cocos2d-x-samples)
* [Make School Tutorials](https://github.com/MakeSchool?utf8=✓&q=cocos2d&type=&language=)

Spreading the word!
--------------------------------
Expand All @@ -170,24 +168,17 @@ You can help us spread the word about cocos2d-x! We would surely appreciate it!
* Talk about us on Facebook! Our [Facebook Page](https://www.facebook.com/cocos2dx/)
* Tweet, Tweet! Our [Twitter](https://twitter.com/cocos2dx)
* Read our [Blog](http://blog.cocos2d-x.org/) and promote it on your social media.
* Become a [Regional Coordinator](http://discuss.cocos2d-x.org/t/we-need-regional-coordinators/24104)

See what we are planning!
--------------------------------
You can see exactly what we are planning to do with the Cocos family of products.

* [Cocos2d-x roadmap](https://trello.com/b/Np6obnuE/cocos2d-x-roadmap)

Where to get help
--------------------------------

* [English Forums](http://discuss.cocos2d-x.org)
* [中文社区](http://forum.cocos.com/c/cocos2d-x)
* [Bug Tracker](https://github.com/cocos2d/cocos2d-x/issues)
* [API Reference](http://cocos2d-x.org/docs/api-ref/index.html).
* [Latest Release Note](https://github.com/cocos2d/cocos2d-x/blob/v3/docs/RELEASE_NOTES.md)
* [Changelog](https://github.com/cocos2d/cocos2d-x/blob/v3/CHANGELOG)
* IRC. We are in [Freenode](https://webchat.freenode.net/) in the _#cocos2d_ channel
* [API Reference](http://docs.cocos2d-x.org/api-ref/index.html).
* [Latest Release Note](https://github.com/cocos2d/cocos2d-x/blob/v4/docs/RELEASE_NOTES.md)
* [Changelog](https://github.com/cocos2d/cocos2d-x/blob/v4/CHANGELOG)
* [Discord Channel](https://discord.gg/pVqab4K)
* `cpp-tests` project. This project is our basis for testing. Use this project to
learn how we implement the functionality of the engine. This project is located in
__cocos2d-x_root/build.__
Expand All @@ -209,8 +200,6 @@ Contact us
* Weibo: [http://t.sina.com.cn/cocos2dx][11]

[1]: http://www.cocos2d-x.org "cocos2d-x"
[2]: http://www.cocos2d-iphone.org "cocos2d for iPhone"
[3]: http://www.cocos2d-x.org/projects/cocos2d-x/wiki/Download
[4]: http://www.cocos2d-x.org/download/version#Cocos2d-x
[5]: http://www.box2d.org "Box2D"
[6]: http://www.chipmunk-physics.net "Chipmunk2D"
Expand Down
151 changes: 78 additions & 73 deletions cmake/Modules/CocosBuildHelpers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,81 @@ include(CMakeParseArguments)

# copy resource `FILES` and `FOLDERS` to TARGET_FILE_DIR/Resources
function(cocos_copy_target_res cocos_target)
set(oneValueArgs COPY_TO)
set(multiValueArgs FILES FOLDERS)
set(oneValueArgs LINK_TO)
set(multiValueArgs FOLDERS)
cmake_parse_arguments(opt "" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
# copy files
foreach(cc_file ${opt_FILES})
get_filename_component(file_name ${cc_file} NAME)
add_custom_command(TARGET ${cocos_target} POST_BUILD
#COMMAND ${CMAKE_COMMAND} -E echo "copy-file into Resources: ${file_name} ..."
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${cc_file} "${opt_COPY_TO}/${file_name}"

if(NOT TARGET SYNC_RESOURCE-${cocos_target})
message(WARNING "SyncResource targe for ${cocos_target} is not defined")
return()
endif()

# linking folders
foreach(cc_folder ${opt_FOLDERS})
#get_filename_component(link_folder ${opt_LINK_TO} DIRECTORY)
get_filename_component(link_folder_abs ${opt_LINK_TO} ABSOLUTE)
add_custom_command(TARGET SYNC_RESOURCE-${cocos_target} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E echo " copying to ${link_folder_abs}"
COMMAND ${PYTHON_COMMAND} ARGS ${COCOS2DX_ROOT_PATH}/cmake/scripts/sync_folder.py
-s ${cc_folder} -d ${link_folder_abs}
)
endforeach()
# copy folders files
foreach(cc_folder ${opt_FOLDERS})
# file(GLOB_RECURSE folder_files "${cc_folder}/*")
# get_filename_component(folder_abs_path ${cc_folder} ABSOLUTE)
# foreach(res_file ${folder_files})
# get_filename_component(res_file_abs_path ${res_file} ABSOLUTE)
# file(RELATIVE_PATH res_file_relat_path ${folder_abs_path} ${res_file_abs_path})
# add_custom_command(TARGET ${cocos_target} POST_BUILD
# COMMAND ${CMAKE_COMMAND} -E echo "copy file into Resources: ${res_file_relat_path} ..."
# COMMAND ${CMAKE_COMMAND} -E copy_if_different ${res_file} "${opt_COPY_TO}/${res_file_relat_path}"
# )
# endforeach()
### copy file by file is too slow on windows, the copy_directory improves a lot.
add_custom_command(TARGET ${cocos_target} POST_BUILD
#COMMAND ${CMAKE_COMMAND} -E echo "copy-dir into Resources: ${opt_COPY_TO} ..."
COMMAND ${CMAKE_COMMAND} -E copy_directory ${cc_folder} "${opt_COPY_TO}"
endfunction()

## create a virtual target SYNC_RESOURCE-${cocos_target}
## Update resource files in Resources/ folder everytime when `Run/Debug` target.
function(cocos_def_copy_resource_target cocos_target)
add_custom_target(SYNC_RESOURCE-${cocos_target} ALL
COMMAND ${CMAKE_COMMAND} -E echo "Copying resources for ${cocos_target} ..."
)
add_dependencies(${cocos_target} SYNC_RESOURCE-${cocos_target})
set_target_properties(SYNC_RESOURCE-${cocos_target} PROPERTIES
FOLDER Utils
)
endfunction()


function(cocos_copy_lua_scripts cocos_target src_dir dst_dir)
set(luacompile_target COPY_LUA-${cocos_target})
if(NOT TARGET ${luacompile_target})
add_custom_target(${luacompile_target} ALL
COMMAND ${CMAKE_COMMAND} -E echo "Copying lua scripts ..."
)
add_dependencies(${cocos_target} ${luacompile_target})
set_target_properties(${luacompile_target} PROPERTIES
FOLDER Utils
)
endif()
if(MSVC)
add_custom_command(TARGET ${luacompile_target} POST_BUILD
COMMAND ${PYTHON_COMMAND} ARGS ${COCOS2DX_ROOT_PATH}/cmake/scripts/sync_folder.py
-s ${src_dir} -d ${dst_dir} -l ${LUAJIT32_COMMAND} -m $<CONFIG>
)
else()
if("${CMAKE_BUILD_TYPE}" STREQUAL "")
add_custom_command(TARGET ${luacompile_target} POST_BUILD
COMMAND ${PYTHON_COMMAND} ARGS ${COCOS2DX_ROOT_PATH}/cmake/scripts/sync_folder.py
-s ${src_dir} -d ${dst_dir}
)
endforeach()
else()
add_custom_command(TARGET ${luacompile_target} POST_BUILD
COMMAND ${PYTHON_COMMAND} ARGS ${COCOS2DX_ROOT_PATH}/cmake/scripts/sync_folder.py
-s ${src_dir} -d ${dst_dir} -l ${LUAJIT32_COMMAND} -m ${CMAKE_BUILD_TYPE}
COMMAND ${PYTHON_COMMAND} ARGS ${COCOS2DX_ROOT_PATH}/cmake/scripts/sync_folder.py
-s ${src_dir} -d ${dst_dir}/64bit -l ${LUAJIT64_COMMAND} -m ${CMAKE_BUILD_TYPE}
)
endif()
endif()

endfunction()


function(cocos_get_resource_path output cocos_target)
get_target_property(rt_output ${cocos_target} RUNTIME_OUTPUT_DIRECTORY)
set(${output} "${rt_output}/${CMAKE_CFG_INTDIR}/Resources" PARENT_SCOPE)
endfunction()


# mark `FILES` and files in `FOLDERS` as resource files, the destination is `RES_TO` folder
# save all marked files in `res_out`
function(cocos_mark_multi_resources res_out)
Expand Down Expand Up @@ -202,6 +246,15 @@ function(setup_cocos_app_config app_name)
if(XCODE OR VS)
cocos_mark_code_files(${app_name})
endif()

if (XCODE)
cocos_config_app_xcode_property(${app_name})
endif()

if(LINUX OR WINDOWS)
cocos_def_copy_resource_target(${app_name})
endif()

endfunction()

# if cc_variable not set, then set it cc_value
Expand All @@ -211,52 +264,6 @@ macro(cocos_set_default_value cc_variable cc_value)
endif()
endmacro()

# generate macOS app package infomations, need improve for example, the using of info.plist
function(cocos_pak_xcode cocos_target)
set(oneValueArgs
INFO_PLIST
BUNDLE_NAME
BUNDLE_VERSION
COPYRIGHT
GUI_IDENTIFIER
ICON_FILE
INFO_STRING
LONG_VERSION_STRING
SHORT_VERSION_STRING
)
set(multiValueArgs)
cmake_parse_arguments(ARGS "" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})

string(TIMESTAMP ARGS_COPYRIGHT_YEAR "%Y")
# set default value
cocos_set_default_value(ARGS_INFO_PLIST "MacOSXBundleInfo.plist.in")
cocos_set_default_value(ARGS_BUNDLE_NAME "\${PRODUCT_NAME}")
cocos_set_default_value(ARGS_BUNDLE_VERSION "1")
cocos_set_default_value(ARGS_COPYRIGHT "Copyright © ${ARGS_COPYRIGHT_YEAR}. All rights reserved.")
cocos_set_default_value(ARGS_GUI_IDENTIFIER "org.cocos2dx.${APP_NAME}")
cocos_set_default_value(ARGS_ICON_FILE "Icon")
cocos_set_default_value(ARGS_INFO_STRING "cocos2d-x app")
cocos_set_default_value(ARGS_LONG_VERSION_STRING "1.0.0")
cocos_set_default_value(ARGS_SHORT_VERSION_STRING "1.0")
# set default values for Info.plist template
set_target_properties(${cocos_target}
PROPERTIES
MACOSX_BUNDLE_INFO_PLIST ${ARGS_INFO_PLIST}
)
set(MACOSX_BUNDLE_BUNDLE_NAME ${ARGS_BUNDLE_NAME} PARENT_SCOPE)
set(MACOSX_BUNDLE_BUNDLE_VERSION ${ARGS_BUNDLE_VERSION} PARENT_SCOPE)
set(MACOSX_BUNDLE_COPYRIGHT ${ARGS_COPYRIGHT} PARENT_SCOPE)
set(MACOSX_BUNDLE_GUI_IDENTIFIER ${ARGS_GUI_IDENTIFIER} PARENT_SCOPE)
set(MACOSX_BUNDLE_ICON_FILE ${ARGS_ICON_FILE} PARENT_SCOPE)
set(MACOSX_BUNDLE_INFO_STRING ${ARGS_INFO_STRING} PARENT_SCOPE)
set(MACOSX_BUNDLE_LONG_VERSION_STRING ${ARGS_LONG_VERSION_STRING} PARENT_SCOPE)
set(MACOSX_BUNDLE_SHORT_VERSION_STRING ${ARGS_SHORT_VERSION_STRING} PARENT_SCOPE)

message(STATUS "cocos package: ${cocos_target}, plist file: ${ARGS_INFO_PLIST}")

cocos_config_app_xcode_property(${cocos_target})
endfunction()

# set Xcode property for application, include all depend target
macro(cocos_config_app_xcode_property cocos_app)
set(depend_libs)
Expand All @@ -271,7 +278,6 @@ endmacro()
# custom Xcode property for iOS target
macro(cocos_config_target_xcode_property cocos_target)
if(IOS)
set_xcode_property(${cocos_target} IPHONEOS_DEPLOYMENT_TARGET "8.0")
set_xcode_property(${cocos_target} ENABLE_BITCODE "NO")
set_xcode_property(${cocos_target} ONLY_ACTIVE_ARCH "YES")
endif()
Expand Down Expand Up @@ -368,4 +374,3 @@ function(cocos_use_pkg target pkg)
endif()

endfunction()

28 changes: 26 additions & 2 deletions cmake/Modules/CocosBuildSet.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,21 @@ if(CMAKE_TOOLCHAIN_FILE)
message(STATUS "using toolchain file:" ${CMAKE_TOOLCHAIN_FILE})
endif()

find_program(PYTHON_COMMAND NAMES python2 python)
find_program(COCOS_COMMAND NAME cocos
PATHS ${COCOS2DX_ROOT_PATH}/tools/cocos2d-console/bin $ENV{COCOS_CONSOLE_ROOT})

message(STATUS "PROJECT_NAME:" ${PROJECT_NAME})
message(STATUS "PROJECT_SOURCE_DIR:" ${PROJECT_SOURCE_DIR})
message(STATUS "COCOS2DX_ROOT_PATH:" ${COCOS2DX_ROOT_PATH})
message(STATUS "CMAKE_MODULE_PATH:" ${CMAKE_MODULE_PATH})
# delete binary dir if you hope a full clean re-build
message(STATUS "PROJECT_BINARY_DIR:" ${PROJECT_BINARY_DIR})
message(STATUS "ENGINE_BINARY_PATH:" ${ENGINE_BINARY_PATH})

message(STATUS "PYTHON_PATH:" ${PYTHON_COMMAND})
message(STATUS "COCOS_COMMAND_PATH:" ${COCOS_COMMAND})
message(STATUS "HOST_SYSTEM:" ${CMAKE_HOST_SYSTEM_NAME})
# the default behavior of build module
option(DEBUG_MODE "Debug or Release?" ON)
option(BUILD_LUA_LIBS "Build lua libraries" OFF)

# include helper functions
Expand All @@ -36,3 +41,22 @@ include(CocosConfigDefine)

# config libraries dependence
include(CocosConfigDepend)

if(COCOS_COMMAND)
get_filename_component(cocos2dx_console_dir ${COCOS_COMMAND} DIRECTORY)
set(COCOS2DX_LUAJIT_ROOT ${cocos2dx_console_dir}/../plugins/plugin_luacompile/bin)
message(STATUS "COCOS2DX_LUAJIT_ROOT:" ${COCOS2DX_LUAJIT_ROOT})
if("${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "Windows")
find_program(LUAJIT32_COMMAND NAMES luajit-win32 PATHS ${COCOS2DX_LUAJIT_ROOT}/32bit NO_SYSTEM_ENVIRONMENT_PATH)
find_program(LUAJIT64_COMMAND NAMES luajit-win32 PATHS ${COCOS2DX_LUAJIT_ROOT}/64bit NO_SYSTEM_ENVIRONMENT_PATH)
elseif("${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "Linux")
find_program(LUAJIT32_COMMAND NAMES luajit-linux PATHS ${COCOS2DX_LUAJIT_ROOT}/32bit NO_SYSTEM_ENVIRONMENT_PATH)
find_program(LUAJIT64_COMMAND NAMES luajit-linux PATHS ${COCOS2DX_LUAJIT_ROOT}/64bit NO_SYSTEM_ENVIRONMENT_PATH)
endif()
endif()


if(WINDOWS OR LINUX)
message(STATUS "LUAJIT32_COMMAND:" ${LUAJIT32_COMMAND})
message(STATUS "LUAJIT64_COMMAND:" ${LUAJIT64_COMMAND})
endif()
Loading