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 { addExeExt } from "patha"
|
||||||
import semverCoerce from "semver/functions/coerce"
|
import semverCoerce from "semver/functions/coerce"
|
||||||
import semverLte from "semver/functions/lte"
|
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"
|
import { type InstallationInfo, type PackageInfo, setupBin } from "../utils/setup/setupBin.js"
|
||||||
|
|
||||||
/** Get the platform data for cmake */
|
/** Get the platform data for cmake */
|
||||||
|
@ -10,10 +12,15 @@ function getCmakePackageInfo(version: string, platform: NodeJS.Platform, arch: s
|
||||||
case "win32": {
|
case "win32": {
|
||||||
const isOld = semverLte(semVersion, "v3.19.6")
|
const isOld = semverLte(semVersion, "v3.19.6")
|
||||||
let osArchStr: string
|
let osArchStr: string
|
||||||
if (["ia32", "x86", "i386", "x32"].includes(arch)) {
|
if (x86_64.includes(arch)) {
|
||||||
osArchStr = isOld ? "win32-x86" : "windows-i386"
|
|
||||||
} else {
|
|
||||||
osArchStr = isOld ? "win64-x64" : "windows-x86_64"
|
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}`
|
const folderName = `cmake-${version}-${osArchStr}`
|
||||||
return {
|
return {
|
||||||
|
@ -37,10 +44,13 @@ function getCmakePackageInfo(version: string, platform: NodeJS.Platform, arch: s
|
||||||
case "linux": {
|
case "linux": {
|
||||||
const isOld = semverLte(semVersion, "v3.19.8")
|
const isOld = semverLte(semVersion, "v3.19.8")
|
||||||
let osArchStr: string
|
let osArchStr: string
|
||||||
if (["aarch64"].includes(arch)) {
|
if (arm64.includes(arch)) {
|
||||||
osArchStr = isOld ? "Linux-aarch64" : "linux-aarch64"
|
osArchStr = isOld ? "Linux-aarch64" : "linux-aarch64"
|
||||||
} else {
|
} else if (x86_64.includes(arch)) {
|
||||||
osArchStr = isOld ? "Linux-x86_64" : "linux-x86_64"
|
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}`
|
const folderName = `cmake-${version}-${osArchStr}`
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -3,6 +3,7 @@ import { fileURLToPath } from "url"
|
||||||
import { info } from "ci-log"
|
import { info } from "ci-log"
|
||||||
import { addExeExt } from "patha"
|
import { addExeExt } from "patha"
|
||||||
import { loadAssetList, matchAsset } from "../utils/asset/load-assets.js"
|
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 { hasDnf } from "../utils/env/hasDnf.js"
|
||||||
import { isUbuntu } from "../utils/env/isUbuntu.js"
|
import { isUbuntu } from "../utils/env/isUbuntu.js"
|
||||||
import { ubuntuVersion } from "../utils/env/ubuntu_version.js"
|
import { ubuntuVersion } from "../utils/env/ubuntu_version.js"
|
||||||
|
@ -85,32 +86,15 @@ async function getAssetKeywords(platform: string, arch: string) {
|
||||||
|
|
||||||
switch (platform) {
|
switch (platform) {
|
||||||
case "win32": {
|
case "win32": {
|
||||||
switch (arch) {
|
if (x86_64.includes(arch)) {
|
||||||
case "win64":
|
|
||||||
case "x64":
|
|
||||||
case "amd64":
|
|
||||||
case "x86_64":
|
|
||||||
case "64":
|
|
||||||
keywords.push("win64")
|
keywords.push("win64")
|
||||||
break
|
} else if (x86.includes(arch)) {
|
||||||
case "win32":
|
|
||||||
case "x86":
|
|
||||||
case "i386":
|
|
||||||
case "ia32":
|
|
||||||
case "32":
|
|
||||||
keywords.push("win32")
|
keywords.push("win32")
|
||||||
break
|
} else if (arm64.includes(arch)) {
|
||||||
case "woa64":
|
|
||||||
case "aarch64":
|
|
||||||
case "arm64":
|
|
||||||
case "arm": {
|
|
||||||
keywords.push("woa64")
|
keywords.push("woa64")
|
||||||
break
|
} else {
|
||||||
}
|
|
||||||
default:
|
|
||||||
info(`Using arch ${arch} for LLVM`)
|
info(`Using arch ${arch} for LLVM`)
|
||||||
keywords.push(arch)
|
keywords.push(arch)
|
||||||
break
|
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
@ -132,39 +116,21 @@ async function getAssetKeywords(platform: string, arch: string) {
|
||||||
optionalKeywords.push("rhel")
|
optionalKeywords.push("rhel")
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (arch) {
|
if (x86_64.includes(arch)) {
|
||||||
case "x86_64":
|
|
||||||
case "x64":
|
|
||||||
case "amd64":
|
|
||||||
case "64":
|
|
||||||
keywords.push("x86_64")
|
keywords.push("x86_64")
|
||||||
break
|
} else if (x86.includes(arch)) {
|
||||||
case "x86":
|
|
||||||
case "i386":
|
|
||||||
case "ia32":
|
|
||||||
case "32":
|
|
||||||
keywords.push("x86")
|
keywords.push("x86")
|
||||||
break
|
} else if (arm64.includes(arch)) {
|
||||||
case "aarch64":
|
|
||||||
case "arm64":
|
|
||||||
case "arm":
|
|
||||||
keywords.push("aarch64")
|
keywords.push("aarch64")
|
||||||
break
|
} else if (armv7.includes(arch)) {
|
||||||
case "armv7a":
|
|
||||||
case "armv7":
|
|
||||||
keywords.push("armv7a")
|
keywords.push("armv7a")
|
||||||
break
|
} else if (powerpc64le.includes(arch)) {
|
||||||
case "powerpc64le":
|
|
||||||
case "ppc64le":
|
|
||||||
keywords.push("powerpc64le")
|
keywords.push("powerpc64le")
|
||||||
break
|
} else if (sparc64.includes(arch)) {
|
||||||
case "sparc64":
|
|
||||||
keywords.push("sparc64")
|
keywords.push("sparc64")
|
||||||
break
|
} else {
|
||||||
default:
|
|
||||||
info(`Using arch ${arch} for LLVM`)
|
info(`Using arch ${arch} for LLVM`)
|
||||||
keywords.push(arch)
|
keywords.push(arch)
|
||||||
break
|
|
||||||
}
|
}
|
||||||
|
|
||||||
break
|
break
|
||||||
|
@ -172,46 +138,27 @@ async function getAssetKeywords(platform: string, arch: string) {
|
||||||
case "darwin": {
|
case "darwin": {
|
||||||
keywords.push("apple")
|
keywords.push("apple")
|
||||||
|
|
||||||
switch (arch) {
|
if (x86_64.includes(arch)) {
|
||||||
case "x86_64":
|
|
||||||
case "x64":
|
|
||||||
case "amd64":
|
|
||||||
case "64":
|
|
||||||
keywords.push("x86_64")
|
keywords.push("x86_64")
|
||||||
break
|
} else if (arm64.includes(arch)) {
|
||||||
case "arm64":
|
|
||||||
case "arm":
|
|
||||||
case "aarch64":
|
|
||||||
// allow falling back to x86_64 if arm64 is not available
|
// allow falling back to x86_64 if arm64 is not available
|
||||||
optionalKeywords.push("arm64")
|
optionalKeywords.push("arm64")
|
||||||
break
|
} else {
|
||||||
default:
|
|
||||||
info(`Using arch ${arch} for LLVM`)
|
info(`Using arch ${arch} for LLVM`)
|
||||||
keywords.push(arch)
|
keywords.push(arch)
|
||||||
break
|
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
case "freebsd": {
|
case "freebsd": {
|
||||||
keywords.push("freebsd")
|
keywords.push("freebsd")
|
||||||
|
|
||||||
switch (arch) {
|
if (x86_64.includes(arch)) {
|
||||||
case "x86_64":
|
|
||||||
case "x64":
|
|
||||||
case "amd64":
|
|
||||||
case "64":
|
|
||||||
keywords.push("amd64")
|
keywords.push("amd64")
|
||||||
break
|
} else if (x86.includes(arch)) {
|
||||||
case "x86":
|
|
||||||
case "i386":
|
|
||||||
case "ia32":
|
|
||||||
case "32":
|
|
||||||
keywords.push("i386")
|
keywords.push("i386")
|
||||||
break
|
} else {
|
||||||
default:
|
|
||||||
info(`Using arch ${arch} for LLVM`)
|
info(`Using arch ${arch} for LLVM`)
|
||||||
keywords.push(arch)
|
keywords.push(arch)
|
||||||
break
|
|
||||||
}
|
}
|
||||||
|
|
||||||
break
|
break
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
import { info } from "ci-log"
|
|
||||||
import { readFile } from "fs/promises"
|
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