Detect Max installation and list all SDKs with corresponding required toolset versions

feature/quick-start-py
kaetemi 3 years ago
parent 5685774a7d
commit 3760a1331c
No known key found for this signature in database
GPG Key ID: 9873C4D40BB479BC

@ -9,15 +9,16 @@ NeLGraphicsDir = os.path.join(NeLRootDir, "graphics")
NeLSoundDir = os.path.join(NeLRootDir, "sound")
NeLBuildDir = os.path.join(NeLRootDir, "build_" + NeLHostId)
NeLPipelineDir = os.path.join(NeLRootDir, "pipeline")
NeLDistributionDir = os.path.join(NeLRootDir, "distribution")
# TODO: OS
NeLPython27Dir = os.path.join(NeLRootDir, NeLConfig["Paths"]["Win64"]["Python27"])
NeLRRDtoolDir = os.path.join(NeLRootDir, NeLConfig["Paths"]["Win64"]["RRDtool"])
NeLMariaDBDir = os.path.join(NeLRootDir, NeLConfig["Paths"]["Win64"]["MariaDB"])
NeLNginxDir = os.path.join(NeLRootDir, NeLConfig["Paths"]["Win64"]["Nginx"])
NeLPHPDir = os.path.join(NeLRootDir, NeLConfig["Paths"]["Win64"]["PHP"])
NeLphpMyAdminDir = os.path.join(NeLRootDir, NeLConfig["Paths"]["Win64"]["phpMyAdmin"])
NeL3dsMaxDir = os.path.join(NeLRootDir, NeLConfig["Paths"]["Win64"]["3dsMax"])
#NeLPython27Dir = os.path.join(NeLRootDir, NeLConfig["Paths"]["Win64"]["Python27"])
#NeLRRDtoolDir = os.path.join(NeLRootDir, NeLConfig["Paths"]["Win64"]["RRDtool"])
#NeLMariaDBDir = os.path.join(NeLRootDir, NeLConfig["Paths"]["Win64"]["MariaDB"])
#NeLNginxDir = os.path.join(NeLRootDir, NeLConfig["Paths"]["Win64"]["Nginx"])
#NeLPHPDir = os.path.join(NeLRootDir, NeLConfig["Paths"]["Win64"]["PHP"])
#NeLphpMyAdminDir = os.path.join(NeLRootDir, NeLConfig["Paths"]["Win64"]["phpMyAdmin"])
#NeL3dsMaxDir = os.path.join(NeLRootDir, NeLConfig["Paths"]["Win64"]["3dsMax"])
#print(NeLRootDir)
#print(NeLConfigDir)

