소스 검색

Merge pull request #93753 from Repiteo/scons/visual-studio-fixes

SCons: Fix output with `vsproj=yes`
Rémi Verschelde 1 년 전
부모
커밋
4e5ed0bbfb
3개의 변경된 파일15개의 추가작업 그리고 7개의 파일을 삭제
  1. 1 1
      SConstruct
  2. 13 2
      methods.py
  3. 1 4
      misc/msvs/vcxproj.filters.template

+ 1 - 1
SConstruct

@@ -1057,9 +1057,9 @@ SConscript("platform/" + env["platform"] + "/SCsub")  # Build selected platform.
 
 
 # Microsoft Visual Studio Project Generation
 # Microsoft Visual Studio Project Generation
 if env["vsproj"]:
 if env["vsproj"]:
+    methods.generate_cpp_hint_file("cpp.hint")
     env["CPPPATH"] = [Dir(path) for path in env["CPPPATH"]]
     env["CPPPATH"] = [Dir(path) for path in env["CPPPATH"]]
     methods.generate_vs_project(env, ARGUMENTS, env["vsproj_name"])
     methods.generate_vs_project(env, ARGUMENTS, env["vsproj_name"])
-    methods.generate_cpp_hint_file("cpp.hint")
 
 
 # Check for the existence of headers
 # Check for the existence of headers
 conf = Configure(env)
 conf = Configure(env)

+ 13 - 2
methods.py

@@ -678,6 +678,17 @@ def generate_cpp_hint_file(filename):
         try:
         try:
             with open(filename, "w", encoding="utf-8", newline="\n") as fd:
             with open(filename, "w", encoding="utf-8", newline="\n") as fd:
                 fd.write("#define GDCLASS(m_class, m_inherits)\n")
                 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:
         except OSError:
             print_warning("Could not write cpp.hint file.")
             print_warning("Could not write cpp.hint file.")
 
 
@@ -1036,7 +1047,7 @@ def dump(env):
 # skip the build process. This lets project files be quickly generated even if there are build errors.
 # 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:
 # 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"):
 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.
     # Augmented glob_recursive that also fills the dirs argument with traversed directories that have content.
     def glob_recursive_2(pattern, dirs, node="."):
     def glob_recursive_2(pattern, dirs, node="."):
@@ -1504,7 +1515,7 @@ def generate_vs_project(env, original_args, project_name="godot"):
         proj_template = proj_template.replace("%%DEFAULT_ITEMS%%", "\n    ".join(all_items))
         proj_template = proj_template.replace("%%DEFAULT_ITEMS%%", "\n    ".join(all_items))
         proj_template = proj_template.replace("%%PROPERTIES%%", "\n  ".join(properties))
         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)
             f.write(proj_template)
 
 
     if not get_bool(original_args, "vsproj_props_only", False):
     if not get_bool(original_args, "vsproj_props_only", False):

+ 1 - 4
misc/msvs/vcxproj.filters.template

@@ -7,12 +7,9 @@
     <Filter Include="Header Files">
     <Filter Include="Header Files">
       <UniqueIdentifier>%%UUID2%%</UniqueIdentifier>
       <UniqueIdentifier>%%UUID2%%</UniqueIdentifier>
     </Filter>
     </Filter>
-    <Filter Include="Resource Files">
+    <Filter Include="Other Files">
       <UniqueIdentifier>%%UUID3%%</UniqueIdentifier>
       <UniqueIdentifier>%%UUID3%%</UniqueIdentifier>
     </Filter>
     </Filter>
-    <Filter Include="Scripts">
-      <UniqueIdentifier>%%UUID4%%</UniqueIdentifier>
-    </Filter>
     %%FILTERS%%
     %%FILTERS%%
   </ItemGroup>
   </ItemGroup>
   <ItemGroup>
   <ItemGroup>