def GetVersion() -> CMakeVersion: exeName = PlatformUtil.GetPlatformDependentExecuteableName( "cmake", PlatformUtil.DetectBuildPlatformType()) path = IOUtil.TryFindExecutable(exeName) if path is None: raise Exception( "Could not locate cmake in path. Please install cmake 3.10.2+ (https://cmake.org/) as it is used to generate build files." ) cmd = [path, "--version"] version = CMakeUtil.RunCommand(cmd) versionString = "cmake version " if not version.startswith(versionString): raise Exception( "Failed to parse cmake version string '{0}'".format( versionString)) version = version[len(versionString):] indexEnd = version.find('\n') indexEnd = indexEnd if indexEnd >= 0 else len(version) version = version[0:indexEnd].strip() parsedVersion = version.split('.') if len(parsedVersion) < 3: raise Exception( "Failed to parse cmake version string: '{0}'".format(version)) while len(parsedVersion) < 3: parsedVersion.append("0") indexNonDigit = CMakeUtil._FindNonDigit(parsedVersion[2]) strBuild = parsedVersion[2][:indexNonDigit] return CMakeVersion(int(parsedVersion[0]), int(parsedVersion[1]), int(strBuild))
def GetVersion() -> CMakeVersion: exeName = PlatformUtil.GetPlatformDependentExecuteableName( "cmake", PlatformUtil.DetectBuildPlatformType()) path = IOUtil.TryFindExecutable(exeName) if path is None: raise Exception("Could not locate cmake in path") cmd = [path, "--version"] version = RunCommand(cmd) versionString = "cmake version " if not version.startswith(versionString): raise Exception( "Failed to parse cmake version string '{0}'".format( versionString)) version = version[len(versionString):] indexEnd = version.find('\n') indexEnd = indexEnd if indexEnd >= 0 else len(version) version = version[0:indexEnd] indexEndMajor = version.index('.') indexEndMinor = version.index('.', indexEndMajor + 1) versionMajor = version[0:indexEndMajor] versionMinor = version[indexEndMajor + 1:indexEndMinor] return CMakeVersion(int(versionMajor), int(versionMinor))
def CheckToolCommand(self, toolCommand: str, toolDescription: str) -> None: if IOUtil.TryFindExecutable(toolCommand) is None: raise EnvironmentError( "Could not locate the content builder '{0}' ({1})".format( toolCommand, toolDescription))
def CheckVulkanShaderCompiler(self) -> None: if IOUtil.TryFindExecutable(self.VulkanShaderCompiler) is None: raise EnvironmentError( "Could not locate the Vulkan shader compiler: '{0}'".format( self.VulkanShaderCompiler))