@ -3,10 +3,51 @@ from common_root import *
import os, json, socket
NeLHostName = socket.gethostname()
# Path-safe ID from hostname
# Used for separating build directories in multiboot development scenario
# Release builds should always be done from the same box, ideally
NeLHostId = NeLHostName.lower()
fi = open(os.path.join(NeLQuickStartDir, "config_default.json"), "r")
NeLConfig = json.load(fi)
fi.close()
def MergeConfig(file):
global NeLConfig
if not os.path.isfile(file):
return
fi = open(os.path.join(NeLConfigDir, file), "r")
config = json.load(fi)
if not "Paths" in config:
config["Paths"] = {}
if not "Win64" in config["Paths"]:
config["Paths"]["Win64"] = {}
if not "Toolchain" in config:
config["Toolchain"] = {}
if not "Client" in config["Toolchain"]:
config["Toolchain"]["Client"] = {}
NeLConfig["Paths"]["Win64"].update(config["Paths"]["Win64"])
config["Paths"]["Win64"] = NeLConfig["Paths"]["Win64"]
NeLConfig["Paths"].update(config["Paths"])
config["Paths"] = NeLConfig["Paths"]
NeLConfig["Toolchain"]["Client"].update(config["Toolchain"]["Client"])
config["Toolchain"]["Client"] = NeLConfig["Toolchain"]["Client"]
NeLConfig["Toolchain"].update(config["Toolchain"])
config["Toolchain"] = NeLConfig["Toolchain"]
NeLConfig.update(config)
fi.close()
MergeConfig("config.json")
if "HostId" in NeLConfig:
# Override if specified
NeLHostId = NeLConfig["HostId"]
MergeConfig("config_" + NeLHostId + "_default.json")
MergeConfig("config_" + NeLHostId + ".json")
fi = open(os.path.join(NeLConfigDir, "config.json"), "r")
NeLUserConfig = json.load(fi)
if not "Paths" in NeLUserConfig:
@ -28,16 +69,6 @@ NeLUserConfig["Toolchain"] = NeLConfig["Toolchain"]
NeLConfig.update(NeLUserConfig)
fi.close()
NeLHostName = socket.gethostname()
# Path-safe ID from hostname
# Used for separating build directories in multiboot development scenario
# Release builds should always be done from the same box, ideally
NeLHostId = NeLHostName.lower()
if "HostId" in NeLConfig:
# Override if specified
NeLHostId = NeLConfig["HostId"]
if os.path.isfile(os.path.join(NeLConfigDir, "toolchains_" + NeLHostId + "_default.json")):
fi = open(os.path.join(NeLConfigDir, "toolchains_" + NeLHostId + "_default.json"), "r")
NeLToolchains = json.load(fi)
@ -50,5 +81,5 @@ if os.path.isfile(os.path.join(NeLConfigDir, "toolchains_" + NeLHostId + ".json"
NeLToolchains.update(json.load(fi))
fi.close()
del NeLUserConfig
del MergeConfig
del fi

@ -7,10 +7,10 @@
"MariaDB": "external/mariadb",
"Nginx": "external/nginx",
"PHP": "external/php",
"phpMyAdmin": "external/phpmyadmin",
"3dsMax": "",
"3dsMaxLocal": ""
}
"phpMyAdmin": "external/phpmyadmin"
},
"3dsMax": "",
"3dsMaxLocal": ""
},
"Toolchain": {
"Preference": [

@ -1,2 +1,133 @@
# Script finds latest max installation, user directory, and max SDKs
import os
def HasPluginMax(path):
return os.path.isfile(os.path.join(path, "3dsmax.exe")) and (os.path.isfile(os.path.join(path, "plugins/nelexport_r.dlu")) or os.path.isfile(os.path.join(path, "plugins/nelexport_d.dlu")) or os.path.isfile(os.path.join(path, "plugins/nelexport.dlu")))
def FindPluginMax():
for i in range(2038, 2007, -1) + range(9, 2, -1):
path = os.getenv('ADSK_3DSMAX_x64_' + str(i))
if path and HasPluginMax(path):
return os.path.normpath(path)
path = "C:/Program Files/Autodesk/3ds Max " + str(i)
if HasPluginMax(path):
return os.path.normpath(path)
path = "C:/Program Files (x86)/Autodesk/3ds Max " + str(i)
if HasPluginMax(path):
return os.path.normpath(path)
def FindLatestMax():
for i in range(2038, 2007, -1) + range(9, 2, -1):
path = os.getenv('ADSK_3DSMAX_x64_' + str(i))
if path and os.path.isfile(os.path.join(path, "3dsmax.exe")):
return os.path.normpath(path)
path = "C:/Program Files/Autodesk/3ds Max " + str(i)
if os.path.isfile(os.path.join(path, "3dsmax.exe")):
return os.path.normpath(path)
path = "C:/Program Files (x86)/Autodesk/3ds Max " + str(i)
if os.path.isfile(os.path.join(path, "3dsmax.exe")):
return os.path.normpath(path)
def FindMaxLocal(maxPath):
maxPathSplit = maxPath.split()
version = maxPathSplit[len(maxPathSplit) - 1]
if "x86" in maxPath:
version += " - 32bit"
else:
version += " - 64bit"
return os.path.normpath(os.path.expandvars("%LocalAppData%/Autodesk/3dsMax/" + version + "/ENU"))
def FindMaxSDK(version):
path = os.getenv('ADSK_3DSMAX_SDK_' + str(version))
if path:
if os.path.isfile(os.path.join(path, "include/max.h")):
return os.path.normpath(path)
elif os.path.isfile(os.path.join(path, "maxsdk/include/max.h")):
return os.path.normpath(os.path.join(path, "maxsdk"))
path = "C:/Program Files/Autodesk/3ds Max " + str(version) + " SDK"
if os.path.isfile(os.path.join(path, "include/max.h")):
return os.path.normpath(path)
elif os.path.isfile(os.path.join(path, "maxsdk/include/max.h")):
return os.path.normpath(os.path.join(path, "maxsdk"))
path = "C:/Program Files (x86)/Autodesk/3ds Max " + str(version) + " SDK"
if os.path.isfile(os.path.join(path, "include/max.h")):
return os.path.normpath(path)
elif os.path.isfile(os.path.join(path, "maxsdk/include/max.h")):
return os.path.normpath(os.path.join(path, "maxsdk"))
path = "C:/Program Files (x86)/Autodesk/3dsMax" + str(version)
if os.path.isfile(os.path.join(path, "include/max.h")):
return os.path.normpath(path)
elif os.path.isfile(os.path.join(path, "maxsdk/include/max.h")):
return os.path.normpath(os.path.join(path, "maxsdk"))
return
def FindMaxSDKs():
toolset = {
2022: "v141",
2021: "v141",
2020: "v141",
2219: "v140",
2018: "v140",
2017: "v140",
2016: "v110",
2015: "v110",
2014: "v100",
2013: "v100",
2012: "v90",
2011: "v90",
2010: "v90",
2009: "v80",
2008: "v80",
9: "v80",
8: "v70",
7: "v70",
6: "v70",
5: "v60",
4: "v60",
3: "v60",
}
compatible = {
2021: 2020,
2016: 2015,
2014: 2013,
2011: 2010,
2008: 9,
8: 7,
7: 6,
5: 4,
}
res = []
set = {}
remap = {}
for i in range(3, 10) + range(2008, 2039):
found = FindMaxSDK(i)
if found:
set[i] = True
c = None
remap[i] = i
if i in compatible:
if compatible[i] in set:
c = remap[compatible[i]]
remap[i] = c
t = "v142"
if i in toolset:
t = toolset[i]
rv = { "Path": found, "Version": i, "Toolset": t }
if c:
rv["Compatible"] = c
res += [ rv ]
return res
FoundPluginMax = FindPluginMax()
FoundPluginMaxLocal = FindMaxLocal(FindPluginMax())
FoundLatestMax = FindLatestMax()
FoundMaxSDKs = FindMaxSDKs()
print FoundPluginMax
print FoundPluginMaxLocal
print FoundLatestMax
print FoundMaxSDKs
# end of file

@ -34,7 +34,7 @@ def FindToolchainEx(filters):
return
NeLToolchainNative = [
{ "Native": True }, # G++ on Linux
{ "Native": True, "Hunter": False }, # G++ on Linux with system packages
{ "OS": "Win7", "Platform": "x64", "Hunter": False }, # Fallback, VS on Windows
{ "OS": "Win7", "Platform": "x64" }
]

@ -5,7 +5,10 @@ def printBuildTarget(name, filters):
tn = FindToolchainEx(filters)
if tn:
tc = NeLToolchains[tn]
print(" " + name + ": " + tc["DisplayName"] + " (" + tc["Generator"] + ", " + tc["Toolset"] + ", " + tc["Platform"] + ")")
withHunter = ""
if "Hunter" in tc and tc["Hunter"]:
withHunter = ", Hunter"
print(" " + name + ": " + tc["DisplayName"] + " (" + tc["Generator"] + ", " + tc["Toolset"] + ", " + tc["Platform"] + ")" + withHunter)
else:
print(" " + name + ": NOT FOUND")
@ -19,4 +22,4 @@ printBuildTarget("tools", NeLToolchainNative)
printBuildTarget("samples", NeLToolchainNative)
# plugin_max
# end of file
# end of file

Loading…
Cancel
Save