feat: wip for project cfg generator.

- finish arg parser part of project cfg generator.
This commit is contained in:
yyc12345 2024-05-23 15:54:12 +08:00
parent 4ce7021054
commit f2c50c6187

View File

@ -1,5 +1,5 @@
import vs_props_writer, vs_vcxproj_modifier import vs_props_writer, vs_vcxproj_modifier
import os, enum, sys import os, enum, sys, argparse
#region Constant Declarations #region Constant Declarations
@ -15,6 +15,24 @@ class VirtoolsVersion(enum.Enum):
V40 = '40' V40 = '40'
V50 = '50' V50 = '50'
VT_HEADER_PATH: dict[VirtoolsVersion, str] = {
VirtoolsVersion.V21: 'Include',
VirtoolsVersion.V25: 'Virtools_SDK\\Includes',
VirtoolsVersion.V30: 'Sdk\\Includes',
VirtoolsVersion.V35: 'Sdk\\Includes',
VirtoolsVersion.V40: 'Sdk\\Includes',
VirtoolsVersion.V50: 'Sdk\\Includes'
}
VT_LIB_PATH: dict[VirtoolsVersion, str] = {
VirtoolsVersion.V21: 'Lib',
VirtoolsVersion.V25: 'Virtools_SDK\\Lib',
VirtoolsVersion.V30: 'Sdk\\Lib',
VirtoolsVersion.V35: 'Sdk\\Lib\\Win32\\Release',
VirtoolsVersion.V40: 'Sdk\\Lib\\Win32\\Release',
VirtoolsVersion.V50: 'Sdk\\Lib\\Win32\\Release'
}
VT_STANDALONE_ATTACHED_LIBS: dict[VirtoolsVersion, str] = { VT_STANDALONE_ATTACHED_LIBS: dict[VirtoolsVersion, str] = {
VirtoolsVersion.V21: "VxMath.lib;CK2.lib", VirtoolsVersion.V21: "VxMath.lib;CK2.lib",
VirtoolsVersion.V25: "VxMath.lib;CK2.lib", VirtoolsVersion.V25: "VxMath.lib;CK2.lib",
@ -49,8 +67,22 @@ VT_STANDALONE_MACROS: dict[VirtoolsVersion, str] = {
VirtoolsVersion.V50: "_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_DEBUG;VIRTOOLS_USER_SDK" VirtoolsVersion.V50: "_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_DEBUG;VIRTOOLS_USER_SDK"
} }
VT_PLUGIN_SUPPORTED_VER: set[VirtoolsVersion] = set((
VirtoolsVersion.V30,
VirtoolsVersion.V35,
VirtoolsVersion.V40,
VirtoolsVersion.V50,
))
VT_STANDALONE_SUPPORTED_VER: set[VirtoolsVersion] = set((
VirtoolsVersion.V21,
VirtoolsVersion.V25,
VirtoolsVersion.V30,
VirtoolsVersion.V35,
VirtoolsVersion.V40,
VirtoolsVersion.V50,
))
VT_EXECUTABLE_DEV: dict[VirtoolsVersion, str] = { VT_EXECUTABLE_DEV: dict[VirtoolsVersion, str] = {
VirtoolsVersion.V21: "Dev.exe",
VirtoolsVersion.V25: "Dev.exe", VirtoolsVersion.V25: "Dev.exe",
VirtoolsVersion.V30: "devr.exe", VirtoolsVersion.V30: "devr.exe",
VirtoolsVersion.V35: "devr.exe", VirtoolsVersion.V35: "devr.exe",
@ -72,6 +104,29 @@ def get_project_root() -> str:
# return value # return value
return ret return ret
def validate_combination(build_type: BuildType, vt_version: VirtoolsVersion) -> bool:
"""
Check whether the given combination of build type and Virtools version is OK.
Some combination of build type and Virtools version is invalid.
For example, because Virtools 2.5 do not have UI register so plugin build type is not available in Virtools 2.1
@return True if the combination is valid.
"""
match(build_type):
case BuildType.Standalone:
return vt_version in VT_STANDALONE_SUPPORTED_VER
case BuildType.Plugin:
return vt_version in VT_PLUGIN_SUPPORTED_VER
case _:
raise Exception('invalid build type')
def get_header_path(vt_version: VirtoolsVersion, vt_root: str) -> str:
return os.path.join(vt_root, VT_HEADER_PATH[vt_version])
def get_lib_path(vt_version: VirtoolsVersion, vt_root: str) -> str:
return os.path.join(vt_root, VT_LIB_PATH[vt_version])
def get_attached_libs(build_type: BuildType, vt_version: VirtoolsVersion) -> str: def get_attached_libs(build_type: BuildType, vt_version: VirtoolsVersion) -> str:
match(build_type): match(build_type):
case BuildType.Standalone: case BuildType.Standalone:
@ -90,15 +145,17 @@ def get_macros(build_type: BuildType, vt_version: VirtoolsVersion) -> str:
case _: case _:
raise Exception('invalid build type') raise Exception('invalid build type')
def get_executable_dev(vt_version: VirtoolsVersion) -> str: def get_executable_dev(vt_version: VirtoolsVersion, vt_root: str) -> str:
""" """
Return the path to executable Virtools Dev according to given Virtools version. Return the path to executable Virtools Dev according to given Virtools version.
Usually it is `Dev.exe` or `devr.exe`. Usually it is `Dev.exe` or `devr.exe`.
:param vt_version The version of Virtools. @param vt_version The version of Virtools.
@param vt_root The path to Virtools root folder.
@return The path to executable Virtools Dev.
""" """
pass return os.path.join(vt_root, VT_EXECUTABLE_DEV[vt_version])
def get_output_path(build_type: BuildType, vt_root: str) -> str: def get_output_path(build_type: BuildType, vt_root: str) -> str:
# fetch output path by build type # fetch output path by build type
@ -118,295 +175,266 @@ def get_output_path(build_type: BuildType, vt_root: str) -> str:
#endregion #endregion
def main() -> None:
# ========== Accept User Input ==========
# build args parser
parser = argparse.ArgumentParser(description='Project Configuration Maker')
parser.add_argument(
'-b', '--build-type', required=True, action='store', dest='build_type', choices=tuple(item.value for item in BuildType),
help='The build type of project.'
)
parser.add_argument(
'-t', '--virtools-version', required=True, action='store', dest='virtools_version', choices=tuple(item.value for item in VirtoolsVersion),
help='The Virtools version you picked.'
)
parser.add_argument(
'-p', '--virtools-path', required=True, action='store', dest='virtools_path',
help='''
The path to the root folder of you picked Virtools version where you can find "Dev.exe".
If you select Virtools 2.1, this path should be the root folder of GitHub project "doyaGu/Virtools-SDK-2.1".
'''
)
parser.add_argument(
'-a', '--sqlite-amalgamation-path', required=True, action='store', dest='sqlite_amalgamation_path',
help='The path to downloaded sqlite amalgamation folder where you can find "sqlite3.h"'
)
parser.add_argument(
'-d', '--sqlite-dll-path', required=True, action='store', dest='sqlite_dll_path',
help='The path to downloaded sqlite dll folder where you can find "sqlite3.dll" and "sqlite3.lib" you just built a few minutes ago.'
)
# parse arguments
args = parser.parse_args()
# ========== Analyse Arguments ==========
# extract arguments
arg_virtools_version: VirtoolsVersion = VirtoolsVersion(args.virtools_version)
arg_build_type: BuildType = BuildType(args.build_type)
arg_virtools_path: str = args.virtools_path
arg_sqlite_amalgamation_path: str = args.sqlite_amalgamation_path
arg_sqlite_dll_path: str = args.sqlite_dll_path
# =========== check work dir =========== # validate the combination
if not validate_combination(arg_build_type, arg_virtools_version):
print(f'The combination of "{arg_build_type.value}" and "{arg_virtools_version.value}" is not compatible currently.')
sys.exit(1)
if not os.path.isfile(os.path.join(os.getcwd(), 'README.md')): # build macros valus
print('Error! Please run this script at the root of this repository.') # virtools version macro
sys.exit(1) macro_virtools_ver: str = f'VIRTOOLS_{arg_virtools_version.value}'
# build type
# =========== const define =========== macro_virtools_build_type: str = f'VIRTOOLS_{arg_build_type.value.upper()}'
# virtools header and lib
build_type_standalone = "standalone" macro_virtools_header_path: str = get_header_path(arg_virtools_version, arg_virtools_path)
build_type_plugin = "plugin" macro_virtools_lib_path: str = get_lib_path(arg_virtools_version, arg_virtools_path)
valid_build_type = ( macro_virtools_attcahed_libs: str = get_attached_libs(arg_build_type, arg_virtools_version)
build_type_standalone, # sqlite header and lib
build_type_plugin macro_sqlite_header_path: str = arg_sqlite_amalgamation_path
) macro_sqlite_lib_path: str = arg_sqlite_dll_path
# out and debug path macros
virtools_attached_lib_plugin_dict = { macro_virtools_output_path: str = get_output_path(arg_build_type, arg_virtools_path)
"21": "",
"25": "",
"35": "vxmath.lib;DllEditor.lib;ck2.lib;InterfaceControls.lib;CKControls.lib",
"40": "vxmath.lib;DllEditor.lib;ck2.lib;InterfaceControls.lib;CKControls.lib",
"50": "vxmath.lib;DllEditor.lib;ck2.lib;InterfaceControls.lib;CKControls.lib"
}
virtools_attached_lib_standalone_dict = {
"21": "VxMath.lib;CK2.lib",
"25": "VxMath.lib;CK2.lib",
"35": "vxmath.lib;ck2.lib",
"40": "vxmath.lib;ck2.lib",
"50": "vxmath.lib;ck2.lib"
}
virtools_gp_static_proj = 'GPVirtoolsStatic'
virtools_std_macro_plugin_dict = {
"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": "_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 = {
"21": "Dev.exe",
"25": "Dev.exe",
"35": "devr.exe",
"40": "devr.exe",
"50": "devr.exe"
}
valid_virtools_standalone_ver = (
"21",
"25",
"35",
"40",
"50"
)
valid_virtools_plugin_ver = (
"35",
"40",
"50"
)
valid_vt21_reverse_work_type = (
'gamepiaynmo',
'doyagu'
)
# =========== assist func ===========
def get_executable_virtools(vt_ver):
if vt_ver == '21':
return 'Dev.exe'
elif vt_ver == '25':
return 'Dev.exe'
elif vt_ver == '35':
return 'devr.exe'
elif vt_ver == '40':
return 'devr.exe'
elif vt_ver == '50':
return 'devr.exe'
# =========== requirement get =========== # =========== requirement get ===========
# get basic cfg, such as build type, and vt version # # get basic cfg, such as build type, and vt version
while True: # while True:
input_build_type = input('Choose build type(plugin, standalone): ') # input_build_type = input('Choose build type(plugin, standalone): ')
if input_build_type not in valid_build_type: # if input_build_type not in valid_build_type:
print("Invalid build type!") # print("Invalid build type!")
else: # else:
break # break
valid_vtver_for_this_type = valid_virtools_plugin_ver if input_build_type == build_type_plugin else valid_virtools_standalone_ver # valid_vtver_for_this_type = valid_virtools_plugin_ver if input_build_type == build_type_plugin else valid_virtools_standalone_ver
while True: # while True:
input_virtools_version = input('Choose virtools version({}): '.format(', '.join(valid_vtver_for_this_type))) # input_virtools_version = input('Choose virtools version({}): '.format(', '.join(valid_vtver_for_this_type)))
if input_virtools_version not in valid_vtver_for_this_type: # if input_virtools_version not in valid_vtver_for_this_type:
print("Invalid virtools version!") # print("Invalid virtools version!")
else: # else:
break # break
# collect sqlite library data # # collect sqlite library data
while True: # while True:
input_sqlite_header_path = input('SQLite header folder path: ') # input_sqlite_header_path = input('SQLite header folder path: ')
if not os.path.isdir(input_sqlite_header_path): # if not os.path.isdir(input_sqlite_header_path):
print("Invalid SQLite header folder!") # print("Invalid SQLite header folder!")
else: # else:
break # break
while True: # while True:
input_sqlite_lib_path = input('SQLite lib file path: ') # input_sqlite_lib_path = input('SQLite lib file path: ')
if not os.path.isfile(input_sqlite_lib_path): # if not os.path.isfile(input_sqlite_lib_path):
print("Invalid SQLite lib file!") # print("Invalid SQLite lib file!")
else: # else:
break # break
# collect virtools sdk data # # collect virtools sdk data
if input_virtools_version != '21': # if input_virtools_version != '21':
# if we do not use virtools 21, we order get original virtools SDK # # if we do not use virtools 21, we order get original virtools SDK
while True: # while True:
input_virtools_root_path = input('Virtools root path: ') # input_virtools_root_path = input('Virtools root path: ')
if not os.path.isdir(input_virtools_root_path): # if not os.path.isdir(input_virtools_root_path):
print("Invalid virtools root path!") # print("Invalid virtools root path!")
else: # else:
break # break
else: # else:
# if we are in virtools 21 environment, we have 2 choose aboud used virtools sdk # # if we are in virtools 21 environment, we have 2 choose aboud used virtools sdk
# one is gamepiaynmo and another one is doyagu # # one is gamepiaynmo and another one is doyagu
# allow user choose a proper one from them and input their corresponding path about cloned repository. # # allow user choose a proper one from them and input their corresponding path about cloned repository.
# also order a proper runtime environment for debug # # also order a proper runtime environment for debug
while True: # while True:
input_vt21_reverse_work_type = input('Choose Virtools 2.1 reverse work source(gamepiaynmo, doyagu): ') # input_vt21_reverse_work_type = input('Choose Virtools 2.1 reverse work source(gamepiaynmo, doyagu): ')
if input_vt21_reverse_work_type not in valid_vt21_reverse_work_type: # if input_vt21_reverse_work_type not in valid_vt21_reverse_work_type:
print("Invalid Virtools 2.1 reverse work source!") # print("Invalid Virtools 2.1 reverse work source!")
else: # else:
break # break
while True: # while True:
input_vt21_reverse_work_path = input('Virtools 2.1 reverse work root path: ') # input_vt21_reverse_work_path = input('Virtools 2.1 reverse work root path: ')
if not os.path.isdir(input_vt21_reverse_work_path): # if not os.path.isdir(input_vt21_reverse_work_path):
print("Invalid Virtools 2.1 reverse work root path!") # print("Invalid Virtools 2.1 reverse work root path!")
else: # else:
break # break
while True: # while True:
input_vt21_runtime_path = input('Virtools 2.1 runtime path: ') # input_vt21_runtime_path = input('Virtools 2.1 runtime path: ')
if not os.path.isdir(input_vt21_runtime_path): # if not os.path.isdir(input_vt21_runtime_path):
print("Invalid Virtools 2.1 runtime path!") # print("Invalid Virtools 2.1 runtime path!")
else: # else:
break # break
# =========== construct some path =========== # # =========== construct some path ===========
# build sqlite related data # # build sqlite related data
sqlite_header_path = input_sqlite_header_path # sqlite_header_path = input_sqlite_header_path
(sqlite_lib_path, sqlite_lib_filename) = os.path.split(input_sqlite_lib_path) # (sqlite_lib_path, sqlite_lib_filename) = os.path.split(input_sqlite_lib_path)
# virtools version macro # # virtools version macro
virtools_ver = 'VIRTOOLS_' + input_virtools_version # virtools_ver = 'VIRTOOLS_' + input_virtools_version
# build type macro, and some essential build macros, linked lib # # build type macro, and some essential build macros, linked lib
if input_build_type == build_type_plugin: # if input_build_type == build_type_plugin:
virtools_build_type = 'VIRTOOLS_PLUGIN' # virtools_build_type = 'VIRTOOLS_PLUGIN'
virtools_build_suffix = 'dll' # virtools_build_suffix = 'dll'
virtools_module_define = 'SuperScriptMaterializer.def' # virtools_module_define = 'SuperScriptMaterializer.def'
virtools_std_macro = virtools_std_macro_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] # virtools_attached_lib = virtools_attached_lib_plugin_dict[input_virtools_version]
elif input_build_type == build_type_standalone: # elif input_build_type == build_type_standalone:
virtools_build_type = 'VIRTOOLS_STANDALONE' # virtools_build_type = 'VIRTOOLS_STANDALONE'
virtools_build_suffix = 'exe' # virtools_build_suffix = 'exe'
virtools_module_define = '' # virtools_module_define = ''
virtools_std_macro = virtools_std_macro_standalone_dict[input_virtools_version] # virtools_std_macro = virtools_std_macro_standalone_dict[input_virtools_version]
# gamepiaynmo linked lib need special lib name # # gamepiaynmo linked lib need special lib name
if input_virtools_version == '21' and input_vt21_reverse_work_type == 'gamepiaynmo': # if input_virtools_version == '21' and input_vt21_reverse_work_type == 'gamepiaynmo':
virtools_attached_lib = virtools_gp_static_proj + '.lib' # virtools_attached_lib = virtools_gp_static_proj + '.lib'
else: # else:
virtools_attached_lib = virtools_attached_lib_standalone_dict[input_virtools_version] # virtools_attached_lib = virtools_attached_lib_standalone_dict[input_virtools_version]
# debug configuration and output path # # debug configuration and output path
if input_virtools_version == '21': # if input_virtools_version == '21':
# virtools 21 onlt allow standalone build type # # virtools 21 onlt allow standalone build type
# we copy it and specific some field # # we copy it and specific some field
virtools_debug_root = input_vt21_runtime_path # virtools_debug_root = input_vt21_runtime_path
virtools_debug_commandline = 'test.nmo test_script.db test_env.db' # virtools_debug_commandline = 'test.nmo test_script.db test_env.db'
virtools_debug_target = os.path.join(input_vt21_runtime_path, 'SuperScriptMaterializer.exe') # virtools_debug_target = os.path.join(input_vt21_runtime_path, 'SuperScriptMaterializer.exe')
virtools_output_path = input_vt21_runtime_path # virtools_output_path = input_vt21_runtime_path
else: # else:
# in original virtools sdk environment # # in original virtools sdk environment
# output file according to build type # # output file according to build type
virtools_debug_root = input_virtools_root_path # virtools_debug_root = input_virtools_root_path
if input_build_type == build_type_plugin: # if input_build_type == build_type_plugin:
virtools_debug_commandline = '' # virtools_debug_commandline = ''
virtools_debug_target = os.path.join(input_virtools_root_path, executable_virtools[input_virtools_version]) # virtools_debug_target = os.path.join(input_virtools_root_path, executable_virtools[input_virtools_version])
virtools_output_path = os.path.join(input_virtools_root_path, 'InterfacePlugins') # virtools_output_path = os.path.join(input_virtools_root_path, 'InterfacePlugins')
else: # else:
virtools_debug_commandline = 'test.nmo test_script.db test_env.db' # virtools_debug_commandline = 'test.nmo test_script.db test_env.db'
virtools_debug_target = os.path.join(input_virtools_root_path, 'SuperScriptMaterializer.exe') # virtools_debug_target = os.path.join(input_virtools_root_path, 'SuperScriptMaterializer.exe')
virtools_output_path = input_virtools_root_path # virtools_output_path = input_virtools_root_path
# make sure the last char of output_path is slash # # make sure the last char of output_path is slash
if virtools_output_path[-1] != '\\' or virtools_output_path[-1] != '/': # if virtools_output_path[-1] != '\\' or virtools_output_path[-1] != '/':
virtools_output_path = virtools_output_path + '\\' # virtools_output_path = virtools_output_path + '\\'
# virtools compile and link options # # virtools compile and link options
# we need do different strategy for virtools 2.1 and anything else virtools version # # we need do different strategy for virtools 2.1 and anything else virtools version
if input_virtools_version == '21': # if input_virtools_version == '21':
# the reverse work of doyagu and gamepiaynmo is different, so we need to # # the reverse work of doyagu and gamepiaynmo is different, so we need to
# use them differently # # use them differently
if input_vt21_reverse_work_type == 'doyagu': # if input_vt21_reverse_work_type == 'doyagu':
# doyagu do not need any extra macro # # doyagu do not need any extra macro
virtools_extra_macro = '' # virtools_extra_macro = ''
virtools_header_path = os.path.join(input_vt21_reverse_work_path, 'Include') # virtools_header_path = os.path.join(input_vt21_reverse_work_path, 'Include')
virtools_lib_path = os.path.join(input_vt21_reverse_work_path, 'Lib') # virtools_lib_path = os.path.join(input_vt21_reverse_work_path, 'Lib')
else: # else:
# gamepiaynmo need a special macro but his proj do not need any link, # # 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 # # instead, we need compile it fully which will be implemented in following code
virtools_extra_macro = 'BML_EXPORT=' # virtools_extra_macro = 'BML_EXPORT='
virtools_header_path = os.path.join(input_vt21_reverse_work_path, 'virtools') # virtools_header_path = os.path.join(input_vt21_reverse_work_path, 'virtools')
virtools_lib_path = '$(SolutionDir)out\\$(Platform)\\$(Configuration)\\' + virtools_gp_static_proj # virtools_lib_path = '$(SolutionDir)out\\$(Platform)\\$(Configuration)\\' + virtools_gp_static_proj
else: # else:
virtools_extra_macro = '' # virtools_extra_macro = ''
if input_virtools_version == '25': # if input_virtools_version == '25':
virtools_header_path = os.path.join(input_virtools_root_path, 'Virtools_SDK/Includes') # virtools_header_path = os.path.join(input_virtools_root_path, 'Virtools_SDK/Includes')
virtools_lib_path = os.path.join(input_virtools_root_path, 'Virtools_SDK/Lib') # virtools_lib_path = os.path.join(input_virtools_root_path, 'Virtools_SDK/Lib')
else: # else:
virtools_header_path = os.path.join(input_virtools_root_path, 'Sdk/Includes') # 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') # virtools_lib_path = os.path.join(input_virtools_root_path, 'Sdk/Lib/Win32/Release')
# =========== create props =========== # # =========== create props ===========
props = vs_props_writer.VsPropsWriter() # props = vs_props_writer.VsPropsWriter()
vcxproj = vs_vcxproj_modifier.VsVcxprojModifier( # vcxproj = vs_vcxproj_modifier.VsVcxprojModifier(
'./SuperScriptMaterializer/SuperScriptMaterializer.vcxproj' # './SuperScriptMaterializer/SuperScriptMaterializer.vcxproj'
) # )
# write build type # # write build type
if input_build_type == build_type_standalone: # if input_build_type == build_type_standalone:
vcxproj.SetBuildType(vcxproj.BUILDTYPE_EXE) # vcxproj.SetBuildType(vcxproj.BUILDTYPE_EXE)
elif input_build_type == build_type_plugin: # elif input_build_type == build_type_plugin:
vcxproj.SetBuildType(vcxproj.BUILDTYPE_DLL) # vcxproj.SetBuildType(vcxproj.BUILDTYPE_DLL)
# write subsystem # # write subsystem
if input_build_type == build_type_standalone: # if input_build_type == build_type_standalone:
props.SetSubSystem(vs_props_writer.VsSubSystem.Console) # props.SetSubSystem(vs_props_writer.VsSubSystem.Console)
elif input_build_type == build_type_plugin: # elif input_build_type == build_type_plugin:
props.SetSubSystem(vs_props_writer.VsSubSystem.Windows) # props.SetSubSystem(vs_props_writer.VsSubSystem.Windows)
# write macro and misc # # write macro and misc
# build type distinguish macro # # build type distinguish macro
props.AddMacro('VIRTOOLS_VER', virtools_ver) # props.AddMacro('VIRTOOLS_VER', virtools_ver)
props.AddMacro('VIRTOOLS_BUILD_TYPE', virtools_build_type) # props.AddMacro('VIRTOOLS_BUILD_TYPE', virtools_build_type)
# header and libs # # header and libs
props.AddMacro('VIRTOOLS_HEADER_PATH', virtools_header_path) # props.AddMacro('VIRTOOLS_HEADER_PATH', virtools_header_path)
props.AddMacro('VIRTOOLS_LIB_PATH', virtools_lib_path) # props.AddMacro('VIRTOOLS_LIB_PATH', virtools_lib_path)
props.AddMacro('VIRTOOLS_LIB_FILENAME', virtools_attached_lib) # props.AddMacro('VIRTOOLS_LIB_FILENAME', virtools_attached_lib)
props.AddMacro('SQLITE_HEADER_PATH', sqlite_header_path) # props.AddMacro('SQLITE_HEADER_PATH', sqlite_header_path)
props.AddMacro('SQLITE_LIB_PATH', sqlite_lib_path) # props.AddMacro('SQLITE_LIB_PATH', sqlite_lib_path)
props.AddMacro('SQLITE_LIB_FILENAME', sqlite_lib_filename) # props.AddMacro('SQLITE_LIB_FILENAME', sqlite_lib_filename)
# output and debug # # output and debug
props.AddMacro('VIRTOOLS_OUTPUT_PATH', virtools_output_path) # props.AddMacro('VIRTOOLS_OUTPUT_PATH', virtools_output_path)
props.AddMacro('VIRTOOLS_DEBUG_TARGET', virtools_debug_target) # props.AddMacro('VIRTOOLS_DEBUG_TARGET', virtools_debug_target)
props.AddMacro('VIRTOOLS_DEBUG_ROOT', virtools_debug_root) # props.AddMacro('VIRTOOLS_DEBUG_ROOT', virtools_debug_root)
props.AddMacro('VIRTOOLS_DEBUG_COMMANDLINE', virtools_debug_commandline) # props.AddMacro('VIRTOOLS_DEBUG_COMMANDLINE', virtools_debug_commandline)
# essential build macro # # essential build macro
props.AddMacro('VIRTOOLS_STD_MACRO', virtools_std_macro) # props.AddMacro('VIRTOOLS_STD_MACRO', virtools_std_macro)
props.AddMacro('VIRTOOLS_EXTRA_MACRO', virtools_extra_macro) # props.AddMacro('VIRTOOLS_EXTRA_MACRO', virtools_extra_macro)
# misc macro # # misc macro
props.AddMacro('VIRTOOLS_BUILD_SUFFIX', virtools_build_suffix) # props.AddMacro('VIRTOOLS_BUILD_SUFFIX', virtools_build_suffix)
props.AddMacro('VIRTOOLS_MODULE_DEFINE', virtools_module_define) # props.AddMacro('VIRTOOLS_MODULE_DEFINE', virtools_module_define)
# output # # output
props.Write2File('./SuperScriptMaterializer/Virtools.props') # props.Write2File('./SuperScriptMaterializer/Virtools.props')
vcxproj.Write2File() # vcxproj.Write2File()
# =========== create vt21 props =========== # # =========== create vt21 props ===========
# if we are using virtools 2.1. and we use gamepiaynmo as our # # if we are using virtools 2.1. and we use gamepiaynmo as our
# reverse library. we need enable project GPVirtoolsStatic and # # reverse library. we need enable project GPVirtoolsStatic and
# add some macro for it # # add some macro for it
if input_virtools_version == '21' and input_vt21_reverse_work_type == 'gamepiaynmo': # if input_virtools_version == '21' and input_vt21_reverse_work_type == 'gamepiaynmo':
gp_props = VSProp.VSPropWriter() # gp_props = VSProp.VSPropWriter()
gp_props.AddMacro('BML_REPOSITORY', input_vt21_reverse_work_path) # gp_props.AddMacro('BML_REPOSITORY', input_vt21_reverse_work_path)
gp_props.Write2File('./GPVirtoolsStatic/Virtools.props') # gp_props.Write2File('./GPVirtoolsStatic/Virtools.props')
print("OK!") # print("OK!")
if __name__ == '__main__': if __name__ == '__main__':
pass main()