Skip to content

Commit 4c2c3e6

Browse files
author
minggo
authored
Modify for metal support (#453)
* work on mac * console work on windows
1 parent 643f423 commit 4c2c3e6

File tree

4 files changed

+127
-830
lines changed

4 files changed

+127
-830
lines changed

bin/cocos_project.py

Lines changed: 33 additions & 161 deletions
Original file line numberDiff line numberDiff line change
@@ -196,8 +196,6 @@ class Platforms(object):
196196
WEB = 'web'
197197
WIN32 = 'win32'
198198
LINUX = 'linux'
199-
METRO = "metro"
200-
TIZEN = "tizen"
201199

202200
CFG_CLASS_MAP = {
203201
ANDROID : "cocos_project.AndroidConfig",
@@ -206,8 +204,6 @@ class Platforms(object):
206204
WEB : "cocos_project.WebConfig",
207205
WIN32 : "cocos_project.Win32Config",
208206
LINUX : "cocos_project.LinuxConfig",
209-
METRO : "cocos_project.MetroConfig",
210-
TIZEN : "cocos_project.TizenConfig"
211207
}
212208

213209
@staticmethod
@@ -237,10 +233,9 @@ def __init__(self, project, current, proj_dir = None):
237233
def _filter_platforms(self, platforms):
238234
ret = []
239235
platforms_for_os = {
240-
"linux" : [ Platforms.WEB, Platforms.LINUX, Platforms.ANDROID, Platforms.TIZEN ],
241-
"mac" : [ Platforms.WEB, Platforms.IOS, Platforms.MAC, Platforms.ANDROID, Platforms.TIZEN ],
242-
"win32" : [ Platforms.WEB, Platforms.WIN32, Platforms.ANDROID,
243-
Platforms.METRO, Platforms.TIZEN ]
236+
"linux" : [ Platforms.WEB, Platforms.LINUX, Platforms.ANDROID ],
237+
"mac" : [ Platforms.WEB, Platforms.IOS, Platforms.MAC, Platforms.ANDROID ],
238+
"win32" : [ Platforms.WEB, Platforms.WIN32, Platforms.ANDROID ]
244239
}
245240
for p in platforms:
246241
if cocos.os_is_linux():
@@ -259,22 +254,22 @@ def _gen_available_platforms(self, proj_info, proj_dir):
259254
# generate the platform list for different projects
260255
if self._project._is_lua_project():
261256
if self._project._is_native_support():
262-
platform_list = [ Platforms.ANDROID, Platforms.WIN32, Platforms.IOS, Platforms.MAC, Platforms.LINUX, Platforms.TIZEN ]
257+
platform_list = [ Platforms.ANDROID, Platforms.WIN32, Platforms.IOS, Platforms.MAC, Platforms.LINUX ]
263258
else:
264259
if self._project.has_android_libs():
265260
platform_list = [ Platforms.ANDROID ]
266261
else:
267262
platform_list = []
268263
elif self._project._is_js_project():
269264
if self._project._is_native_support():
270-
platform_list = [ Platforms.ANDROID, Platforms.WIN32, Platforms.IOS, Platforms.MAC, Platforms.WEB, Platforms.LINUX, Platforms.METRO, Platforms.TIZEN ]
265+
platform_list = [ Platforms.ANDROID, Platforms.WIN32, Platforms.IOS, Platforms.MAC, Platforms.WEB, Platforms.LINUX ]
271266
else:
272267
if self._project.has_android_libs():
273268
platform_list = [ Platforms.ANDROID, Platforms.WEB ]
274269
else:
275270
platform_list = [ Platforms.WEB ]
276271
elif self._project._is_cpp_project():
277-
platform_list = [ Platforms.ANDROID, Platforms.WIN32, Platforms.IOS, Platforms.MAC, Platforms.LINUX, Platforms.METRO, Platforms.TIZEN ]
272+
platform_list = [ Platforms.ANDROID, Platforms.WIN32, Platforms.IOS, Platforms.MAC, Platforms.LINUX ]
278273

279274
# filter the available platform list
280275
platform_list = self._filter_platforms(platform_list)
@@ -331,12 +326,6 @@ def is_win32_active(self):
331326
def is_linux_active(self):
332327
return self._current == Platforms.LINUX
333328

334-
def is_metro_active(self):
335-
return self._current == Platforms.METRO
336-
337-
def is_tizen_active(self):
338-
return self._current == Platforms.TIZEN
339-
340329
def get_current_config(self):
341330
if self.none_active():
342331
return None
@@ -403,108 +392,6 @@ def _is_available(self):
403392
proj_android_existed = super(AndroidConfig, self)._is_available()
404393
return proj_android_existed
405394

406-
class iOSConfig(PlatformConfig):
407-
KEY_PROJ_FILE = "project_file"
408-
KEY_TARGET_NAME = "target_name"
409-
410-
def _use_default(self):
411-
if self._is_script:
412-
self.proj_path = os.path.join(self._proj_root_path, "frameworks", "runtime-src", "proj.ios_mac")
413-
else:
414-
self.proj_path = os.path.join(self._proj_root_path, "proj.ios_mac")
415-
416-
self.proj_file = None
417-
self.target_name = None
418-
419-
def _parse_info(self, cfg_info):
420-
super(iOSConfig, self)._parse_info(cfg_info)
421-
if cfg_info.has_key(iOSConfig.KEY_PROJ_FILE):
422-
self.proj_file = cfg_info[iOSConfig.KEY_PROJ_FILE]
423-
else:
424-
self.proj_file = None
425-
426-
if cfg_info.has_key(iOSConfig.KEY_TARGET_NAME):
427-
self.target_name = cfg_info[iOSConfig.KEY_TARGET_NAME]
428-
else:
429-
self.target_name = None
430-
431-
def _is_available(self):
432-
ret = super(iOSConfig, self)._is_available()
433-
434-
return ret
435-
436-
class MacConfig(PlatformConfig):
437-
438-
def _use_default(self):
439-
if self._is_script:
440-
self.proj_path = os.path.join(self._proj_root_path, "frameworks", "runtime-src", "proj.ios_mac")
441-
else:
442-
self.proj_path = os.path.join(self._proj_root_path, "proj.ios_mac")
443-
444-
self.proj_file = None
445-
self.target_name = None
446-
447-
def _parse_info(self, cfg_info):
448-
super(MacConfig, self)._parse_info(cfg_info)
449-
if cfg_info.has_key(iOSConfig.KEY_PROJ_FILE):
450-
self.proj_file = cfg_info[iOSConfig.KEY_PROJ_FILE]
451-
else:
452-
self.proj_file = None
453-
454-
if cfg_info.has_key(iOSConfig.KEY_TARGET_NAME):
455-
self.target_name = cfg_info[iOSConfig.KEY_TARGET_NAME]
456-
else:
457-
self.target_name = None
458-
459-
def _is_available(self):
460-
ret = super(MacConfig, self)._is_available()
461-
462-
return ret
463-
464-
class Win32Config(PlatformConfig):
465-
KEY_SLN_FILE = "sln_file"
466-
KEY_PROJECT_NAME = "project_name"
467-
KEY_BUILD_CFG_PATH = "build_cfg_path"
468-
KEY_EXE_OUT_DIR = "exe_out_dir"
469-
470-
def _use_default(self):
471-
if self._is_script:
472-
self.proj_path = os.path.join(self._proj_root_path, "frameworks", "runtime-src", "proj.win32")
473-
else:
474-
self.proj_path = os.path.join(self._proj_root_path, "proj.win32")
475-
476-
self.sln_file = None
477-
self.project_name =None
478-
self.build_cfg_path = None
479-
self.exe_out_dir = None
480-
481-
def _parse_info(self, cfg_info):
482-
super(Win32Config, self)._parse_info(cfg_info)
483-
if cfg_info.has_key(Win32Config.KEY_SLN_FILE):
484-
self.sln_file = cfg_info[Win32Config.KEY_SLN_FILE]
485-
else:
486-
self.sln_file = None
487-
488-
if cfg_info.has_key(Win32Config.KEY_PROJECT_NAME):
489-
self.project_name = cfg_info[Win32Config.KEY_PROJECT_NAME]
490-
else:
491-
self.project_name = None
492-
493-
if cfg_info.has_key(Win32Config.KEY_BUILD_CFG_PATH):
494-
self.build_cfg_path = cfg_info[Win32Config.KEY_BUILD_CFG_PATH]
495-
else:
496-
self.build_cfg_path = None
497-
498-
if cfg_info.has_key(Win32Config.KEY_EXE_OUT_DIR):
499-
self.exe_out_dir = cfg_info[Win32Config.KEY_EXE_OUT_DIR]
500-
else:
501-
self.exe_out_dir = None
502-
503-
def _is_available(self):
504-
ret = super(Win32Config, self)._is_available()
505-
506-
return ret
507-
508395
class LinuxConfig(PlatformConfig):
509396
KEY_CMAKE_PATH = "cmake_path"
510397
KEY_BUILD_DIR = "build_dir"
@@ -549,6 +436,33 @@ def _is_available(self):
549436

550437
return ret
551438

439+
class MacConfig(LinuxConfig):
440+
def _use_default(self):
441+
super(MacConfig, self)._use_default()
442+
443+
if self._is_script:
444+
self.proj_path = os.path.join(self._proj_root_path, "frameworks", "runtime-src", "proj.mac")
445+
else:
446+
self.proj_path = os.path.join(self._proj_root_path, "proj.mac")
447+
448+
class iOSConfig(LinuxConfig):
449+
def _use_default(self):
450+
super(MacConfig, self)._use_default()
451+
452+
if self._is_script:
453+
self.proj_path = os.path.join(self._proj_root_path, "frameworks", "runtime-src", "proj.ios")
454+
else:
455+
self.proj_path = os.path.join(self._proj_root_path, "proj.ios")
456+
457+
class Win32Config(LinuxConfig):
458+
def _use_default(self):
459+
super(MacConfig, self)._use_default()
460+
461+
if self._is_script:
462+
self.proj_path = os.path.join(self._proj_root_path, "frameworks", "runtime-src", "proj.win32")
463+
else:
464+
self.proj_path = os.path.join(self._proj_root_path, "proj.win32")
465+
552466
class WebConfig(PlatformConfig):
553467
KEY_SUB_URL = "sub_url"
554468
KEY_RUN_ROOT_DIR = "run_root_dir"
@@ -585,45 +499,3 @@ def _is_available(self):
585499
ret = os.path.isfile(index_path)
586500

587501
return ret
588-
589-
class MetroConfig(PlatformConfig):
590-
def _use_default(self):
591-
if self._is_script:
592-
self.proj_path = os.path.join(self._proj_root_path, "frameworks", "runtime-src", "proj.win8.1-universal")
593-
else:
594-
self.proj_path = os.path.join(self._proj_root_path, "proj.win8.1-universal")
595-
596-
self.sln_file = None
597-
self.project_name =None
598-
599-
def _parse_info(self, cfg_info):
600-
super(MetroConfig, self)._parse_info(cfg_info)
601-
if cfg_info.has_key(Win32Config.KEY_SLN_FILE):
602-
self.sln_file = cfg_info[Win32Config.KEY_SLN_FILE]
603-
else:
604-
self.sln_file = None
605-
606-
if cfg_info.has_key(Win32Config.KEY_PROJECT_NAME):
607-
self.project_name = cfg_info[Win32Config.KEY_PROJECT_NAME]
608-
else:
609-
self.project_name = None
610-
611-
def _is_available(self):
612-
ret = super(MetroConfig, self)._is_available()
613-
614-
return ret
615-
616-
class TizenConfig(PlatformConfig):
617-
def _use_default(self):
618-
if self._is_script:
619-
self.proj_path = os.path.join(self._proj_root_path, "frameworks", "runtime-src", "proj.tizen")
620-
else:
621-
self.proj_path = os.path.join(self._proj_root_path, "proj.tizen")
622-
623-
def _parse_info(self, cfg_info):
624-
super(TizenConfig, self)._parse_info(cfg_info)
625-
626-
def _is_available(self):
627-
ret = super(TizenConfig, self)._is_available()
628-
629-
return ret

0 commit comments

Comments
 (0)