Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Use CMake's built-in toolchain detection #23998

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 0 additions & 43 deletions src/pal/tools/gen-buildsys-clang.sh
Original file line number Diff line number Diff line change
Expand Up @@ -74,45 +74,6 @@ done

OS=`uname`

# Locate llvm
# This can be a little complicated, because the common use-case of Ubuntu with
# llvm-3.5 installed uses a rather unusual llvm installation with the version
# number postfixed (i.e. llvm-ar-3.5), so we check for that first.
# On FreeBSD the version number is appended without point and dash (i.e.
# llvm-ar35).
# Additionally, OSX doesn't use the llvm- prefix.
if [ $OS = "Linux" -o $OS = "FreeBSD" -o $OS = "OpenBSD" -o $OS = "NetBSD" -o $OS = "SunOS" ]; then
llvm_prefix="llvm-"
elif [ $OS = "Darwin" ]; then
llvm_prefix=""
else
echo "Unable to determine build platform"
exit 1
fi

locate_llvm_exec() {
if command -v "$llvm_prefix$1$desired_llvm_version" > /dev/null 2>&1
then
echo "$(command -v $llvm_prefix$1$desired_llvm_version)"
elif command -v "$llvm_prefix$1" > /dev/null 2>&1
then
echo "$(command -v $llvm_prefix$1)"
else
exit 1
fi
}

llvm_ar="$(locate_llvm_exec ar)"
[[ $? -eq 0 ]] || { echo "Unable to locate llvm-ar"; exit 1; }
llvm_link="$(locate_llvm_exec link)"
[[ $? -eq 0 ]] || { echo "Unable to locate llvm-link"; exit 1; }
llvm_nm="$(locate_llvm_exec nm)"
[[ $? -eq 0 ]] || { echo "Unable to locate llvm-nm"; exit 1; }
if [ $OS = "Linux" -o $OS = "FreeBSD" -o $OS = "OpenBSD" -o $OS = "NetBSD" -o $OS = "SunOS" ]; then
llvm_objdump="$(locate_llvm_exec objdump)"
[[ $? -eq 0 ]] || { echo "Unable to locate llvm-objdump"; exit 1; }
fi

cmake_extra_defines=
if [[ -n "$LLDB_LIB_DIR" ]]; then
cmake_extra_defines="$cmake_extra_defines -DWITH_LLDB_LIBS=$LLDB_LIB_DIR"
Expand Down Expand Up @@ -171,10 +132,6 @@ fi
$cmake_command \
-G "$generator" \
"-DCMAKE_USER_MAKE_RULES_OVERRIDE=${__currentScriptDir}/$overridefile" \
"-DCMAKE_AR=$llvm_ar" \
"-DCMAKE_LINKER=$llvm_link" \
"-DCMAKE_NM=$llvm_nm" \
"-DCMAKE_OBJDUMP=$llvm_objdump" \
"-DCMAKE_BUILD_TYPE=$buildtype" \
"-DCMAKE_EXPORT_COMPILE_COMMANDS=1 " \
"-DCLR_CMAKE_ENABLE_CODE_COVERAGE=$code_coverage" \
Expand Down
38 changes: 0 additions & 38 deletions src/pal/tools/gen-buildsys-gcc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -91,38 +91,6 @@ done

OS=$(uname)

locate_gcc_exec() {
ENV_KNOB="CLR_$(echo "$1" | tr '[:lower:]' '[:upper:]')"
if env | grep -q "^$ENV_KNOB="; then
eval "echo \"\$$ENV_KNOB\""
return
fi

if command -v "$gcc_prefix$1$desired_gcc_version" > /dev/null 2>&1
then
command -v "$gcc_prefix$1$desired_gcc_version"
elif command -v "$gcc_prefix$1" > /dev/null 2>&1
then
command -v "$gcc_prefix$1"
else
exit 1
fi
}

if ! gcc_link="$(locate_gcc_exec link)"; then { echo "Unable to locate link"; exit 1; } fi

if ! gcc_ar="$(locate_gcc_exec ar)"; then { echo "Unable to locate gcc-ar"; exit 1; } fi

if ! gcc_nm="$(locate_gcc_exec nm)"; then { echo "Unable to locate gcc-nm"; exit 1; } fi

if [ "$OS" = "Linux" ] || [ "$OS" = "FreeBSD" ] || [ "$OS" = "OpenBSD" ] || [ "$OS" = "NetBSD" ] || [ "$OS" = "SunOS" ]; then
if ! gcc_objdump="$(locate_gcc_exec objdump)"; then { echo "Unable to locate gcc-objdump"; exit 1; } fi
fi

if ! gcc_objcopy="$(locate_gcc_exec objcopy)"; then { echo "Unable to locate gcc-objcopy"; exit 1; } fi

if ! gcc_ranlib="$(locate_gcc_exec ranlib)"; then { echo "Unable to locate gcc-ranlib"; exit 1; } fi

cmake_extra_defines=
if [ -n "$LLDB_LIB_DIR" ]; then
cmake_extra_defines="$cmake_extra_defines -DWITH_LLDB_LIBS=$LLDB_LIB_DIR"
Expand Down Expand Up @@ -165,12 +133,6 @@ __currentScriptDir="$script_dir"
cmake \
-G "$generator" \
"-DCMAKE_USER_MAKE_RULES_OVERRIDE=${__currentScriptDir}/$overridefile" \
"-DCMAKE_AR=$gcc_ar" \
"-DCMAKE_LINKER=$gcc_link" \
"-DCMAKE_NM=$gcc_nm" \
"-DCMAKE_RANLIB=$gcc_ranlib" \
"-DCMAKE_OBJCOPY=$gcc_objcopy" \
"-DCMAKE_OBJDUMP=$gcc_objdump" \
"-DCMAKE_BUILD_TYPE=$buildtype" \
"-DCMAKE_EXPORT_COMPILE_COMMANDS=1 " \
"-DCLR_CMAKE_ENABLE_CODE_COVERAGE=$code_coverage" \
Expand Down