Skip to content

Commit 14cafd3

Browse files
committed
Init
1 parent a568311 commit 14cafd3

File tree

5,452 files changed

+1974491
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

5,452 files changed

+1974491
-0
lines changed

.cocos-project.json

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"engine_version": "cocos2d-x-3.17.1",
3+
"has_native": true,
4+
"project_type": "js"
5+
}

CMakeLists.txt

+151
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
#/****************************************************************************
2+
# Copyright (c) 2013 cocos2d-x.org
3+
# Copyright (c) 2014 martell malone
4+
# Copyright (c) 2015-2017 Chukong Technologies Inc.
5+
#
6+
# http://www.cocos2d-x.org
7+
#
8+
# Permission is hereby granted, free of charge, to any person obtaining a copy
9+
# of this software and associated documentation files (the "Software"), to deal
10+
# in the Software without restriction, including without limitation the rights
11+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12+
# copies of the Software, and to permit persons to whom the Software is
13+
# furnished to do so, subject to the following conditions:
14+
15+
# The above copyright notice and this permission notice shall be included in
16+
# all copies or substantial portions of the Software.
17+
18+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24+
# THE SOFTWARE.
25+
# ****************************************************************************/
26+
27+
cmake_minimum_required(VERSION 3.6)
28+
29+
set(APP_NAME cocos2d-js-webpack)
30+
31+
project(${APP_NAME})
32+
33+
set(RUNTIME_SRC_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/frameworks/runtime-src)
34+
set(COCOS2DX_ROOT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/frameworks/cocos2d-x)
35+
set(CMAKE_MODULE_PATH ${COCOS2DX_ROOT_PATH}/cmake/Modules/)
36+
37+
include(CocosBuildSet)
38+
set(BUILD_JS_LIBS ON)
39+
add_subdirectory(${COCOS2DX_ROOT_PATH}/cocos ${ENGINE_BINARY_PATH}/cocos/core)
40+
41+
# script and source files info, not need to compile
42+
set(res_main_files
43+
"${CMAKE_CURRENT_SOURCE_DIR}/main.js"
44+
"${CMAKE_CURRENT_SOURCE_DIR}/project.json"
45+
)
46+
set(res_res_folders
47+
"${CMAKE_CURRENT_SOURCE_DIR}/res"
48+
)
49+
set(res_src_folders
50+
"${CMAKE_CURRENT_SOURCE_DIR}/src"
51+
)
52+
set(res_script_folders
53+
"${COCOS2DX_ROOT_PATH}/cocos/scripting/js-bindings/script"
54+
)
55+
if(APPLE OR VS)
56+
cocos_mark_multi_resources(res_main RES_TO "Resources" FILES ${res_main_files})
57+
cocos_mark_multi_resources(res_res RES_TO "Resources/res" FOLDERS ${res_res_folders})
58+
cocos_mark_multi_resources(res_src RES_TO "Resources/src" FOLDERS ${res_src_folders})
59+
cocos_mark_multi_resources(res_script RES_TO "Resources/script" FOLDERS ${res_script_folders})
60+
set(cc_common_res ${res_main} ${res_res} ${res_src} ${res_script})
61+
endif()
62+
63+
# record sources, headers
64+
set(GAME_SOURCE ${RUNTIME_SRC_ROOT}/Classes/AppDelegate.cpp)
65+
set(GAME_HEADER ${RUNTIME_SRC_ROOT}/Classes/AppDelegate.h)
66+
67+
if(ANDROID)
68+
# change APP_NAME to the share library name for Android, it's value depend on AndroidManifest.xml
69+
set(APP_NAME cocos2djs)
70+
list(APPEND GAME_SOURCE ${RUNTIME_SRC_ROOT}/proj.android/app/jni/hellojavascript/main.cpp)
71+
elseif(LINUX)
72+
list(APPEND GAME_SOURCE ${RUNTIME_SRC_ROOT}/proj.linux/main.cpp)
73+
elseif(WINDOWS)
74+
set(WINDOWS_SRC ${RUNTIME_SRC_ROOT}/proj.win32/main.cpp)
75+
list(APPEND WINDOWS_SRC ${RUNTIME_SRC_ROOT}/proj.win32/game.rc)
76+
list(APPEND GAME_HEADER
77+
${RUNTIME_SRC_ROOT}/proj.win32/main.h
78+
${RUNTIME_SRC_ROOT}/proj.win32/resource.h
79+
)
80+
list(APPEND GAME_SOURCE ${WINDOWS_SRC} ${cc_common_res})
81+
elseif(APPLE)
82+
if(IOS)
83+
list(APPEND GAME_HEADER
84+
${RUNTIME_SRC_ROOT}/proj.ios_mac/ios/AppController.h
85+
${RUNTIME_SRC_ROOT}/proj.ios_mac/ios/RootViewController.h
86+
)
87+
set(APP_UI_RES
88+
${RUNTIME_SRC_ROOT}/proj.ios_mac/ios/LaunchScreen.storyboard
89+
${RUNTIME_SRC_ROOT}/proj.ios_mac/ios/LaunchScreenBackground.png
90+
${RUNTIME_SRC_ROOT}/proj.ios_mac/ios/Images.xcassets
91+
)
92+
list(APPEND GAME_SOURCE
93+
${RUNTIME_SRC_ROOT}/proj.ios_mac/ios/main.m
94+
${RUNTIME_SRC_ROOT}/proj.ios_mac/ios/AppController.mm
95+
${RUNTIME_SRC_ROOT}/proj.ios_mac/ios/RootViewController.mm
96+
${RUNTIME_SRC_ROOT}/proj.ios_mac/ios/Prefix.pch
97+
${APP_UI_RES}
98+
)
99+
elseif(MACOSX)
100+
set(APP_UI_RES
101+
${RUNTIME_SRC_ROOT}/proj.ios_mac/mac/Icon.icns
102+
${RUNTIME_SRC_ROOT}/proj.ios_mac/mac/Info.plist
103+
)
104+
list(APPEND GAME_SOURCE
105+
${RUNTIME_SRC_ROOT}/proj.ios_mac/mac/main.cpp
106+
${RUNTIME_SRC_ROOT}/proj.ios_mac/mac/Prefix.pch
107+
${APP_UI_RES}
108+
)
109+
endif()
110+
list(APPEND GAME_SOURCE ${cc_common_res})
111+
endif()
112+
113+
set(APP_SRC ${GAME_HEADER} ${GAME_SOURCE})
114+
115+
# mark app complie info and libs info
116+
if(NOT ANDROID)
117+
add_executable(${APP_NAME} ${APP_SRC})
118+
else()
119+
add_library(${APP_NAME} SHARED ${APP_SRC})
120+
add_subdirectory(${COCOS2DX_ROOT_PATH}/cocos/platform/android ${ENGINE_BINARY_PATH}/cocos/platform)
121+
target_link_libraries(${APP_NAME} -Wl,--whole-archive cpp_android_spec -Wl,--no-whole-archive)
122+
add_subdirectory(${COCOS2DX_ROOT_PATH}/cocos/scripting/js-bindings/proj.android ${ENGINE_BINARY_PATH}/cocos/js-android)
123+
target_link_libraries(${APP_NAME} -Wl,--whole-archive js_android_spec -Wl,--no-whole-archive)
124+
endif()
125+
126+
target_link_libraries(${APP_NAME} jscocos2d)
127+
target_include_directories(${APP_NAME} PRIVATE ${RUNTIME_SRC_ROOT}/Classes)
128+
129+
# mark app resources, resource will be copy auto after mark
130+
setup_cocos_app_config(${APP_NAME})
131+
if(APPLE)
132+
set_target_properties(${APP_NAME} PROPERTIES RESOURCE "${APP_UI_RES}")
133+
if(MACOSX)
134+
set_target_properties(${APP_NAME} PROPERTIES
135+
MACOSX_BUNDLE_INFO_PLIST "${RUNTIME_SRC_ROOT}/proj.ios_mac/mac/Info.plist"
136+
)
137+
elseif(IOS)
138+
cocos_pak_xcode(${APP_NAME} INFO_PLIST "iOSBundleInfo.plist.in")
139+
set_xcode_property(${APP_NAME} ASSETCATALOG_COMPILER_APPICON_NAME "AppIcon")
140+
endif()
141+
elseif(WINDOWS)
142+
cocos_copy_target_dll(${APP_NAME} COPY_TO ${APP_RES_DIR}/..)
143+
endif()
144+
# copy resource on linux or WINDOWS
145+
if(LINUX OR WINDOWS)
146+
cocos_copy_res(COPY_TO ${APP_RES_DIR} FILES ${res_main_files})
147+
cocos_copy_res(COPY_TO ${APP_RES_DIR}/res FOLDERS ${res_res_folders})
148+
cocos_copy_res(COPY_TO ${APP_RES_DIR}/src FOLDERS ${res_src_folders})
149+
cocos_copy_res(COPY_TO ${APP_RES_DIR}/script FOLDERS ${res_script_folders})
150+
endif()
151+

frameworks/cocos2d-html5/.gitignore

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
lib
2+
/web.config
3+
.idea
4+
build
5+
aspnet_client
6+
node_modules
7+
/tools/jsdoc_toolkit-2.4.0
8+
/package
9+
/tools/jsdoc_toolkit/jsdoc_toolkit-2.4.0
10+
/.project

0 commit comments

Comments
 (0)