From c02679fd9e3e2731ced69afa3252ef291bb50353 Mon Sep 17 00:00:00 2001 From: yyc12345 Date: Sun, 19 Feb 2023 11:49:25 +0800 Subject: [PATCH] promote cfg maker --- GPVirtoolsStatic/GPVirtoolsStatic.vcxproj | 227 ++++++++++ .../GPVirtoolsStatic.vcxproj.filters | 411 ++++++++++++++++++ GPVirtoolsStatic/Virtools.props | 14 + mk_materializer_cfg.py => MkMtlCfg.py | 234 +++------- Scripts/VSProp.py | 127 ++++++ SuperScriptMaterializer.sln | 8 + .../SuperScriptMaterializer.vcxproj | 64 ++- 7 files changed, 887 insertions(+), 198 deletions(-) create mode 100644 GPVirtoolsStatic/GPVirtoolsStatic.vcxproj create mode 100644 GPVirtoolsStatic/GPVirtoolsStatic.vcxproj.filters create mode 100644 GPVirtoolsStatic/Virtools.props rename mk_materializer_cfg.py => MkMtlCfg.py (50%) create mode 100644 Scripts/VSProp.py diff --git a/GPVirtoolsStatic/GPVirtoolsStatic.vcxproj b/GPVirtoolsStatic/GPVirtoolsStatic.vcxproj new file mode 100644 index 0000000..864b159 --- /dev/null +++ b/GPVirtoolsStatic/GPVirtoolsStatic.vcxproj @@ -0,0 +1,227 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + 16.0 + Win32Proj + {38703ab6-bc5d-4062-bc5b-1bf195333b16} + GPVirtoolsStatic + 10.0 + + + + StaticLibrary + true + v142 + MultiByte + Dynamic + + + StaticLibrary + false + v142 + true + MultiByte + Dynamic + + + + + + + + + + + + + + + + + true + $(SolutionDir)out\$(Platform)\$(Configuration)\$(ProjectName)\ + $(SolutionDir)temp\$(Platform)\$(Configuration)\$(ProjectName)\ + + + false + $(SolutionDir)out\$(Platform)\$(Configuration)\$(ProjectName)\ + $(SolutionDir)temp\$(Platform)\$(Configuration)\$(ProjectName)\ + + + + Level3 + true + BML_EXPORT=;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + false + stdcpp17 + + + Console + true + + + + + Level3 + true + true + true + BML_EXPORT=;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + false + stdcpp17 + + + Console + true + true + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/GPVirtoolsStatic/GPVirtoolsStatic.vcxproj.filters b/GPVirtoolsStatic/GPVirtoolsStatic.vcxproj.filters new file mode 100644 index 0000000..ebfdb1f --- /dev/null +++ b/GPVirtoolsStatic/GPVirtoolsStatic.vcxproj.filters @@ -0,0 +1,411 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + \ No newline at end of file diff --git a/GPVirtoolsStatic/Virtools.props b/GPVirtoolsStatic/Virtools.props new file mode 100644 index 0000000..79800c3 --- /dev/null +++ b/GPVirtoolsStatic/Virtools.props @@ -0,0 +1,14 @@ + + + + + D:\BallanceModLoader + + + + + + $(BML_REPOSITORY) + + + diff --git a/mk_materializer_cfg.py b/MkMtlCfg.py similarity index 50% rename from mk_materializer_cfg.py rename to MkMtlCfg.py index 03bc287..a486156 100644 --- a/mk_materializer_cfg.py +++ b/MkMtlCfg.py @@ -1,5 +1,4 @@ -import xml.dom.minidom as minidom -import xml.dom +import Scripts.VSProp as VSProp import os import sys @@ -26,20 +25,21 @@ virtools_attached_lib_standalone_dict = { "40": "vxmath.lib;ck2.lib", "50": "vxmath.lib;ck2.lib" } +virtools_gp_static_proj = 'GPVirtoolsStatic' virtools_std_macro_plugin_dict = { - "21": "", - "25": "", - "35": "_CRT_SECURE_NO_WARNINGS", - "40": "_CRT_SECURE_NO_WARNINGS", - "50": "" + "21": "_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE", + "25": "_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE", + "35": "_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE", + "40": "_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE", + "50": "_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE" } virtools_std_macro_standalone_dict = { - "21": "_DEBUG", - "25": "_CRT_SECURE_NO_WARNINGS;_DEBUG", - "35": "_CRT_SECURE_NO_WARNINGS;_DEBUG", - "40": "_CRT_SECURE_NO_WARNINGS;_DEBUG", - "50": "VIRTOOLS_USER_SDK;_DEBUG" + "21": "_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_DEBUG", + "25": "_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_DEBUG", + "35": "_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_DEBUG", + "40": "_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_DEBUG", + "50": "_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;VIRTOOLS_USER_SDK;_DEBUG" } executable_virtools = { @@ -69,31 +69,6 @@ valid_vt21_reverse_work_type = ( ) # ======================== assist func -def write_macro(dom, node_property_group, node_item_group, macro_upcase, data): - node = dom.createElement(macro_upcase) - if data != '': - node.appendChild(dom.createTextNode(data)) - node_property_group.appendChild(node) - - node = dom.createElement("BuildMacro") - node.setAttribute('Include', macro_upcase) - inter_node = dom.createElement('Value') - inter_node.appendChild(dom.createTextNode("$({})".format(macro_upcase))) - node.appendChild(inter_node) - node_item_group.appendChild(node) - -def write_cl(dom, node_include, node_compile, filename): - if filename.endswith('.h'): - cl = dom.createElement('ClInclude') - node = node_include - elif filename.endswith('.cpp'): - cl = dom.createElement('ClCompile') - node = node_compile - else: - return - cl.setAttribute('Include', filename) - node.appendChild(cl) - def get_executable_virtools(vt_ver): if vt_ver == '21': return 'Dev.exe' @@ -187,20 +162,24 @@ if input_build_type == build_type_plugin: virtools_build_type = 'VIRTOOLS_PLUGIN' virtools_build_suffix = 'dll' virtools_module_define = 'SuperScriptMaterializer.def' - virtools_attached_lib = virtools_attached_lib_plugin_dict[input_virtools_version] virtools_std_macro = virtools_std_macro_plugin_dict[input_virtools_version] + virtools_attached_lib = virtools_attached_lib_plugin_dict[input_virtools_version] elif input_build_type == build_type_standalone: virtools_build_type = 'VIRTOOLS_STANDALONE' virtools_build_suffix = 'exe' virtools_module_define = '' - virtools_attached_lib = virtools_attached_lib_standalone_dict[input_virtools_version] virtools_std_macro = virtools_std_macro_standalone_dict[input_virtools_version] + # gamepiaynmo linked lib need special lib name + if input_virtools_version == '21' and input_vt21_reverse_work_type == 'gamepiaynmo': + virtools_attached_lib = virtools_gp_static_proj + '.lib' + else: + virtools_attached_lib = virtools_attached_lib_standalone_dict[input_virtools_version] # debug configuration and output path if input_virtools_version == '21': # virtools 21 onlt allow standalone build type # we copy it and specific some field - virtools_debug_root = iinput_vt21_runtime_path + virtools_debug_root = input_vt21_runtime_path virtools_debug_commandline = 'test.nmo test_script.db test_env.db' virtools_debug_target = os.path.join(input_vt21_runtime_path, 'SuperScriptMaterializer.exe') virtools_output_path = input_vt21_runtime_path @@ -234,9 +213,9 @@ if input_virtools_version == '21': else: # gamepiaynmo need a special macro but his proj do not need any link, # instead, we need compile it fully which will be implemented in following code - bml_special_macro = 'BML_EXPORT=' + virtools_extra_macro = 'BML_EXPORT=' virtools_header_path = os.path.join(input_vt21_reverse_work_path, 'virtools') - virtools_lib_path = '' + virtools_lib_path = '$(SolutionDir)out\\$(Platform)\\$(Configuration)\\' + virtools_gp_static_proj else: virtools_extra_macro = '' if input_virtools_version == '25': @@ -245,135 +224,60 @@ else: else: virtools_header_path = os.path.join(input_virtools_root_path, 'Sdk/Includes') virtools_lib_path = os.path.join(input_virtools_root_path, 'Sdk/Lib/Win32/Release') - - -# ======================== create document - -# create header -dom = minidom.getDOMImplementation().createDocument(None, 'Project', None) -root = dom.documentElement -root.setAttribute('ToolsVersion', '4.0') -root.setAttribute('xmlns', 'http://schemas.microsoft.com/developer/msbuild/2003') - -cache = dom.createElement('ImportGroup') -cache.setAttribute('Label', 'PropertySheets') -root.appendChild(cache) - -# ======================== write build type -# due to build chain v100 shit design, this configuration onlt can be modified in .vcxproj -# so these code were annotated -''' -for bt in ('Debug', 'Release'): - node_build_type = dom.createElement('PropertyGroup') - node_build_type.setAttribute('Label', 'Configuration') - node_build_type.setAttribute('Condition', "'$(Configuration)|$(Platform)'=='{}|Win32'".format(bt)) - node_configuration_type = dom.createElement('ConfigurationType') - if input_build_type == build_type_standalone: - node_configuration_type.appendChild(dom.createTextNode('Application')) - elif input_build_type == build_type_plugin: - node_configuration_type.appendChild(dom.createTextNode('DynamicLibrary')) - node_build_type.appendChild(node_configuration_type) - root.appendChild(node_build_type) -''' - -# ======================== write subsystem -for bt in ('Debug', 'Release'): - node_item_def = dom.createElement('ItemDefinitionGroup') - node_item_def.setAttribute('Condition', "'$(Configuration)|$(Platform)'=='{}|Win32'".format(bt)) - - node_item_def_link = dom.createElement('Link') - node_sub_system = dom.createElement('SubSystem') - - if input_build_type == build_type_standalone: - node_sub_system.appendChild(dom.createTextNode('Console')) - elif input_build_type == build_type_plugin: - node_sub_system.appendChild(dom.createTextNode('Windows')) - - node_item_def_link.appendChild(node_sub_system) - node_item_def.appendChild(node_item_def_link) - root.appendChild(node_item_def) - -# ======================== write macro and misc -node_property_group = dom.createElement('PropertyGroup') -node_property_group.setAttribute('Label', 'UserMacros') -root.appendChild(node_property_group) - -cache = dom.createElement('PropertyGroup') -root.appendChild(cache) - -cache = dom.createElement('ItemDefinitionGroup') -root.appendChild(cache) - -node_item_group = dom.createElement('ItemGroup') -root.appendChild(node_item_group) - -# build type distinguish macro -write_macro(dom, node_property_group, node_item_group, 'VIRTOOLS_VER', virtools_ver) -write_macro(dom, node_property_group, node_item_group, 'VIRTOOLS_BUILD_TYPE', virtools_build_type) -# header and libs -write_macro(dom, node_property_group, node_item_group, 'VIRTOOLS_HEADER_PATH', virtools_header_path) -write_macro(dom, node_property_group, node_item_group, 'VIRTOOLS_LIB_PATH', virtools_lib_path) -write_macro(dom, node_property_group, node_item_group, 'VIRTOOLS_LIB_FILENAME', virtools_attached_lib) -write_macro(dom, node_property_group, node_item_group, 'SQLITE_HEADER_PATH', sqlite_header_path) -write_macro(dom, node_property_group, node_item_group, 'SQLITE_LIB_PATH', sqlite_lib_path) -write_macro(dom, node_property_group, node_item_group, 'SQLITE_LIB_FILENAME', sqlite_lib_filename) -# output and debug -write_macro(dom, node_property_group, node_item_group, 'VIRTOOLS_OUTPUT_PATH', virtools_output_path) -write_macro(dom, node_property_group, node_item_group, 'VIRTOOLS_DEBUG_TARGET', virtools_debug_target) -write_macro(dom, node_property_group, node_item_group, 'VIRTOOLS_DEBUG_ROOT', virtools_debug_root) -write_macro(dom, node_property_group, node_item_group, 'VIRTOOLS_DEBUG_COMMANDLINE', virtools_debug_commandline) -# essential build macro -write_macro(dom, node_property_group, node_item_group, 'VIRTOOLS_STD_MACRO', virtools_std_macro) -write_macro(dom, node_property_group, node_item_group, 'VIRTOOLS_EXTRA_MACRO', virtools_extra_macro) -# misc macro -write_macro(dom, node_property_group, node_item_group, 'VIRTOOLS_BUILD_SUFFIX', virtools_build_suffix) -write_macro(dom, node_property_group, node_item_group, 'VIRTOOLS_MODULE_DEFINE', virtools_module_define) - -# ======================== write extra compile - -# if we using gamepiaynmp vt21 reverse work -# we need add all his cpp file into our compile list -if input_virtools_version == '21' and input_vt21_reverse_work_type == 'gamepiaynmo': - header_item_group = dom.createElement('ItemGroup') - cpp_item_group = dom.createElement('ItemGroup') - bml_virtools_path = os.path.join(input_vt21_reverse_work_path, 'virtools') - for folderName, subfolders, filenames in os.walk(bml_virtools_path): - for filename in filenames: - write_cl(dom, header_item_group, cpp_item_group, os.path.join(folderName, filename)) - - root.appendChild(header_item_group) - root.appendChild(cpp_item_group) -# ======================== output -with open('./SuperScriptMaterializer/Virtools.props', 'w', encoding='utf-8') as f: - dom.writexml(f, addindent='\t', newl='\n', encoding='utf-8') +# ======================== create props -# ======================== modify .vcxproj -# due to build chain v100 shit design, this configuration onlt can be modified in .vcxproj +props = VSProp.VSPropWriter() +vcxproj = VSProp.VSVcxprojModifier('./SuperScriptMaterializer/SuperScriptMaterializer.vcxproj') + +# write build type if input_build_type == build_type_standalone: - vcxproj_build_type = 'Application' + vcxproj.SetBuildType(vcxproj.BUILDTYPE_EXE) elif input_build_type == build_type_plugin: - vcxproj_build_type = 'DynamicLibrary' + vcxproj.SetBuildType(vcxproj.BUILDTYPE_DLL) -vcxproj = minidom.parse('./SuperScriptMaterializer/SuperScriptMaterializer.vcxproj') -node_project = vcxproj.documentElement -for item in node_project.getElementsByTagName('PropertyGroup'): - attr_label = item.getAttribute('Label') - attr_condition = item.getAttribute('Condition') - if attr_label == 'Configuration' and (attr_condition == "'$(Configuration)|$(Platform)'=='Debug|Win32'" or attr_condition == "'$(Configuration)|$(Platform)'=='Release|Win32'"): - # valid node - node_cfg_type = item.getElementsByTagName('ConfigurationType') - if len(node_cfg_type) != 0: - # have node, change it - node_cfg_type[0].childNodes[0].nodeValue = vcxproj_build_type - else: - # don't have node, add one - node_cfg_type = vcxproj.createElement('ConfigurationType') - node_cfg_type.appendChild(vcxproj.createTextNode(vcxproj_build_type)) - item.appendChild(node_cfg_type) +# write subsystem +if input_build_type == build_type_standalone: + props.SetSubSystem(props.SUBSYSTEM_CON); +elif input_build_type == build_type_plugin: + props.SetSubSystem(props.SUBSYSTEM_WIN) -with open('./SuperScriptMaterializer/SuperScriptMaterializer.vcxproj', 'w', encoding='utf-8') as f: - vcxproj.writexml(f, encoding='utf-8') +# write macro and misc +# build type distinguish macro +props.AddMacro('VIRTOOLS_VER', virtools_ver) +props.AddMacro('VIRTOOLS_BUILD_TYPE', virtools_build_type) +# header and libs +props.AddMacro('VIRTOOLS_HEADER_PATH', virtools_header_path) +props.AddMacro('VIRTOOLS_LIB_PATH', virtools_lib_path) +props.AddMacro('VIRTOOLS_LIB_FILENAME', virtools_attached_lib) +props.AddMacro('SQLITE_HEADER_PATH', sqlite_header_path) +props.AddMacro('SQLITE_LIB_PATH', sqlite_lib_path) +props.AddMacro('SQLITE_LIB_FILENAME', sqlite_lib_filename) +# output and debug +props.AddMacro('VIRTOOLS_OUTPUT_PATH', virtools_output_path) +props.AddMacro('VIRTOOLS_DEBUG_TARGET', virtools_debug_target) +props.AddMacro('VIRTOOLS_DEBUG_ROOT', virtools_debug_root) +props.AddMacro('VIRTOOLS_DEBUG_COMMANDLINE', virtools_debug_commandline) +# essential build macro +props.AddMacro('VIRTOOLS_STD_MACRO', virtools_std_macro) +props.AddMacro('VIRTOOLS_EXTRA_MACRO', virtools_extra_macro) +# misc macro +props.AddMacro('VIRTOOLS_BUILD_SUFFIX', virtools_build_suffix) +props.AddMacro('VIRTOOLS_MODULE_DEFINE', virtools_module_define) + +# output +props.Write2File('./SuperScriptMaterializer/Virtools.props') +vcxproj.Write2File() + +# ======================== create vt21 props + +# if we are using virtools 2.1. and we use gamepiaynmo as our +# reverse library. we need enable project GPVirtoolsStatic and +# add some macro for it +if input_virtools_version == '21' and input_vt21_reverse_work_type == 'gamepiaynmo': + gp_props = VSProp.VSPropWriter() + gp_props.AddMacro('BML_REPOSITORY', input_vt21_reverse_work_path) + gp_props.Write2File('./GPVirtoolsStatic/Virtools.props') print("OK!") diff --git a/Scripts/VSProp.py b/Scripts/VSProp.py new file mode 100644 index 0000000..f2b6466 --- /dev/null +++ b/Scripts/VSProp.py @@ -0,0 +1,127 @@ +import xml.dom.minidom as minidom +import xml.dom +import os +import sys + +class VSPropWriter(object): + + SUBSYSTEM_WIN: str = 'Windows' + SUBSYSTEM_CON: str = 'Console' + + def __init__(self): + self.__MacroList: dict[str, str] = {} + self.__SubSystem: str = None + self.__BuildType: str = None + + def AddMacro(self, key: str, value: str): + if (key in self.__MacroList): + raise Exception(f'Duplicated Set Macro "{key}".') + self.__MacroList[key] = value + + def SetSubSystem(self, subsys: str): + self.__SubSystem = subsys + + def Write2File(self, filename: str): + # create some header + dom = minidom.getDOMImplementation().createDocument(None, 'Project', None) + root = dom.documentElement + root.setAttribute('ToolsVersion', '4.0') + root.setAttribute('xmlns', 'http://schemas.microsoft.com/developer/msbuild/2003') + + cache = dom.createElement('ImportGroup') + cache.setAttribute('Label', 'PropertySheets') + root.appendChild(cache) + + # write sub system + if self.__SubSystem is not None: + for bt in ('Debug', 'Release'): + node_IDG = dom.createElement('ItemDefinitionGroup') + node_IDG.setAttribute('Condition', f"'$(Configuration)|$(Platform)'=='{bt}|Win32'") + + node_link = dom.createElement('Link') + node_sub_system = dom.createElement('SubSystem') + + node_sub_system.appendChild(dom.createTextNode(self.__SubSystem)) + + node_link.appendChild(node_sub_system) + node_IDG.appendChild(node_link) + root.appendChild(node_IDG) + + # write macro + node_PG = dom.createElement('PropertyGroup') # macro node 1 + node_PG.setAttribute('Label', 'UserMacros') + root.appendChild(node_PG) + + cache = dom.createElement('PropertyGroup') # dummy structure + root.appendChild(cache) + cache = dom.createElement('ItemDefinitionGroup') #dummy structure + root.appendChild(cache) + + node_IG = dom.createElement('ItemGroup') # macro node 2 + root.appendChild(node_IG) + + for key, value in self.__MacroList.items(): + # create for PropertyGroup + node_macro_decl = dom.createElement(key) + if value != '': # check whether data is empty. + node_macro_decl.appendChild(dom.createTextNode(value)) + node_PG.appendChild(node_macro_decl) + + # create for ItemGroup + node_macro_ref = dom.createElement("BuildMacro") + node_macro_ref.setAttribute('Include', key) + node_inner_macro_ref = dom.createElement('Value') + node_inner_macro_ref.appendChild(dom.createTextNode("$({})".format(key))) + node_macro_ref.appendChild(node_inner_macro_ref) + node_IG.appendChild(node_macro_ref) + + # write to file + with open(filename, 'w', encoding='utf-8') as f: + dom.writexml(f, addindent='\t', newl='\n', encoding='utf-8') + +class VSVcxprojModifier(object): + + BUILDTYPE_EXE: str = 'Application' + BUILDTYPE_DLL: str = 'DynamicLibrary' + + def __init__(self, vcfile: str): + self.__Dom = minidom.parse(vcfile) + self.__FileName: str = vcfile + self.__BuildType: str = None + + def SetBuildType(self, bt: str): + self.__BuildType = bt + + def Write2File(self): + # if no spec build type, do not modify + if self.__BuildType is None: + return + + # get corresponding entry + dom = self.__Dom + node_project = dom.documentElement + for node_PG in node_project.getElementsByTagName('PropertyGroup'): + attr_label = node_PG.getAttribute('Label') + attr_condition = node_PG.getAttribute('Condition') + + # skip invalid node + if attr_label != 'Configuration': + continue + if attr_condition != "'$(Configuration)|$(Platform)'=='Debug|Win32'" and attr_condition != "'$(Configuration)|$(Platform)'=='Release|Win32'": + continue + + # this is valid node, process it + node_CT = node_PG.getElementsByTagName('ConfigurationType') + if len(node_CT) != 0: + # have node, change it + node_CT[0].childNodes[0].nodeValue = self.__BuildType + else: + # don't have node, add one + node_CT = dom.createElement('ConfigurationType') + node_CT.appendChild(dom.createTextNode(self.__BuildType)) + node_PG.appendChild(node_CT) + + # write file + with open(self.__FileName, 'w', encoding='utf-8') as f: + dom.writexml(f, encoding='utf-8') + diff --git a/SuperScriptMaterializer.sln b/SuperScriptMaterializer.sln index 159f48b..5dc992e 100644 --- a/SuperScriptMaterializer.sln +++ b/SuperScriptMaterializer.sln @@ -9,6 +9,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SuperScriptMaterializer", " EndProject Project("{888888A0-9F3D-457C-B088-3A5042F75D52}") = "SuperScriptViewer", "SuperScriptViewer\SuperScriptViewer.pyproj", "{0E4B5021-27EA-4F79-B87D-E123AFB3D788}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GPVirtoolsStatic", "GPVirtoolsStatic\GPVirtoolsStatic.vcxproj", "{38703AB6-BC5D-4062-BC5B-1BF195333B16}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -31,6 +33,12 @@ Global {0E4B5021-27EA-4F79-B87D-E123AFB3D788}.Debug|x86.ActiveCfg = Debug|Any CPU {0E4B5021-27EA-4F79-B87D-E123AFB3D788}.Release|Any CPU.ActiveCfg = Release|Any CPU {0E4B5021-27EA-4F79-B87D-E123AFB3D788}.Release|x86.ActiveCfg = Release|Any CPU + {38703AB6-BC5D-4062-BC5B-1BF195333B16}.Debug|Any CPU.ActiveCfg = Debug|Win32 + {38703AB6-BC5D-4062-BC5B-1BF195333B16}.Debug|x86.ActiveCfg = Debug|Win32 + {38703AB6-BC5D-4062-BC5B-1BF195333B16}.Debug|x86.Build.0 = Debug|Win32 + {38703AB6-BC5D-4062-BC5B-1BF195333B16}.Release|Any CPU.ActiveCfg = Release|Win32 + {38703AB6-BC5D-4062-BC5B-1BF195333B16}.Release|x86.ActiveCfg = Release|Win32 + {38703AB6-BC5D-4062-BC5B-1BF195333B16}.Release|x86.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/SuperScriptMaterializer/SuperScriptMaterializer.vcxproj b/SuperScriptMaterializer/SuperScriptMaterializer.vcxproj index 05c798f..2812a24 100644 --- a/SuperScriptMaterializer/SuperScriptMaterializer.vcxproj +++ b/SuperScriptMaterializer/SuperScriptMaterializer.vcxproj @@ -1,5 +1,4 @@ - - + Debug @@ -16,33 +15,31 @@ SuperScriptMaterializer 10.0 - + - v100 + v142 Dynamic MultiByte - DynamicLibrary - + Application false - v100 + v142 true MultiByte Dynamic - DynamicLibrary - - + Application + - + - + - + $(VIRTOOLS_OUTPUT_PATH) true @@ -68,6 +65,7 @@ EnableFastChecks true 4819;4996 + stdcpp17 $(VIRTOOLS_OUTPUT_PATH)SuperScriptMaterializer.$(VIRTOOLS_BUILD_SUFFIX) @@ -90,12 +88,12 @@ false - Default $(VIRTOOLS_HEADER_PATH);$(SQLITE_HEADER_PATH);%(AdditionalIncludeDirectories) ProgramDatabase WIN32;_WINDOWS;_USRDLL;$(VIRTOOLS_VER);$(VIRTOOLS_STD_MACRO);$(VIRTOOLS_EXTRA_MACRO);VX_MEM_RELEASE;_RELEASE;$(VIRTOOLS_BUILD_TYPE);%(PreprocessorDefinitions) EnableFastChecks 4819;4996 + stdcpp17 true @@ -108,30 +106,30 @@ - - - - - - - - - + + + + + + + + + - - - - - - - - + + + + + + + + - + - + \ No newline at end of file