Script to select the prefered toolchains

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

@ -26,6 +26,7 @@
"MSVC/v90/x86", "MSVC/v90/x86",
"MSVC/v100/x86", "MSVC/v100/x86",
"MSVC/v80/x86" "MSVC/v80/x86"
] ],
"Server": { "OS": "Ubuntu20" }
} }
} }

@ -26,8 +26,9 @@ for ts in SortedToolsets:
toolchain["Platform"] = platform toolchain["Platform"] = platform
toolchain["Toolset"] = ts toolchain["Toolset"] = ts
toolchain["Prefix"] = FindVSPrefixPaths(ts, platform) toolchain["Prefix"] = FindVSPrefixPaths(ts, platform)
if not len(toolchain["Prefix"]): if not len(toolchain["Prefix"]) and vs["Version"] >= 14:
toolchain["Hunter"] = True toolchain["Hunter"] = vs["Version"] >= 14
toolchain["EnvPath"] = FindBinPaths(toolchain["Prefix"])
toolchain["Version"] = vs["Version"] toolchain["Version"] = vs["Version"]
if platform == "x64": if platform == "x64":
toolchain["OS"] = "Win64" toolchain["OS"] = "Win64"
@ -35,7 +36,8 @@ for ts in SortedToolsets:
else: else:
toolchain["OS"] = "Win32" toolchain["OS"] = "Win32"
toolchain["VCVars"] = FindVCVars32(vs["Path"]) toolchain["VCVars"] = FindVCVars32(vs["Path"])
Toolchains["MSVC/" + ts + "/" + platform] = toolchain if toolchain["VCVars"] and (len(toolchain["Prefix"]) or "Hunter" in toolchain):
Toolchains["MSVC/" + ts + "/" + platform] = toolchain
with open(os.path.join(NeLConfigDir, "toolchains_default.json"), 'w') as fo: with open(os.path.join(NeLConfigDir, "toolchains_default.json"), 'w') as fo:
json.dump(Toolchains, fo, indent=2) json.dump(Toolchains, fo, indent=2)

@ -50,7 +50,6 @@ def FindPrefixPaths(externalDir):
return False return False
tempExternal = {} tempExternal = {}
tempExternalBinaries = {}
# Headers to include # Headers to include
includeSearch = [ includeSearch = [
@ -97,6 +96,7 @@ def FindPrefixPaths(externalDir):
# The list of folders to potentially pass into the Visual Studio debug PATH env var # The list of folders to potentially pass into the Visual Studio debug PATH env var
def FindBinPaths(prefixPaths): def FindBinPaths(prefixPaths):
tempExternalBinaries = {}
for dir in prefixPaths: for dir in prefixPaths:
for subDir in os.listdir(dir): for subDir in os.listdir(dir):
if subDir.startswith("."): if subDir.startswith("."):

@ -0,0 +1,40 @@
# This script finds the best toolchains for each purpose
from common import *
def FindToolchain(filter):
toolchains = {}
for tsn in NeLToolchains:
ts = NeLToolchains[tsn]
okay = True
for k in filter:
if ts[k] != filter[k]:
okay = False
break
if okay:
toolchains[tsn] = ts
preference = NeLConfig["Toolchain"]["Preference"]
for pn in preference:
if pn in toolchains:
return pn
res = None
bestVersion = 0
for tsn in toolchains:
ts = NeLToolchains[tsn]
if ts["Version"] > bestVersion:
res = tsn
return res
NeLToolchainWin32 = FindToolchain({ "OS": "Win32" })
NeLToolchainWin64 = FindToolchain({ "OS": "Win64" })
NeLToolchainServer = FindToolchain(NeLConfig["Toolchain"]["Server"])
print("Win32:")
print(NeLToolchainWin32)
print("Win64:")
print(NeLToolchainWin64)
print("Server:")
print(NeLToolchainServer)
# end of file

@ -126,6 +126,8 @@ def FindVCVars64(path):
return [ allVars, "x64" ] return [ allVars, "x64" ]
return return
# TODO: FindDirectX SDK optimized per version. If prefered SDK not available, just return blank
del ProcessYearPath del ProcessYearPath
del VSVersions del VSVersions
del VSMajor del VSMajor

@ -1 +1,2 @@
..\..\..\external\python27\python.exe configure_toolchains.py ..\..\..\external\python27\python.exe configure_toolchains.py
..\..\..\external\python27\python.exe find_toolchain.py

Loading…
Cancel
Save