mirror of https://github.com/aminya/setup-cpp
fix: add arch aliases + support CMake on Windows Arm
This commit is contained in:
parent
e714af79eb
commit
6003b39332
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1,6 +1,8 @@
|
|||
import { info } from "ci-log"
|
||||
import { addExeExt } from "patha"
|
||||
import semverCoerce from "semver/functions/coerce"
|
||||
import semverLte from "semver/functions/lte"
|
||||
import { arm64, x86, x86_64 } from "../utils/env/arch.js"
|
||||
import { type InstallationInfo, type PackageInfo, setupBin } from "../utils/setup/setupBin.js"
|
||||
|
||||
/** Get the platform data for cmake */
|
||||
|
@ -10,10 +12,15 @@ function getCmakePackageInfo(version: string, platform: NodeJS.Platform, arch: s
|
|||
case "win32": {
|
||||
const isOld = semverLte(semVersion, "v3.19.6")
|
||||
let osArchStr: string
|
||||
if (["ia32", "x86", "i386", "x32"].includes(arch)) {
|
||||
osArchStr = isOld ? "win32-x86" : "windows-i386"
|
||||
} else {
|
||||
if (x86_64.includes(arch)) {
|
||||
osArchStr = isOld ? "win64-x64" : "windows-x86_64"
|
||||
} else if (x86.includes(arch)) {
|
||||
osArchStr = isOld ? "win32-x86" : "windows-i386"
|
||||
} else if (arm64.includes(arch)) {
|
||||
osArchStr = "windows-arm64"
|
||||
} else {
|
||||
info(`Trying unsupported arch '${arch}' for cmake on Windows`)
|
||||
osArchStr = `windows-${arch}`
|
||||
}
|
||||
const folderName = `cmake-${version}-${osArchStr}`
|
||||
return {
|
||||
|
@ -37,10 +44,13 @@ function getCmakePackageInfo(version: string, platform: NodeJS.Platform, arch: s
|
|||
case "linux": {
|
||||
const isOld = semverLte(semVersion, "v3.19.8")
|
||||
let osArchStr: string
|
||||
if (["aarch64"].includes(arch)) {
|
||||
if (arm64.includes(arch)) {
|
||||
osArchStr = isOld ? "Linux-aarch64" : "linux-aarch64"
|
||||
} else {
|
||||
} else if (x86_64.includes(arch)) {
|
||||
osArchStr = isOld ? "Linux-x86_64" : "linux-x86_64"
|
||||
} else {
|
||||
info(`Trying unsupported arch '${arch}' for cmake on Linux`)
|
||||
osArchStr = `linux-${arch}`
|
||||
}
|
||||
const folderName = `cmake-${version}-${osArchStr}`
|
||||
return {
|
||||
|
|
|
@ -3,6 +3,7 @@ import { fileURLToPath } from "url"
|
|||
import { info } from "ci-log"
|
||||
import { addExeExt } from "patha"
|
||||
import { loadAssetList, matchAsset } from "../utils/asset/load-assets.js"
|
||||
import { arm64, armv7, powerpc64le, sparc64, x86, x86_64 } from "../utils/env/arch.js"
|
||||
import { hasDnf } from "../utils/env/hasDnf.js"
|
||||
import { isUbuntu } from "../utils/env/isUbuntu.js"
|
||||
import { ubuntuVersion } from "../utils/env/ubuntu_version.js"
|
||||
|
@ -85,32 +86,15 @@ async function getAssetKeywords(platform: string, arch: string) {
|
|||
|
||||
switch (platform) {
|
||||
case "win32": {
|
||||
switch (arch) {
|
||||
case "win64":
|
||||
case "x64":
|
||||
case "amd64":
|
||||
case "x86_64":
|
||||
case "64":
|
||||
keywords.push("win64")
|
||||
break
|
||||
case "win32":
|
||||
case "x86":
|
||||
case "i386":
|
||||
case "ia32":
|
||||
case "32":
|
||||
keywords.push("win32")
|
||||
break
|
||||
case "woa64":
|
||||
case "aarch64":
|
||||
case "arm64":
|
||||
case "arm": {
|
||||
keywords.push("woa64")
|
||||
break
|
||||
}
|
||||
default:
|
||||
info(`Using arch ${arch} for LLVM`)
|
||||
keywords.push(arch)
|
||||
break
|
||||
if (x86_64.includes(arch)) {
|
||||
keywords.push("win64")
|
||||
} else if (x86.includes(arch)) {
|
||||
keywords.push("win32")
|
||||
} else if (arm64.includes(arch)) {
|
||||
keywords.push("woa64")
|
||||
} else {
|
||||
info(`Using arch ${arch} for LLVM`)
|
||||
keywords.push(arch)
|
||||
}
|
||||
break
|
||||
}
|
||||
|
@ -132,39 +116,21 @@ async function getAssetKeywords(platform: string, arch: string) {
|
|||
optionalKeywords.push("rhel")
|
||||
}
|
||||
|
||||
switch (arch) {
|
||||
case "x86_64":
|
||||
case "x64":
|
||||
case "amd64":
|
||||
case "64":
|
||||
keywords.push("x86_64")
|
||||
break
|
||||
case "x86":
|
||||
case "i386":
|
||||
case "ia32":
|
||||
case "32":
|
||||
keywords.push("x86")
|
||||
break
|
||||
case "aarch64":
|
||||
case "arm64":
|
||||
case "arm":
|
||||
keywords.push("aarch64")
|
||||
break
|
||||
case "armv7a":
|
||||
case "armv7":
|
||||
keywords.push("armv7a")
|
||||
break
|
||||
case "powerpc64le":
|
||||
case "ppc64le":
|
||||
keywords.push("powerpc64le")
|
||||
break
|
||||
case "sparc64":
|
||||
keywords.push("sparc64")
|
||||
break
|
||||
default:
|
||||
info(`Using arch ${arch} for LLVM`)
|
||||
keywords.push(arch)
|
||||
break
|
||||
if (x86_64.includes(arch)) {
|
||||
keywords.push("x86_64")
|
||||
} else if (x86.includes(arch)) {
|
||||
keywords.push("x86")
|
||||
} else if (arm64.includes(arch)) {
|
||||
keywords.push("aarch64")
|
||||
} else if (armv7.includes(arch)) {
|
||||
keywords.push("armv7a")
|
||||
} else if (powerpc64le.includes(arch)) {
|
||||
keywords.push("powerpc64le")
|
||||
} else if (sparc64.includes(arch)) {
|
||||
keywords.push("sparc64")
|
||||
} else {
|
||||
info(`Using arch ${arch} for LLVM`)
|
||||
keywords.push(arch)
|
||||
}
|
||||
|
||||
break
|
||||
|
@ -172,46 +138,27 @@ async function getAssetKeywords(platform: string, arch: string) {
|
|||
case "darwin": {
|
||||
keywords.push("apple")
|
||||
|
||||
switch (arch) {
|
||||
case "x86_64":
|
||||
case "x64":
|
||||
case "amd64":
|
||||
case "64":
|
||||
keywords.push("x86_64")
|
||||
break
|
||||
case "arm64":
|
||||
case "arm":
|
||||
case "aarch64":
|
||||
// allow falling back to x86_64 if arm64 is not available
|
||||
optionalKeywords.push("arm64")
|
||||
break
|
||||
default:
|
||||
info(`Using arch ${arch} for LLVM`)
|
||||
keywords.push(arch)
|
||||
break
|
||||
if (x86_64.includes(arch)) {
|
||||
keywords.push("x86_64")
|
||||
} else if (arm64.includes(arch)) {
|
||||
// allow falling back to x86_64 if arm64 is not available
|
||||
optionalKeywords.push("arm64")
|
||||
} else {
|
||||
info(`Using arch ${arch} for LLVM`)
|
||||
keywords.push(arch)
|
||||
}
|
||||
break
|
||||
}
|
||||
case "freebsd": {
|
||||
keywords.push("freebsd")
|
||||
|
||||
switch (arch) {
|
||||
case "x86_64":
|
||||
case "x64":
|
||||
case "amd64":
|
||||
case "64":
|
||||
keywords.push("amd64")
|
||||
break
|
||||
case "x86":
|
||||
case "i386":
|
||||
case "ia32":
|
||||
case "32":
|
||||
keywords.push("i386")
|
||||
break
|
||||
default:
|
||||
info(`Using arch ${arch} for LLVM`)
|
||||
keywords.push(arch)
|
||||
break
|
||||
if (x86_64.includes(arch)) {
|
||||
keywords.push("amd64")
|
||||
} else if (x86.includes(arch)) {
|
||||
keywords.push("i386")
|
||||
} else {
|
||||
info(`Using arch ${arch} for LLVM`)
|
||||
keywords.push(arch)
|
||||
}
|
||||
|
||||
break
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import { info } from "ci-log"
|
||||
import { readFile } from "fs/promises"
|
||||
|
||||
/**
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
export const x86_64 = ["x64", "amd64", "x86_64", "win64", "64"]
|
||||
export const x86 = ["x86", "i386", "ia32", "win32", "32", "x32"]
|
||||
export const arm64 = ["aarch64", "arm64", "woa64", "arm"]
|
||||
export const armv7 = ["armv7", "armv7a"]
|
||||
export const powerpc64le = ["powerpc64le", "ppc64le"]
|
||||
export const sparc64 = ["sparc64"]
|
Loading…
Reference in New Issue