From d5474ae8ca7594e22cc0ae07486a015df6f1d80f Mon Sep 17 00:00:00 2001 From: kaetemi Date: Fri, 28 Jan 2022 11:08:35 +0800 Subject: [PATCH] Improve compiler selection --- tool/quick_start/config_default.json | 20 +++++++++++++------- tool/quick_start/configure_toolchains.py | 18 +++++++++++++++--- tool/quick_start/find_external.py | 2 ++ tool/quick_start/find_toolchain.py | 12 ++++++++++-- 4 files changed, 40 insertions(+), 12 deletions(-) diff --git a/tool/quick_start/config_default.json b/tool/quick_start/config_default.json index e54dda625..275970239 100644 --- a/tool/quick_start/config_default.json +++ b/tool/quick_start/config_default.json @@ -19,13 +19,19 @@ }, "Toolchain": { "Preference": [ - "MSVC/v143/x64", - "MSVC/v142/x64", - "MSVC/v141/x64", - "MSVC/v140/x64", - "MSVC/v90/x86", - "MSVC/v100/x86", - "MSVC/v80/x86" + "Win7/VS/v143/x64", + "Win7/VS/v142/x64", + "Win7/VS/v141/x64", + "Win7/VS/v140/x64", + "Win7/VS/v120/x64", + "Win7/VS/v110/x64", + "Win2k/VS/v90/x86", + "WinXP/VS/v141_xp/x86", + "WinXP/VS/v140_xp/x86", + "WinXP/VS/v120_xp/x86", + "WinXP/VS/v110_xp/x86", + "WinXP/VS/v100/x86", + "Win98/VS/v80/x86" ], "Server": { "OS": "Ubuntu20" }, "Options": [ diff --git a/tool/quick_start/configure_toolchains.py b/tool/quick_start/configure_toolchains.py index c6596817a..3c3aa37f7 100644 --- a/tool/quick_start/configure_toolchains.py +++ b/tool/quick_start/configure_toolchains.py @@ -29,6 +29,7 @@ for ts in SortedToolsets: # https://cmake.org/cmake/help/latest/generator/Visual%20Studio%208%202005.html # Must set VCVars ahead of compiling! toolchain["Generator"] = "NMake Makefiles" + toolchain["DisplayName"] = vs["DisplayName"] toolchain["Platform"] = platform toolchain["Toolset"] = ts toolchain["Prefix"] = FindVSPrefixPaths(ts, platform) @@ -50,13 +51,24 @@ for ts in SortedToolsets: if luaVersion: toolchain["LuaVersion"] = luaVersion if platform == "x64": - toolchain["OS"] = "Win64" toolchain["VCVars"] = FindVCVars64(vs["Path"]) else: - toolchain["OS"] = "Win32" toolchain["VCVars"] = FindVCVars32(vs["Path"]) + if vs["Version"] >= 11: + if toolchain["Toolset"].endswith("_xp"): + toolchain["OS"] = "WinXP" + else: + toolchain["OS"] = "Win7" + elif vs["Version"] >= 10: + toolchain["OS"] = "WinXP" + elif vs["Version"] >= 9: + toolchain["OS"] = "Win2k" + elif vs["Version"] >= 8: + toolchain["OS"] = "Win98" + else: + continue if toolchain["VCVars"] and (len(toolchain["Prefix"]) or "Hunter" in toolchain): - Toolchains["MSVC/" + ts + "/" + platform] = toolchain + Toolchains[toolchain["OS"] + "/VS/" + ts + "/" + platform] = toolchain with open(os.path.join(NeLConfigDir, "toolchains_default.json"), 'w') as fo: json.dump(Toolchains, fo, indent=2) diff --git a/tool/quick_start/find_external.py b/tool/quick_start/find_external.py index a8f270f07..1b683d246 100644 --- a/tool/quick_start/find_external.py +++ b/tool/quick_start/find_external.py @@ -140,6 +140,8 @@ def FindLuaVersion(prefixPaths): return int(vers) line = fi.readline() fi.close() + # TODO: For linux, if hunter, don't care, + # otherwise, detect which lua version the system luabind depends on! return # end of file diff --git a/tool/quick_start/find_toolchain.py b/tool/quick_start/find_toolchain.py index 3b3061a35..9643b3cef 100644 --- a/tool/quick_start/find_toolchain.py +++ b/tool/quick_start/find_toolchain.py @@ -26,8 +26,16 @@ def FindToolchain(filter): res = tsn return res -NeLToolchainWin32 = FindToolchain({ "OS": "Win32" }) -NeLToolchainWin64 = FindToolchain({ "OS": "Win64" }) +NeLToolchainWin32 = FindToolchain({ "OS": "Win98", "Platform": "x86" }) +if not NeLToolchainWin32: + NeLToolchainWin32 = FindToolchain({ "OS": "Win2k", "Platform": "x86" }) +if not NeLToolchainWin32: + NeLToolchainWin32 = FindToolchain({ "OS": "WinXP", "Platform": "x86" }) +if not NeLToolchainWin32: + NeLToolchainWin32 = FindToolchain({ "OS": "Win7", "Platform": "x86" }) +NeLToolchainWin64 = FindToolchain({ "OS": "WinXP", "Platform": "x64" }) +if not NeLToolchainWin64: + NeLToolchainWin64 = FindToolchain({ "OS": "Win7", "Platform": "x64" }) NeLToolchainServer = FindToolchain(NeLConfig["Toolchain"]["Server"]) print("Win32:")