mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-07 17:56:01 +02:00
Merge ba7e53cd22
into b4d81a130e
This commit is contained in:
commit
f31c30ec31
1 changed files with 20 additions and 16 deletions
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2010, 2016 Nokia Siemens Networks Oyj, Finland.
|
* Copyright (c) 2010, 2025 Nokia Siemens Networks Oyj, Finland.
|
||||||
*
|
*
|
||||||
* This program and the accompanying materials
|
* This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License 2.0
|
* are made available under the terms of the Eclipse Public License 2.0
|
||||||
|
@ -13,11 +13,13 @@
|
||||||
* Leo Hippelainen - Initial implementation
|
* Leo Hippelainen - Initial implementation
|
||||||
* Petri Tuononen - Initial implementation
|
* Petri Tuononen - Initial implementation
|
||||||
* Marc-Andre Laperle (Ericsson)
|
* Marc-Andre Laperle (Ericsson)
|
||||||
|
* John Dallaway - Improve LLVM tools installation detection (#1175)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.managedbuilder.llvm.ui;
|
package org.eclipse.cdt.managedbuilder.llvm.ui;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import org.eclipse.cdt.internal.core.MinGW;
|
import org.eclipse.cdt.internal.core.MinGW;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
||||||
|
@ -48,6 +50,7 @@ public class LlvmEnvironmentVariableSupplier implements IConfigurationEnvironmen
|
||||||
private static final String ENV_VAR_NAME_INCLUDE_PATH = "INCLUDE_PATH"; //$NON-NLS-1$
|
private static final String ENV_VAR_NAME_INCLUDE_PATH = "INCLUDE_PATH"; //$NON-NLS-1$
|
||||||
private static final String ENV_VAR_NAME_LIBRARY_PATH = "LLVM_LIB_SEARCH_PATH"; //$NON-NLS-1$
|
private static final String ENV_VAR_NAME_LIBRARY_PATH = "LLVM_LIB_SEARCH_PATH"; //$NON-NLS-1$
|
||||||
private static final String ENV_VAR_NAME_LIBRARIES = "LIBRARIES"; //$NON-NLS-1$
|
private static final String ENV_VAR_NAME_LIBRARIES = "LIBRARIES"; //$NON-NLS-1$
|
||||||
|
private static final List<String> LLVM_BIN_SELECTION_TOOLS = List.of("llvm-ar", "clang"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes llvm environment variable paths from the system environment variables.
|
* Initializes llvm environment variable paths from the system environment variables.
|
||||||
|
@ -268,7 +271,7 @@ public class LlvmEnvironmentVariableSupplier implements IConfigurationEnvironmen
|
||||||
llvmPath = llvmPath + Separators.getFileSeparator() + subPath;
|
llvmPath = llvmPath + Separators.getFileSeparator() + subPath;
|
||||||
}
|
}
|
||||||
// Return a full path for LLVM executable if it's valid, otherwise null.
|
// Return a full path for LLVM executable if it's valid, otherwise null.
|
||||||
return getBinDirIfLlvm_ar(llvmPath);
|
return getBinDirIfLlvm(llvmPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -276,12 +279,12 @@ public class LlvmEnvironmentVariableSupplier implements IConfigurationEnvironmen
|
||||||
* as a parameter is found and executable exists in that path.
|
* as a parameter is found and executable exists in that path.
|
||||||
*
|
*
|
||||||
* @param binPathTemp User provided bin directory path
|
* @param binPathTemp User provided bin directory path
|
||||||
* @return bin path where llvm-ar is located if executable exists
|
* @return bin path where LLVM is located if executable exists
|
||||||
*/
|
*/
|
||||||
private static String getBinDirIfLlvm_ar(String binPathTemp) {
|
private static String getBinDirIfLlvm(String binPathTemp) {
|
||||||
//if given directory is found
|
//if given directory is found
|
||||||
if (new Path(binPathTemp).toFile().isDirectory()) {
|
if (new Path(binPathTemp).toFile().isDirectory()) {
|
||||||
String llvm_executable = "llvm-ar"; //$NON-NLS-1$
|
for (String llvm_executable : LLVM_BIN_SELECTION_TOOLS) {
|
||||||
File arFileFullPath = null;
|
File arFileFullPath = null;
|
||||||
// If OS is Windows -> add .exe to the executable name.
|
// If OS is Windows -> add .exe to the executable name.
|
||||||
if (System.getProperty("os.name").toLowerCase().indexOf("win") >= 0) { //$NON-NLS-1$//$NON-NLS-2$
|
if (System.getProperty("os.name").toLowerCase().indexOf("win") >= 0) { //$NON-NLS-1$//$NON-NLS-2$
|
||||||
|
@ -291,10 +294,11 @@ public class LlvmEnvironmentVariableSupplier implements IConfigurationEnvironmen
|
||||||
arFileFullPath = new File(binPathTemp, llvm_executable);
|
arFileFullPath = new File(binPathTemp, llvm_executable);
|
||||||
// Check if file exists -> proper LLVM installation exists.
|
// Check if file exists -> proper LLVM installation exists.
|
||||||
if (arFileFullPath.isFile()) {
|
if (arFileFullPath.isFile()) {
|
||||||
// Return path where llvm-ar exists.
|
// Return path where LLVM executable exists.
|
||||||
return binPathTemp;
|
return binPathTemp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue