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

Generate project files for VS2017 #10727

Merged
merged 1 commit into from
Aug 30, 2017
Merged

Conversation

hoelzl
Copy link
Contributor

@hoelzl hoelzl commented Aug 28, 2017

This patch generates VS project files for the default version of Visual Studio that is installed on the build machine. It uses SCons functions to determine what the default version of VS/VC is. This means that SCons 2.5.* will not detect a VS2017 installation and fall back to VS2015. SCons 3.0 alpha generates projects for VS2017 if it is installed. (More precisely, if VS2017 is installed in such a way that it is recognized as the default, which should typically be the case even if both VS2015 and VS2017 are available).

Whereas previously the value of the -j flag was hardcoded to 2, the VS build now uses the same number of threads as the SCons run that generated the solution files.

Another change to the previous behavior is that the path to the batch file that sets up the VS environment is now generated when the SConstruct file is run; previously it queried the value of the environment variable VCInstallDir when building Godot. I don't think this change matters, but it might impact people who have strange VS2015 setups.

I've also refactored the code a bit to avoid the extremely long and repetitive strings in the source and fixed (what I believe was) a minor bug: one of the command lines used & instead of ^& in one place, and I could see no real reason for this difference.

@akien-mga
Copy link
Member

This looks fine, but I wonder if we could move this logic out of SConstruct and put it instead in methods.py? That would help reduce the bloat in the main script (arguably adding more bloat in methods.py, but that's less problematic IMO).

@hoelzl hoelzl force-pushed the vs2017 branch 2 times, most recently from 7ee3a66 to 0d327df Compare August 28, 2017 20:44
@hoelzl
Copy link
Contributor Author

hoelzl commented Aug 28, 2017

No problem, pushed an updated version.

@akien-mga
Copy link
Member

akien-mga commented Aug 28, 2017

Actually I was thinking more to move everything after if (env['vsproj']) == "yes": to its own method, like methods.generate_vs_project(env).. If that's possible though, I haven't checked what it would entail.

@hoelzl
Copy link
Contributor Author

hoelzl commented Aug 28, 2017

Ah, I see. I didn't want to change too much of the existing build file but I can try to see how it would work out.

@hoelzl hoelzl force-pushed the vs2017 branch 3 times, most recently from 515ca16 to c0f20d4 Compare August 28, 2017 22:06
@hoelzl
Copy link
Contributor Author

hoelzl commented Aug 28, 2017

OK, everything (except for an old comment) is in methods.py now.

SConstruct Outdated
AddToVSProject(env.scene_sources)
AddToVSProject(env.servers_sources)
AddToVSProject(env.editor_sources)

# this env flag won't work, it needs to be set in env_base=Environment(MSVC_VERSION='9.0')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can safely go away.

@hoelzl hoelzl force-pushed the vs2017 branch 2 times, most recently from 530fccf to db0e9c6 Compare August 29, 2017 14:50
@hoelzl
Copy link
Contributor Author

hoelzl commented Aug 29, 2017

Removed the comment, as requested in the review.

@akien-mga akien-mga merged commit 93c83da into godotengine:master Aug 30, 2017
@hoelzl hoelzl deleted the vs2017 branch August 30, 2017 12:15
hoelzl added a commit to hoelzl/godot that referenced this pull request Oct 24, 2017
- Cherry picked godotengine#10662 and fixed merge conflicts.
- Manualy merged the change from godotengine#11904.
- Did not merge godotengine#12236 since I'm not sure whether the issue
  affects Godot 2.1 and I don't have VS2013 to test.
- Did not merge godotengine#11843 since it doesn't seem relevant (the
  code is only needed for creating DONORS.md, etc.).
- Did not merge godotengine#10727 and godotengine#11752 since they seem to be
  already included in godotengine#11742.
- The Windows and Linux builds have been tested with Scons 3.0
  using Python 3.
- OSX and iOS should hopefully work but are not tested since
  I don't have a Mac.
- Builds using SCons 2.5 and Python 2 should not be impacted.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants