From 88631d857024298e59c902caf0b7a4b64e247470 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Fri, 28 Jan 2022 10:14:27 +0800 Subject: [PATCH] List lua version in toolchain configs --- tool/quick_start/configure_toolchains.py | 3 +++ tool/quick_start/find_external.py | 17 +++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/tool/quick_start/configure_toolchains.py b/tool/quick_start/configure_toolchains.py index 18d556ccb..c6596817a 100644 --- a/tool/quick_start/configure_toolchains.py +++ b/tool/quick_start/configure_toolchains.py @@ -46,6 +46,9 @@ for ts in SortedToolsets: toolchain["HasXAudio2"] = True if vs["HasMFC"]: toolchain["HasMFC"] = True + luaVersion = FindLuaVersion(toolchain["Prefix"]) + if luaVersion: + toolchain["LuaVersion"] = luaVersion if platform == "x64": toolchain["OS"] = "Win64" toolchain["VCVars"] = FindVCVars64(vs["Path"]) diff --git a/tool/quick_start/find_external.py b/tool/quick_start/find_external.py index fa8d93159..a8f270f07 100644 --- a/tool/quick_start/find_external.py +++ b/tool/quick_start/find_external.py @@ -125,4 +125,21 @@ def FindVSPrefixPaths(toolset, platform): return FindPrefixPaths(os.path.join("C:\\", found[0])) return [] +def FindLuaVersion(prefixPaths): + for dir in prefixPaths: + luaHeader = os.path.join(dir, "include/lua.h") + if os.path.isfile(luaHeader): + fi = open(luaHeader) + line = fi.readline() + while line: + if "LUA_VERSION_NUM" in line: + fi.close() + line = line.strip() + syms = line.split() + vers = syms[len(syms) - 1] + return int(vers) + line = fi.readline() + fi.close() + return + # end of file