diff --git a/.editorconfig b/.editorconfig index a2f93af3f56a..02fa54f62392 100644 --- a/.editorconfig +++ b/.editorconfig @@ -18,3 +18,7 @@ indent_style = space [*.svg] insert_final_newline = false + +[{*.props,*.vcxproj}] +indent_style = space +indent_size = 2 diff --git a/methods.py b/methods.py index 85fdf1978fb1..a368d89ce9f0 100644 --- a/methods.py +++ b/methods.py @@ -1217,11 +1217,16 @@ def get_dependencies(file, env, exts, headers, sources, others): properties.append( ";%s;" % (x, ";".join(itemlist[x]), x) ) - output = f"bin\\godot{env['PROGSUFFIX']}" + output = os.path.join("bin", f"godot{env['PROGSUFFIX']}") with open("misc/msvs/props.template", "r", encoding="utf-8") as file: props_template = file.read() + toolset = "v143" + if not env.msvc: + toolset = "CLang" + props_template = props_template.replace("%%PlatformToolset%%", toolset) + props_template = props_template.replace("%%VSCONF%%", vsconf) props_template = props_template.replace("%%CONDITION%%", condition) props_template = props_template.replace("%%PROPERTIES%%", "\n ".join(properties)) @@ -1235,6 +1240,7 @@ def get_dependencies(file, env, exts, headers, sources, others): proplist = [str(j) for j in env["CPPPATH"]] proplist += [str(j) for j in env.get("VSHINT_INCLUDES", [])] + proplist += [str(j) for j in get_default_include_paths(env)] props_template = props_template.replace("%%INCLUDES%%", ";".join(proplist)) proplist = env["CCFLAGS"] @@ -1270,17 +1276,17 @@ def get_dependencies(file, env, exts, headers, sources, others): commands = "scons" if len(common_build_prefix) == 0: - commands = "echo Starting SCons && cmd /V /C " + commands + commands = "echo Starting SCons &" + commands else: - common_build_prefix[0] = "echo Starting SCons && cmd /V /C " + common_build_prefix[0] + common_build_prefix[0] = "echo Starting SCons &" + common_build_prefix[0] - cmd = " ^& ".join(common_build_prefix + [" ".join([commands] + common_build_postfix)]) + cmd = " ".join(common_build_prefix + [" ".join([commands] + common_build_postfix)]) props_template = props_template.replace("%%BUILD%%", cmd) - cmd = " ^& ".join(common_build_prefix + [" ".join([commands] + cmd_rebuild)]) + cmd = " ".join(common_build_prefix + [" ".join([commands] + cmd_rebuild)]) props_template = props_template.replace("%%REBUILD%%", cmd) - cmd = " ^& ".join(common_build_prefix + [" ".join([commands] + cmd_clean)]) + cmd = " ".join(common_build_prefix + [" ".join([commands] + cmd_clean)]) props_template = props_template.replace("%%CLEAN%%", cmd) with open( @@ -1554,3 +1560,15 @@ def to_raw_cstring(value: Union[str, List[str]]) -> str: split += [segment] return " ".join(f'R"({x.decode()})"' for x in split) + + +def get_default_include_paths(env): + compiler = env.subst("$CXX") + target = os.path.join(env.Dir("#main").abspath, "main.cpp") + args = [compiler, target, "-x", "c++", "-v"] + ret = subprocess.run(args, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True) + output = ret.stdout + match = re.search(r"#include <\.\.\.> search starts here:([\S\s]*)End of search list.", output) + if not match: + return [] # msvc case + return [x.strip() for x in match[1].strip().splitlines()] diff --git a/misc/msvs/nmake.substitution.props b/misc/msvs/nmake.substitution.props new file mode 100644 index 000000000000..58a7badbb173 --- /dev/null +++ b/misc/msvs/nmake.substitution.props @@ -0,0 +1,17 @@ + + + + + $(NMakeOutput) + + + + + + + + + + + + diff --git a/misc/msvs/props.template b/misc/msvs/props.template index 82e3e81f1827..f6fdb0a78065 100644 --- a/misc/msvs/props.template +++ b/misc/msvs/props.template @@ -11,6 +11,7 @@ $(NMakeAssemblySearchPath) $(NMakeForcedUsingAssemblies) %%OPTIONS%% $(AdditionalOptions) + %%PlatformToolset%% %%PROPERTIES%% @@ -18,6 +19,9 @@ %%EXTRA_ITEMS%% + + +