mirror of https://github.com/axmolengine/axmol.git
Solve the error in framework-compile tools.
This commit is contained in:
parent
0ac3da1636
commit
652aaf3bcd
|
@ -126,12 +126,25 @@ class CocosLibsCompiler(object):
|
||||||
if len(vs_cmd_info) == 0:
|
if len(vs_cmd_info) == 0:
|
||||||
raise CustomError('Not found available VS.', CustomError.ERROR_TOOLS_NOT_FOUND)
|
raise CustomError('Not found available VS.', CustomError.ERROR_TOOLS_NOT_FOUND)
|
||||||
|
|
||||||
|
cocos2d_proj_file = os.path.join(self.repo_x, 'cocos/2d/libcocos2d.vcxproj')
|
||||||
|
|
||||||
# get the VS projects info
|
# get the VS projects info
|
||||||
win32_proj_info = self.cfg_info[CocosLibsCompiler.KEY_VS_PROJS_INFO]
|
win32_proj_info = self.cfg_info[CocosLibsCompiler.KEY_VS_PROJS_INFO]
|
||||||
for vs_version in compile_vs_versions:
|
for vs_version in compile_vs_versions:
|
||||||
if not vs_version in vs_cmd_info.keys():
|
if not vs_version in vs_cmd_info.keys():
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
# rename the cocos2d project out dll name
|
||||||
|
f = open(cocos2d_proj_file, 'r')
|
||||||
|
old_file_content = f.read()
|
||||||
|
f.close()
|
||||||
|
|
||||||
|
new_file_content = old_file_content.replace('$(OutDir)$(ProjectName).dll', '$(OutDir)$(ProjectName)_%d.dll' % vs_version)
|
||||||
|
f = open(cocos2d_proj_file, 'w')
|
||||||
|
f.write(new_file_content)
|
||||||
|
f.close()
|
||||||
|
|
||||||
|
try:
|
||||||
vs_command = vs_cmd_info[vs_version]
|
vs_command = vs_cmd_info[vs_version]
|
||||||
for key in win32_proj_info.keys():
|
for key in win32_proj_info.keys():
|
||||||
# clean solutions
|
# clean solutions
|
||||||
|
@ -194,6 +207,13 @@ class CocosLibsCompiler(object):
|
||||||
if os.path.exists(dst_name):
|
if os.path.exists(dst_name):
|
||||||
os.remove(dst_name)
|
os.remove(dst_name)
|
||||||
os.rename(src_name, dst_name)
|
os.rename(src_name, dst_name)
|
||||||
|
except Exception as e:
|
||||||
|
raise e
|
||||||
|
finally:
|
||||||
|
f = open(cocos2d_proj_file, 'w')
|
||||||
|
f.write(old_file_content)
|
||||||
|
f.close()
|
||||||
|
|
||||||
|
|
||||||
print("Win32 build succeeded.")
|
print("Win32 build succeeded.")
|
||||||
|
|
||||||
|
|
|
@ -150,20 +150,21 @@ class TemplateModifier(object):
|
||||||
|
|
||||||
install_path = self.engine_path
|
install_path = self.engine_path
|
||||||
if self.is_for_package:
|
if self.is_for_package:
|
||||||
install_path = "$(COCOS_FRAMEWORKS)\\%s" % self.version
|
install_path = "$(COCOS_FRAMEWORKS)\\%s\\" % self.version
|
||||||
|
|
||||||
custom_step_event = vcx_proj.get_event_command('CustomBuildStep')
|
|
||||||
copy_libs_cmd = "if not exist \"$(OutDir)\" mkdir \"$(OutDir)\"\n" \
|
copy_libs_cmd = "if not exist \"$(OutDir)\" mkdir \"$(OutDir)\"\n" \
|
||||||
"xcopy /Y /Q \"$(EngineRoot)\\prebuilt\\win32\\*.*\" \"$(OutDir)\"\n"
|
"xcopy /Y /Q \"$(EngineRoot)\\prebuilt\\win32\\*.*\" \"$(OutDir)\"\n"
|
||||||
custom_step_event = copy_libs_cmd + custom_step_event
|
vcx_proj.set_event_command('PreLinkEvent', copy_libs_cmd, 'debug')
|
||||||
|
vcx_proj.set_event_command('PreLinkEvent', copy_libs_cmd, 'release')
|
||||||
|
|
||||||
if language == "js":
|
if language == "js":
|
||||||
vcx_proj.set_event_command('PreLinkEvent', '', create_new=False)
|
custom_step_event = vcx_proj.get_event_command('CustomBuildStep')
|
||||||
custom_step_event.replace("$(ProjectDir)..\\..\\cocos2d-x\\cocos\\scripting\\js-bindings\\script",
|
custom_step_event.replace("$(ProjectDir)..\\..\\cocos2d-x\\cocos\\scripting\\js-bindings\\script",
|
||||||
"$(ProjectDir)..\\..\\..\\script")
|
"$(ProjectDir)..\\..\\..\\script")
|
||||||
|
|
||||||
vcx_proj.set_event_command("CustomBuildStep", custom_step_event, create_new=False)
|
vcx_proj.set_event_command("CustomBuildStep", custom_step_event, create_new=False)
|
||||||
|
|
||||||
|
vcx_proj.remove_predefine_macro("_DEBUG", 'debug')
|
||||||
|
|
||||||
#
|
#
|
||||||
# copy_libs_cmd = "if not exist \"$(OutDir)\" mkdir \"$(OutDir)\"\n" \
|
# copy_libs_cmd = "if not exist \"$(OutDir)\" mkdir \"$(OutDir)\"\n" \
|
||||||
# "xcopy /Y /Q \"$(EngineRoot)tools\\framework-compile\\libs\\windows\\*.*\" \"$(OutDir)\"\n"
|
# "xcopy /Y /Q \"$(EngineRoot)tools\\framework-compile\\libs\\windows\\*.*\" \"$(OutDir)\"\n"
|
||||||
|
@ -179,9 +180,6 @@ class TemplateModifier(object):
|
||||||
# link_cmd = "libcmt.lib;%(IgnoreSpecificDefaultLibraries)"
|
# link_cmd = "libcmt.lib;%(IgnoreSpecificDefaultLibraries)"
|
||||||
# vcx_proj.set_item("Link", "IgnoreSpecificDefaultLibraries", link_cmd)
|
# vcx_proj.set_item("Link", "IgnoreSpecificDefaultLibraries", link_cmd)
|
||||||
#
|
#
|
||||||
# vcx_proj.remove_predefine_macro("_DEBUG")
|
|
||||||
#
|
|
||||||
#
|
|
||||||
# debug_prebuild = vcx_proj.get_event_command("PreBuildEvent", "debug")
|
# debug_prebuild = vcx_proj.get_event_command("PreBuildEvent", "debug")
|
||||||
# debug_prebuild = debug_prebuild.replace("$(ProjectDir)..\\..\\cocos2d-x\\cocos\\scripting\\js-bindings\\script",
|
# debug_prebuild = debug_prebuild.replace("$(ProjectDir)..\\..\\cocos2d-x\\cocos\\scripting\\js-bindings\\script",
|
||||||
# "$(ProjectDir)..\\..\\..\\script")
|
# "$(ProjectDir)..\\..\\..\\script")
|
||||||
|
@ -234,6 +232,8 @@ class TemplateModifier(object):
|
||||||
file_content = file_content.replace("MultiThreadedDebugDLL", "MultiThreadedDLL")
|
file_content = file_content.replace("MultiThreadedDebugDLL", "MultiThreadedDLL")
|
||||||
for str in replace_strs:
|
for str in replace_strs:
|
||||||
file_content = file_content.replace(str, install_path)
|
file_content = file_content.replace(str, install_path)
|
||||||
|
file_content = file_content.replace('%s\\' % install_path, install_path)
|
||||||
|
|
||||||
f = open(proj_file_path, "w")
|
f = open(proj_file_path, "w")
|
||||||
f.write(file_content)
|
f.write(file_content)
|
||||||
f.close()
|
f.close()
|
||||||
|
|
|
@ -147,6 +147,9 @@ class VCXProject(object):
|
||||||
cfg_nodes = self.root_node.getElementsByTagName("ItemDefinitionGroup")
|
cfg_nodes = self.root_node.getElementsByTagName("ItemDefinitionGroup")
|
||||||
for cfg_node in cfg_nodes:
|
for cfg_node in cfg_nodes:
|
||||||
if config is not None:
|
if config is not None:
|
||||||
|
if 'Condition' not in cfg_node.attributes.keys():
|
||||||
|
continue
|
||||||
|
|
||||||
cond_attr = cfg_node.attributes["Condition"].value
|
cond_attr = cfg_node.attributes["Condition"].value
|
||||||
if cond_attr.lower().find("debug") >= 0:
|
if cond_attr.lower().find("debug") >= 0:
|
||||||
cur_mode = "Debug"
|
cur_mode = "Debug"
|
||||||
|
@ -161,6 +164,12 @@ class VCXProject(object):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
cmd_node = self.get_or_create_node(event_node, "Command")
|
cmd_node = self.get_or_create_node(event_node, "Command")
|
||||||
|
if cmd_node.firstChild is None:
|
||||||
|
impl = minidom.getDOMImplementation()
|
||||||
|
dom = impl.createDocument(None, 'catalog', None)
|
||||||
|
nodeValue = dom.createTextNode(command)
|
||||||
|
cmd_node.appendChild(nodeValue)
|
||||||
|
else:
|
||||||
cmd_node.firstChild.nodeValue = command
|
cmd_node.firstChild.nodeValue = command
|
||||||
|
|
||||||
def get_node_if(self, parent, name):
|
def get_node_if(self, parent, name):
|
||||||
|
@ -210,13 +219,17 @@ class VCXProject(object):
|
||||||
def remove_predefine_macro(self, macro, config=None):
|
def remove_predefine_macro(self, macro, config=None):
|
||||||
cfg_nodes = self.root_node.getElementsByTagName("ItemDefinitionGroup")
|
cfg_nodes = self.root_node.getElementsByTagName("ItemDefinitionGroup")
|
||||||
for cfg_node in cfg_nodes:
|
for cfg_node in cfg_nodes:
|
||||||
|
if config is not None:
|
||||||
|
if 'Condition' not in cfg_node.attributes.keys():
|
||||||
|
continue
|
||||||
|
|
||||||
cond_attr = cfg_node.attributes["Condition"].value
|
cond_attr = cfg_node.attributes["Condition"].value
|
||||||
if cond_attr.lower().find("debug") >= 0:
|
if cond_attr.lower().find("debug") >= 0:
|
||||||
cur_mode = "Debug"
|
cur_mode = "Debug"
|
||||||
else:
|
else:
|
||||||
cur_mode = "Release"
|
cur_mode = "Release"
|
||||||
|
|
||||||
if (config is not None) and (cur_mode.lower() != config.lower()):
|
if (cur_mode.lower() != config.lower()):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
compile_node = self.get_or_create_node(cfg_node, "ClCompile")
|
compile_node = self.get_or_create_node(cfg_node, "ClCompile")
|
||||||
|
|
Loading…
Reference in New Issue