Generate correct VS env

feature/quick-start-py
kaetemi 3 years ago
parent f6d3521efa
commit 4218b70cf6
No known key found for this signature in database
GPG Key ID: 9873C4D40BB479BC

@ -50,10 +50,7 @@ for ts in SortedToolsets:
luaVersion = FindLuaVersion(toolchain["Prefix"]) luaVersion = FindLuaVersion(toolchain["Prefix"])
if luaVersion: if luaVersion:
toolchain["LuaVersion"] = luaVersion toolchain["LuaVersion"] = luaVersion
if platform == "x64": toolchain["VCVars"] = FindVCVars(vs["Path"], vs["Toolset"], platform)
toolchain["VCVars"] = FindVCVars64(vs["Path"])
else:
toolchain["VCVars"] = FindVCVars32(vs["Path"])
if vs["Version"] >= 11: if vs["Version"] >= 11:
if toolchain["Toolset"].endswith("_xp"): if toolchain["Toolset"].endswith("_xp"):
toolchain["OS"] = "WinXP" toolchain["OS"] = "WinXP"

@ -106,7 +106,7 @@ def ProcessYearPath(yearVersion, yearPath):
FoundVisualStudio += [ { "Name": "Visual Studio " + str(VSMajor[yearVersion]) + " " + yearVersion, "DisplayName": "Visual Studio " + yearVersion + " " + edition, "Path": editionPath, "Version": VSMajor[yearVersion], "Toolset": toolchain, "HasMFC": hasMFC } ] FoundVisualStudio += [ { "Name": "Visual Studio " + str(VSMajor[yearVersion]) + " " + yearVersion, "DisplayName": "Visual Studio " + yearVersion + " " + edition, "Path": editionPath, "Version": VSMajor[yearVersion], "Toolset": toolchain, "HasMFC": hasMFC } ]
# v140 Toolset # v140 Toolset
if os.path.isfile("C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\vcvarsall.bat"): if os.path.isfile("C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\vcvarsall.bat"):
FoundVisualStudio += [ { "Name": "Visual Studio " + str(VSMajor[yearVersion]) + " " + yearVersion, "DisplayName": "Visual Studio " + yearVersion + " " + edition, "Path": "C:\\Program Files (x86)\\Microsoft Visual Studio 14.0", "Version": VSMajor[yearVersion], "Toolset": "v140", "HasMFC": os.path.isfile("C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\atlmfc\\include\\afx.h") } ] FoundVisualStudio += [ { "Name": "Visual Studio " + str(VSMajor[yearVersion]) + " " + yearVersion, "DisplayName": "Visual Studio " + yearVersion + " " + edition, "Path": editionPath, "Version": VSMajor[yearVersion], "Toolset": "v140", "HasMFC": os.path.isfile("C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\atlmfc\\include\\afx.h") } ]
for yearVersion in os.listdir("C:\\Program Files (x86)\\Microsoft Visual Studio"): for yearVersion in os.listdir("C:\\Program Files (x86)\\Microsoft Visual Studio"):
if yearVersion.startswith("."): if yearVersion.startswith("."):
continue continue
@ -129,22 +129,21 @@ for vs in list(FoundVisualStudio):
if vs["Toolset"] == "v140" or os.path.isdir(checkPath): if vs["Toolset"] == "v140" or os.path.isdir(checkPath):
FoundVisualStudio += [ { "Name": vs["Name"], "DisplayName": vs["DisplayName"], "Path": vs["Path"], "Version": vs["Version"], "Toolset": vs["Toolset"] + "_xp", "HasMFC": vs["HasMFC"] } ] FoundVisualStudio += [ { "Name": vs["Name"], "DisplayName": vs["DisplayName"], "Path": vs["Path"], "Version": vs["Version"], "Toolset": vs["Toolset"] + "_xp", "HasMFC": vs["HasMFC"] } ]
def FindVCVars32(path): def FindVCVars(path, toolset, platform):
auxVars = os.path.join(path, "VC\\Auxiliary\\Build\\vcvars32.bat") toolsetMap = {
"v140": "14.0",
"v140_xp": "14.0",
"v141": "14.16",
"v141_xp": "14.16",
"v142": "14.29",
"v143": "14.30",
}
auxVars = os.path.join(path, "VC\\Auxiliary\\Build\\vcvarsall.bat")
if os.path.isfile(auxVars): if os.path.isfile(auxVars):
return [ auxVars ] return [ auxVars, platform, "-vcvars_ver=" + toolsetMap[toolset] ]
allVars = os.path.join(path, "VC\\vcvarsall.bat") allVars = os.path.join(path, "VC\\vcvarsall.bat")
if os.path.isfile(allVars): if os.path.isfile(allVars):
return [ allVars, "x86" ] return [ allVars, platform ]
return
def FindVCVars64(path):
auxVars = os.path.join(path, "VC\\Auxiliary\\Build\\vcvars64.bat")
if os.path.isfile(auxVars):
return [ auxVars ]
allVars = os.path.join(path, "VC\\vcvarsall.bat")
if os.path.isfile(allVars):
return [ allVars, "x64" ]
return return
# FindDirectX SDK, optimized for compatibility per version. If prefered SDK not available, just return blank # FindDirectX SDK, optimized for compatibility per version. If prefered SDK not available, just return blank

Loading…
Cancel
Save