godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
88.87k stars 20.15k forks source link

Generated Visual Studio project can only build "Editor x64" configuration #95598

Open DrRevert opened 4 weeks ago

DrRevert commented 4 weeks ago

Tested versions

System information

Windows 10, Visual Studio 2022 Community

Issue description

The solution and project files generated using the scons vsproj=yes are only able to build the "editor" configuration on x64 architecture. Any other configuration ("template_debug", "template_release") and x86 are unable to build the program using IDE.

Steps to reproduce

  1. Open terminal of your choice in the root directory of the Godot 4.3 source code
  2. Execute scons vsproj=yes and wait
  3. Open the godot.sln generated file using Visual Studio
  4. Notice that you are able to build the project using default settings
  5. Change the configuration to "template_debug" and try to build it
  6. Notice following warning in the log: "warning MSB8005: The property 'NMakeBuildCommandLine' is not defined. Skipping...
  7. Notice that only godot.windows.editor.x86_64.generated.props was generated (I'm assuming the files for other valid platforms/configurations should also be generated as it contains required NMake commands)

Minimal reproduction project (MRP)

N/A

CycloneRing commented 3 weeks ago

Okay, Actually this is not a problem, I figured out the solution, You have to tell the scons to generate for specific platform, So to generate props for template x64 you need to do this :

scons platform=windows target=template_release arch=x86_64 vsproj=yes

and it will generate godot.windows.template_release.x86_64.generated.props then reopen your solution and it will build just fine.

Calinou commented 3 weeks ago

You have to tell the scons to generate for specific platform, So to generate props for template x64 you need to do this :

Couldn't the generated .sln include all configurations automatically? This would make more sense to me, although you'd need to change the list of solutions that are built when pressing the keyboard shortcut so that you only build one at a time.

DrRevert commented 3 weeks ago

although you'd need to change the list of solutions that are built when pressing the keyboard shortcut so that you only build one at a time.

Not sure what you mean by shortcut keyboard and building only one build at once.

So to generate props for template x64 you need to do this :

OK so there's a workaround, but you still have a case that generated files are only able to build whatever configurtation/platform was set when the scons vsproj=yes was executed, the reason why the workaround works is that old files aren't deleted when new solution is created. I still think this behavior is a bug or an oversight which needs to be resolved, but the description is incorrect as it implies only editor is buildable. So something like: "Generated Visual Studio project can only build default configuration" Unless this new behavior is by design, but I'd argue it makes more sense to have one sln for all platforms and configurations.

CycloneRing commented 3 weeks ago

Couldn't the generated .sln include all configurations automatically? This would make more sense to me, although you'd need to change the list of solutions that are built when pressing the keyboard shortcut so that you only build one at a time.

@Calinou generated .sln doesn't contain reference to props, .vcxproj does and it contains all of the platforms and all included, the issue is generated .generated.props files which are generated as a single one per vsproj=yes request, So I just made a bat to generate all required ones, .sln and .vcxproj doesn't need to be touched.

@DrRevert Just do this in a row

scons platform=windows target=template_debug arch=x86_64 vsproj=yes
scons platform=windows target=template_release arch=x86_64 vsproj=yes
scons platform=windows target=editor arch=x86_64 vsproj=yes

Then open last generated .sln file and you have all of them and you can build all with no problem.