mirror of https://github.com/aminya/setup-cpp
fix: unset LLVM CPPFLAGS when llvm is not used as the compiler
This commit is contained in:
parent
6ed018c894
commit
a8d76c6b53
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
18
src/main.ts
18
src/main.ts
|
@ -160,6 +160,8 @@ export async function main(args: string[]): Promise<number> {
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let hasLLVM = false // used to unset CPPFLAGS of LLVM when other compilers are used as the main compiler
|
||||||
|
|
||||||
// loop over the tools and run their setup function
|
// loop over the tools and run their setup function
|
||||||
for (const tool of tools) {
|
for (const tool of tools) {
|
||||||
// get the version or "true" or undefined for this tool from the options
|
// get the version or "true" or undefined for this tool from the options
|
||||||
|
@ -187,8 +189,10 @@ export async function main(args: string[]): Promise<number> {
|
||||||
// get the setup function
|
// get the setup function
|
||||||
const setupFunction = setups[tool]
|
const setupFunction = setups[tool]
|
||||||
|
|
||||||
|
hasLLVM = ["llvm", "clangformat", "clangtidy"].includes(tool)
|
||||||
|
|
||||||
// the tool installation directory (for the functions that ue it)
|
// the tool installation directory (for the functions that ue it)
|
||||||
const setupDir = join(setupCppDir, ["llvm", "clangformat", "clangtidy"].includes(tool) ? "llvm" : tool)
|
const setupDir = join(setupCppDir, hasLLVM ? "llvm" : tool)
|
||||||
|
|
||||||
// eslint-disable-next-line no-await-in-loop
|
// eslint-disable-next-line no-await-in-loop
|
||||||
installationInfo = await setupFunction(getVersion(tool, version, osVersion), setupDir, arch)
|
installationInfo = await setupFunction(getVersion(tool, version, osVersion), setupDir, arch)
|
||||||
|
@ -232,6 +236,12 @@ export async function main(args: string[]): Promise<number> {
|
||||||
case "cygwin":
|
case "cygwin":
|
||||||
case "msys": {
|
case "msys": {
|
||||||
const installationInfo = await setupGcc(getVersion("gcc", version, osVersion), join(setupCppDir, "gcc"), arch)
|
const installationInfo = await setupGcc(getVersion("gcc", version, osVersion), join(setupCppDir, "gcc"), arch)
|
||||||
|
|
||||||
|
if (hasLLVM) {
|
||||||
|
// remove the CPPFLAGS of LLVM that include the LLVM headers
|
||||||
|
await addEnv("CPPFLAGS", "")
|
||||||
|
}
|
||||||
|
|
||||||
successMessages.push(getSuccessMessage("gcc", installationInfo))
|
successMessages.push(getSuccessMessage("gcc", installationInfo))
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
@ -247,6 +257,12 @@ export async function main(args: string[]): Promise<number> {
|
||||||
join(setupCppDir, "msvc"),
|
join(setupCppDir, "msvc"),
|
||||||
arch
|
arch
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if (hasLLVM) {
|
||||||
|
// remove the CPPFLAGS of LLVM that include the LLVM headers
|
||||||
|
await addEnv("CPPFLAGS", "")
|
||||||
|
}
|
||||||
|
|
||||||
successMessages.push(getSuccessMessage("msvc", installationInfo))
|
successMessages.push(getSuccessMessage("msvc", installationInfo))
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue