Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SCons: Fix output with vsproj=yes #93753

Merged
merged 1 commit into from
Jul 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -1040,9 +1040,9 @@ SConscript("platform/" + env["platform"] + "/SCsub") # Build selected platform.

# Microsoft Visual Studio Project Generation
if env["vsproj"]:
methods.generate_cpp_hint_file("cpp.hint")
env["CPPPATH"] = [Dir(path) for path in env["CPPPATH"]]
methods.generate_vs_project(env, ARGUMENTS, env["vsproj_name"])
methods.generate_cpp_hint_file("cpp.hint")

# Check for the existence of headers
conf = Configure(env)
Expand Down
15 changes: 13 additions & 2 deletions methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -676,6 +676,17 @@ def generate_cpp_hint_file(filename):
try:
with open(filename, "w", encoding="utf-8", newline="\n") as fd:
fd.write("#define GDCLASS(m_class, m_inherits)\n")
for name in ["GDVIRTUAL", "EXBIND", "MODBIND"]:
for count in range(13):
for suffix in ["", "R", "C", "RC"]:
fd.write(f"#define {name}{count}{suffix}(")
if "R" in suffix:
fd.write("m_ret, ")
fd.write("m_name")
for idx in range(1, count + 1):
fd.write(f", type{idx}")
fd.write(")\n")

except OSError:
print_warning("Could not write cpp.hint file.")

Expand Down Expand Up @@ -1034,7 +1045,7 @@ def non_serializable(obj):
# skip the build process. This lets project files be quickly generated even if there are build errors.
#
# To generate AND build from the command line:
# scons vsproj=yes vsproj_gen_only=yes
# scons vsproj=yes vsproj_gen_only=no
def generate_vs_project(env, original_args, project_name="godot"):
# Augmented glob_recursive that also fills the dirs argument with traversed directories that have content.
def glob_recursive_2(pattern, dirs, node="."):
Expand Down Expand Up @@ -1502,7 +1513,7 @@ def format_key_value(v):
proj_template = proj_template.replace("%%DEFAULT_ITEMS%%", "\n ".join(all_items))
proj_template = proj_template.replace("%%PROPERTIES%%", "\n ".join(properties))

with open(f"{project_name}.vcxproj", "w", encoding="utf-8", newline="\n") as f:
with open(f"{project_name}.vcxproj", "w", encoding="utf-8", newline="\r\n") as f:
f.write(proj_template)

if not get_bool(original_args, "vsproj_props_only", False):
Expand Down
5 changes: 1 addition & 4 deletions misc/msvs/vcxproj.filters.template
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,9 @@
<Filter Include="Header Files">
<UniqueIdentifier>%%UUID2%%</UniqueIdentifier>
</Filter>
<Filter Include="Resource Files">
<Filter Include="Other Files">
<UniqueIdentifier>%%UUID3%%</UniqueIdentifier>
</Filter>
<Filter Include="Scripts">
<UniqueIdentifier>%%UUID4%%</UniqueIdentifier>
</Filter>
%%FILTERS%%
</ItemGroup>
<ItemGroup>
Expand Down
Loading