@@ -33,209 +33,57 @@ if(XCODE)
33
33
set (CMAKE_XCODE_GENERATE_TOP_LEVEL_PROJECT_ONLY TRUE )
34
34
endif ()
35
35
36
- # config quick starter batch script run.bat for windows
37
- if (WIN32 )
38
- file (RELATIVE_PATH CMAKE_BUILD_RELATIVE_DIR "${CMAKE_CURRENT_SOURCE_DIR} " "${PROJECT_BINARY_DIR} " )
39
- configure_file ("${CMAKE_CURRENT_SOURCE_DIR} /run.bat.in" "${CMAKE_CURRENT_SOURCE_DIR} /run.bat" @ONLY )
40
- endif ()
41
-
42
36
set (_is_axmol_embed FALSE )
43
- if (IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR} /axmol" )
44
- set (_AX_ROOT "${CMAKE_CURRENT_SOURCE_DIR} /axmol" )
45
- set (_is_axmol_embed TRUE )
46
- message (STATUS "Building isolated project: ${APP_NAME} " )
47
- else ()
48
- set (_AX_ROOT "$ENV{AX_ROOT} " )
49
- if (NOT (_AX_ROOT STREQUAL "" ))
50
- file (TO_CMAKE_PATH ${_AX_ROOT} _AX_ROOT )
51
- message (STATUS "Using system env var _AX_ROOT=${_AX_ROOT} " )
52
- else ()
53
- message (FATAL_ERROR "Please run setup.ps1 add system env var 'AX_ROOT' to specific the engine root" )
54
- endif ()
55
- endif ()
56
-
57
- set (CMAKE_MODULE_PATH ${_AX_ROOT} /cmake/Modules/ )
58
-
59
- include (AXBuildSet )
60
-
61
37
set (_AX_USE_PREBUILT FALSE )
62
38
63
- if (NOT _is_axmol_embed )
64
- if ((WIN32 OR LINUX ) AND DEFINED AX_PREBUILT_DIR AND IS_DIRECTORY ${_AX_ROOT} /${AX_PREBUILT_DIR} )
65
- set (_AX_USE_PREBUILT TRUE )
66
- endif ()
67
- endif ()
39
+ set (CMAKE_MODULE_PATH
40
+ ${CMAKE_CURRENT_SOURCE_DIR} /cmake/modules
41
+ )
68
42
69
- if (NOT _AX_USE_PREBUILT )
70
- add_subdirectory (${_AX_ROOT} /core ${ENGINE_BINARY_PATH} /axmol/core )
71
- endif ()
43
+ # NOTE: The order of the cmake module "include(AXGame...)" statements matters
44
+ include (AXGameEngineSetup )
72
45
73
46
# The common cross-platforms source files and header files
74
47
file (GLOB_RECURSE GAME_HEADER
75
48
Source /*.h Source /*.hpp
76
- )
49
+ )
50
+
77
51
file (GLOB_RECURSE GAME_SOURCE
78
52
Source /*.cpp Source /*.c
79
- )
53
+ )
80
54
81
55
set (GAME_INC_DIRS
82
- "${CMAKE_CURRENT_SOURCE_DIR} /Source"
56
+ "${CMAKE_CURRENT_SOURCE_DIR} /Source"
83
57
)
84
58
85
59
set (content_folder
86
60
"${CMAKE_CURRENT_SOURCE_DIR} /Content"
87
- )
61
+ )
88
62
89
63
if (APPLE )
90
64
ax_mark_multi_resources (common_content_files RES_TO "Resources" FOLDERS ${content_folder} )
91
65
elseif (WINDOWS )
92
66
ax_mark_multi_resources (common_content_files RES_TO "Content" FOLDERS ${content_folder} )
93
67
endif ()
94
68
95
- if (ANDROID )
96
- # the APP_NAME should match on AndroidManifest.xml
97
- list (APPEND GAME_SOURCE
98
- proj.android/app/jni/main.cpp
99
- )
100
- elseif (LINUX )
101
- list (APPEND GAME_SOURCE
102
- proj.linux/main.cpp
103
- )
104
- list (APPEND GAME_SOURCE ${common_content_files} )
105
- elseif (WASM )
106
- list (APPEND GAME_SOURCE
107
- proj.wasm/main.cpp
108
- )
109
- list (APPEND GAME_SOURCE ${common_content_files} )
110
- elseif (WINDOWS )
111
- if (NOT WINRT )
112
- list (APPEND GAME_HEADER
113
- proj.win32/main.h
114
- proj.win32/resource.h
115
- )
116
- list (APPEND GAME_SOURCE
117
- proj.win32/main.cpp
118
- proj.win32/game.rc
119
- )
120
- else ()
121
- ax_setup_winrt_sources ()
122
- endif ()
123
- list (APPEND GAME_SOURCE ${common_content_files} )
124
- elseif (APPLE )
125
- if (IOS )
126
- list (APPEND GAME_HEADER
127
- proj.ios_mac/ios/AppController.h
128
- proj.ios_mac/ios/RootViewController.h
129
- )
130
-
131
- if (TVOS )
132
- set (APP_UI_RES
133
- proj.ios_mac/ios/targets/tvos/LaunchScreenBackground.png
134
- proj.ios_mac/ios/targets/tvos/LaunchScreen.storyboard
135
- proj.ios_mac/ios/targets/tvos/Images.xcassets
136
- )
137
- else ()
138
- set (APP_UI_RES
139
- proj.ios_mac/ios/targets/ios/LaunchScreenBackground.png
140
- proj.ios_mac/ios/targets/ios/LaunchScreen.storyboard
141
- proj.ios_mac/ios/targets/ios/Images.xcassets
142
- )
143
- endif ()
144
-
145
- list (APPEND GAME_SOURCE
146
- proj.ios_mac/ios/main.m
147
- proj.ios_mac/ios/AppController.mm
148
- proj.ios_mac/ios/RootViewController.mm
149
- proj.ios_mac/ios/Prefix.pch
150
- ${APP_UI_RES}
151
- )
152
- elseif (MACOSX )
153
- set (APP_UI_RES
154
- proj.ios_mac/mac/Icon.icns
155
- )
156
- list (APPEND GAME_SOURCE
157
- proj.ios_mac/mac/main.cpp
158
- proj.ios_mac/mac/Prefix.pch
159
- ${APP_UI_RES}
160
- )
161
- endif ()
162
- list (APPEND GAME_SOURCE ${common_content_files} )
163
- endif ()
69
+ include (AXGameSourceSetup )
164
70
165
71
# mark app complie info and libs info
166
72
set (APP_SOURCES
167
73
${GAME_HEADER}
168
74
${GAME_SOURCE}
169
75
)
170
- if (NOT ANDROID )
171
- add_executable (${APP_NAME} ${APP_SOURCES} )
172
- else ()
173
- add_library (${APP_NAME} SHARED ${APP_SOURCES} )
174
- # whole archive for jni
175
- target_link_libraries (${APP_NAME} -Wl,--whole-archive cpp_android_spec -Wl,--no-whole-archive )
176
- config_android_shared_libs ("dev.axmol.lib" "${CMAKE_CURRENT_SOURCE_DIR} /proj.android/app/src" )
177
- endif ()
178
-
179
- if (NOT _AX_USE_PREBUILT )
180
- target_link_libraries (${APP_NAME} ${_AX_CORE_LIB} )
181
- endif ()
182
-
183
- # The optional thirdparties(not dependent by engine)
184
- if (AX_WITH_YAML_CPP )
185
- list (APPEND GAME_INC_DIRS "${_AX_ROOT} /3rdparty/yaml-cpp/include" )
186
- endif ()
187
-
188
- target_include_directories (${APP_NAME} PRIVATE ${GAME_INC_DIRS} )
189
76
77
+ include (AXGameTargetSetup )
190
78
191
79
# mark app resources, resource will be copy auto after mark
192
80
ax_setup_app_config (${APP_NAME} )
193
81
194
- if (APPLE )
195
- set_target_properties (${APP_NAME} PROPERTIES RESOURCE "${APP_UI_RES} " )
196
- set_xcode_property (${APP_NAME} INSTALL_PATH "\$ (LOCAL_APPS_DIR)" )
197
- set_xcode_property (${APP_NAME} PRODUCT_BUNDLE_IDENTIFIER "dev.axmol.dummy" )
198
-
199
- if (MACOSX )
200
- set_target_properties (${APP_NAME} PROPERTIES MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR} /proj.ios_mac/mac/Info.plist" )
201
- elseif (TVOS )
202
- set_target_properties (${APP_NAME} PROPERTIES MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR} /proj.ios_mac/ios/targets/tvos/Info.plist" )
203
- set_xcode_property (${APP_NAME} ASSETCATALOG_COMPILER_APPICON_NAME "Brand Assets" )
204
- elseif (IOS )
205
- set_target_properties (${APP_NAME} PROPERTIES MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR} /proj.ios_mac/ios/targets/ios/Info.plist" )
206
- set_xcode_property (${APP_NAME} ASSETCATALOG_COMPILER_APPICON_NAME "AppIcon" )
207
- set_xcode_property (${APP_NAME} TARGETED_DEVICE_FAMILY "1,2" )
208
- endif ()
209
-
210
- # For code-signing, set the DEVELOPMENT_TEAM:
211
- #set_xcode_property(${APP_NAME} DEVELOPMENT_TEAM "GRLXXXX2K9")
212
- elseif (WINDOWS )
213
- if (NOT _AX_USE_PREBUILT )
214
- ax_sync_target_dlls (${APP_NAME} )
215
- endif ()
216
- endif ()
82
+ # Add any libraries you need to link to the project after this point
217
83
218
- if ((NOT APPLE ) AND (NOT WINRT ))
219
- ax_get_resource_path (APP_RES_DIR ${APP_NAME} )
220
- ax_sync_target_res (${APP_NAME} LINK_TO ${APP_RES_DIR} FOLDERS ${content_folder} SYM_LINK 1 )
221
-
222
- if ((WINDOWS AND (NOT (CMAKE_GENERATOR MATCHES "Ninja" ))))
223
- set_property (TARGET ${APP_NAME} PROPERTY VS_DEBUGGER_WORKING_DIRECTORY "${content_folder} " )
224
- if (NOT DEFINED BUILD_ENGINE_DONE )
225
- set_property (DIRECTORY PROPERTY VS_STARTUP_PROJECT ${APP_NAME} )
226
- endif ()
227
- endif ()
228
- elseif (WINRT )
229
- if (NOT DEFINED BUILD_ENGINE_DONE )
230
- set_property (DIRECTORY PROPERTY VS_STARTUP_PROJECT ${APP_NAME} )
231
- endif ()
232
- endif ()
233
-
234
- if (_AX_USE_PREBUILT ) # support windows and linux
235
- use_ax_compile_define (${APP_NAME} )
236
84
237
- include (AXLinkHelpers )
238
- ax_link_cxx_prebuilt (${APP_NAME} ${_AX_ROOT} ${AX_PREBUILT_DIR} )
239
- endif ()
85
+ # Default Platform-specific setup
86
+ include (AXGamePlatformSetup )
240
87
241
- ax_setup_app_props (${APP_NAME} )
88
+ # Make sure the AXGameFinalSetup is included at the end of this file
89
+ include (AXGameFinalSetup )
0 commit comments