diff --git a/bin/CraftCompiler.py b/bin/CraftCompiler.py --- a/bin/CraftCompiler.py +++ b/bin/CraftCompiler.py @@ -240,6 +240,9 @@ def isMSVC2017(self): return self.abi.startswith("msvc2017") + def isMSVC2019(self): + return self.abi.startswith("msvc2019") + def isIntel(self): return self.compiler == "intel" @@ -289,7 +292,8 @@ "msvc2012": 11, "msvc2013": 12, "msvc2015": 14, - "msvc2017": 15 + "msvc2017": 15, + "msvc2019": 16 } c = self.abi.split("_")[0] if c not in versions: @@ -302,7 +306,8 @@ "msvc2012": 110, "msvc2013": 120, "msvc2015": 140, - "msvc2017": 141 + "msvc2017": 141, + "msvc2019": 142 } c = self.abi.split("_")[0] if c not in versions: diff --git a/bin/CraftSetupHelper.py b/bin/CraftSetupHelper.py --- a/bin/CraftSetupHelper.py +++ b/bin/CraftSetupHelper.py @@ -158,11 +158,13 @@ return os.environ @staticmethod - def _callVCVER(version : int, args : []=None, native : bool=True) -> str: + def _callVCVER(version : int, args : []=None, native : bool=True, Prerelease : bool = False) -> str: if not args: args = [] vswhere = os.path.join(CraftCore.standardDirs.craftBin(), "3rdparty", "vswhere", "vswhere.exe") command = [vswhere, "-property", "installationPath", "-nologo", "-latest"] + if Prerelease: + command += ["-prerelease"] if version: command += ["-version", f"[{version},{version+1})"] if version < 15: @@ -195,8 +197,12 @@ if not path: path = SetupHelper._callVCVER(version, native=native) + if not path: + path = SetupHelper._callVCVER(version, native=native, Prerelease=True) + if path: + log("Found MSVS only in a prerelease version. I will use that.") if not path: - log("Please ensure that you have installed the C++ component", critical=True) + log("Unable to locate Visual Studio. Please install it with the C++ component. Aborting.", critical=True) path = os.path.join(path, "VC") if not os.path.exists(os.path.join(path, "vcvarsall.bat")): @@ -343,7 +349,7 @@ self.prependEnvVar("PATH", CraftStandardDirs.craftBin()) - # make sure thate craftroot bin is the first to look for dlls etc + # make sure that craftroot bin is the first to look for dlls etc self.prependEnvVar("PATH", os.path.join(CraftStandardDirs.craftRoot(), "bin")) self.prependEnvVar("PATH", os.path.join(CraftStandardDirs.craftRoot(), "dev-utils", "bin")) diff --git a/blueprints/libs/runtime/runtime.py b/blueprints/libs/runtime/runtime.py --- a/blueprints/libs/runtime/runtime.py +++ b/blueprints/libs/runtime/runtime.py @@ -48,20 +48,22 @@ srcdir = os.path.join(self.rootdir, "mingw64", "bin") elif CraftCore.compiler.isMSVC(): if self.buildType() != "Debug": - if CraftCore.compiler.isMSVC2017(): + if CraftCore.compiler.isMSVC2019() or CraftCore.compiler.isMSVC2017(): + if CraftCore.compiler.isMSVC2019: + flavor="2019" + else: + flavor="2017" if "VCTOOLSREDISTDIR" in os.environ: redistDir = os.environ["VCTOOLSREDISTDIR"] else: - CraftCore.log.error("Could not find Mycrosoft Visual Studio 2017.\n" - "VCTOOLSREDISTDIR does not exist, and should point to " - r"'*\Microsoft Visual Studio\2017\Community\VC\Redist\MSVC\xx.xx.xxxxx'.") + CraftCore.log.error((r"Could not find Microsoft Visual Studio {0}.\n" + + r"VCTOOLSREDISTDIR does not exist, and likely should point to '*\Microsoft Visual Studio\{0}\Community\VC\Redist\MSVC\xx.xx.xxxxx'.").format(flavor)) elif CraftCore.compiler.isMSVC2015(): if "VCINSTALLDIR" in os.environ: redistDir = os.path.join(os.environ["VCINSTALLDIR"], "redist") else: - CraftCore.log.error("Could not find Mycrosoft Visual Studio 2015.\n" - "VCINSTALLDIR does not exist, and should point to " - r"'*\Microsoft Visual Studio\2015\Community\VC\'.") + CraftCore.log.error("Could not find Microsoft Visual Studio 2015.\n" + + r"VCINSTALLDIR does not exist, and should point to '*\Microsoft Visual Studio\2015\Community\VC\'.") if redistDir: files = glob.glob(os.path.join(redistDir, CraftCore.compiler.architecture, "**/*.dll"), recursive=True) else: diff --git a/etc/CraftCoreSettings.ini b/etc/CraftCoreSettings.ini --- a/etc/CraftCoreSettings.ini +++ b/etc/CraftCoreSettings.ini @@ -3,4 +3,4 @@ [Packager] RepositoryUrl = https://files.kde.org/craft/master/ -CacheVersion = Qt_5.12.2 +CacheVersion = Qt_5.12.0 diff --git a/setup/CraftBootstrap.py b/setup/CraftBootstrap.py --- a/setup/CraftBootstrap.py +++ b/setup/CraftBootstrap.py @@ -172,7 +172,8 @@ abi, compiler = CraftBootstrap.promptForChoice("Select compiler", [("Mingw-w64", ("mingw", "gcc")), ("Microsoft Visual Studio 2015", ("msvc2015", "cl")), - ("Microsoft Visual Studio 2017", ("msvc2017", "cl"))], + ("Microsoft Visual Studio 2017", ("msvc2017", "cl")), + ("Microsoft Visual Studio 2019", ("msvc2019", "cl"))], "Microsoft Visual Studio 2017") abi += f"_{getArchitecture()}" @@ -210,10 +211,15 @@ [("Yes", True), ("No", False)], default="Yes") if not args.dry_run: - CraftBootstrap.downloadFile(f"https://github.com/KDE/craft/archive/{args.branch}.zip", - os.path.join(args.prefix, "download"), - f"craft-{args.branch}.zip") - shutil.unpack_archive(os.path.join(args.prefix, "download", f"craft-{args.branch}.zip"), args.prefix) + if args.localDev: + shutil.copytree(args.localDev, os.path.join(args.prefix, f"craft-{args.branch}"), + ignore=shutil.ignore_patterns(".git")) + print("Getting code from local {}".format(args.localDev)) + else: + CraftBootstrap.downloadFile(f"https://github.com/KDE/craft/archive/{args.branch}.zip", + os.path.join(args.prefix, "download"), + f"craft-{args.branch}.zip") + shutil.unpack_archive(os.path.join(args.prefix, "download", f"craft-{args.branch}.zip"), args.prefix) boot = CraftBootstrap(args.prefix, args.branch, args.dry_run) boot.setSettignsValue("Paths", "Python", os.path.dirname(sys.executable)) @@ -262,6 +268,7 @@ parser.add_argument("--verbose", action="store_true", help="The verbosity.") parser.add_argument("--dry-run", action="store", help="Configure the passed CraftSettings.ini and exit.") parser.add_argument("--version", action="version", version="%(prog)s master") + parser.add_argument("--localDev", action="store", help="Path to a local directory to use instead of fetching from github") args = parser.parse_args() if args.root: diff --git a/setup/install_craft.ps1 b/setup/install_craft.ps1 --- a/setup/install_craft.ps1 +++ b/setup/install_craft.ps1 @@ -1,12 +1,14 @@ param( [alias("root")][string]$Script:installRoot=$null, [alias("python")][string]$Script:python=$null, - [alias("branch")][string]$Script:branch="master" + [alias("branch")][string]$Script:branch="master", + [alias("localdev")][string]$Script:localdev=$null ) - + [Net.ServicePointManager]::SecurityProtocol = "SystemDefault, tls12, tls11" [version]$minPythonVersion = 3.6 $Script:PythonInstallDir = "C:\python36" + if($env:PROCESSOR_ARCHITECTURE.contains("64")) { $Script:pythonUrl = "https://www.python.org/ftp/python/3.6.6/python-3.6.6-amd64.exe" @@ -132,12 +134,20 @@ TestAndFetchPython } &{ +if ($Script:localdev) { +Copy-Item "$Script:localdev\Setup\CraftBootstrap.py" -Dest "$Script:installRoot\download\CraftBootstrap.py" +Write-Host "Copied local CraftBootstrap.py" +} else { $url = "https://raw.githubusercontent.com/KDE/craft/$Script:branch/setup/CraftBootstrap.py" Write-Host "Downloading:" $url (new-object net.webclient).DownloadFile("$url", "$Script:installRoot\download\CraftBootstrap.py") Start-Sleep -s 10 +} [string[]]$command = @("$Script:installRoot\download\CraftBootstrap.py", "--prefix", "$Script:installRoot", "--branch", "$Script:branch") +if ($Script:localdev) { + [string[]]$command += @("--localDev", $Script:localdev) +} Write-Host "$Script:python" $command & "$Script:python" $command cd $Script:installRoot