--- /dev/null
+#!/usr/bin/env bash
+#
+# This file invokes cmake and generates the build system for Clang.
+#
+
+source="${BASH_SOURCE[0]}"
+
+# resolve $SOURCE until the file is no longer a symlink
+while [[ -h $source ]]; do
+ scriptroot="$( cd -P "$( dirname "$source" )" && pwd )"
+ source="$(readlink "$source")"
+
+ # if $source was a relative symlink, we need to resolve it relative to the path where the
+ # symlink file was located
+ [[ $source != /* ]] && source="$scriptroot/$source"
+done
+scriptroot="$( cd -P "$( dirname "$source" )" && pwd )"
+
+if [ $# -lt 4 ]
+then
+ echo "Usage..."
+ echo "gen-buildsys.sh <path to top level CMakeLists.txt> <path to intermediate directory> <path to tryrun.cmake directory> <Architecture> <compiler> <compiler major version> <compiler minor version> [build flavor] [ninja] [scan-build] [cmakeargs]"
+ echo "Specify the path to the top level CMake file."
+ echo "Specify the path to the directory with tryrun.cmake file."
+ echo "Specify the path that the build system files are generated in."
+ echo "Specify the target architecture."
+ echo "Specify the name of compiler (clang or gcc)."
+ echo "Specify the major version of compiler."
+ echo "Specify the minor version of compiler."
+ echo "Optionally specify the build configuration (flavor.) Defaults to DEBUG."
+ echo "Optionally specify 'scan-build' to enable build with clang static analyzer."
+ echo "Use the Ninja generator instead of the Unix Makefiles generator."
+ echo "Pass additional arguments to CMake call."
+ exit 1
+fi
+
+tryrun_dir="$2"
+build_arch="$4"
+compiler="$5"
+cxxCompiler="$compiler++"
+majorVersion="$6"
+minorVersion="$7"
+
+if [ "$compiler" = "gcc" ]; then cxxCompiler="g++"; fi
+
+check_version_exists() {
+ desired_version=-1
+
+ # Set up the environment to be used for building with the desired compiler.
+ if command -v "$compiler-$1.$2" > /dev/null; then
+ desired_version="-$1.$2"
+ elif command -v "$compier$1$2" > /dev/null; then
+ desired_version="$1$2"
+ elif command -v "$compiler-$1$2" > /dev/null; then
+ desired_version="-$1$2"
+ fi
+
+ echo "$desired_version"
+}
+
+if [ -z "$CLR_CC" ]; then
+
+ # Set default versions
+ if [ -z "$majorVersion" ]; then
+ # note: gcc (all versions) and clang versions higher than 6 do not have minor version in file name, if it is zero.
+ if [ "$compiler" = "clang" ]; then versions=( 9 8 7 6.0 5.0 4.0 3.9 3.8 3.7 3.6 3.5 )
+ elif [ "$compiler" = "gcc" ]; then versions=( 9 8 7 6 5 4.9 ); fi
+
+ for version in "${versions[@]}"; do
+ parts=(${version//./ })
+ desired_version="$(check_version_exists "${parts[0]}" "${parts[1]}")"
+ if [ "$desired_version" != "-1" ]; then majorVersion="${parts[0]}"; break; fi
+ done
+
+ if [ -z "$majorVersion" ]; then
+ if command -v "$compiler" > /dev/null; then
+ if [ "$(uname)" != "Darwin" ]; then
+ echo "WARN: Specific version of $compiler not found, falling back to use the one in PATH."
+ fi
+ export CC="$(command -v "$compiler")"
+ export CXX="$(command -v "$cxxCompiler")"
+ else
+ echo "ERROR: No usable version of $compiler found."
+ exit 1
+ fi
+ else
+ if [ "$compiler" = "clang" ] && [ "$majorVersion" -lt 5 ]; then
+ if [ "$build_arch" = "arm" ] || [ "$build_arch" = "armel" ]; then
+ if command -v "$compiler" > /dev/null; then
+ echo "WARN: Found clang version $majorVersion which is not supported on arm/armel architectures, falling back to use clang from PATH."
+ export CC="$(command -v "$compiler")"
+ export CXX="$(command -v "$cxxCompiler")"
+ else
+ echo "ERROR: Found clang version $majorVersion which is not supported on arm/armel architectures, and there is no clang in PATH."
+ exit 1
+ fi
+ fi
+ fi
+ fi
+ else
+ desired_version="$(check_version_exists "$majorVersion" "$minorVersion")"
+ if [ "$desired_version" = "-1" ]; then
+ echo "ERROR: Could not find specific version of $compiler: $majorVersion $minorVersion."
+ exit 1
+ fi
+ fi
+
+ if [ -z "$CC" ]; then
+ export CC="$(command -v "$compiler$desired_version")"
+ export CXX="$(command -v "$cxxCompiler$desired_version")"
+ if [ -z "$CXX" ]; then export CXX="$(command -v "$cxxCompiler")"; fi
+ fi
+else
+ if [ ! -f "$CLR_CC" ]; then
+ echo "ERROR: CLR_CC is set but path '$CLR_CC' does not exist"
+ exit 1
+ fi
+ export CC="$CLR_CC"
+ export CXX="$CLR_CXX"
+fi
+
+if [ -z "$CC" ]; then
+ echo "ERROR: Unable to find $compiler."
+ exit 1
+fi
+
+export CCC_CC="$CC"
+export CCC_CXX="$CXX"
+export SCAN_BUILD_COMMAND="$(command -v "scan-build$desired_version")"
+
+buildtype=DEBUG
+code_coverage=OFF
+build_tests=OFF
+scan_build=OFF
+generator="Unix Makefiles"
+__UnprocessedCMakeArgs=""
+
+for i in "${@:8}"; do
+ upperI="$(echo $i | awk '{print toupper($0)}')"
+ case $upperI in
+ # Possible build types are DEBUG, CHECKED, RELEASE, RELWITHDEBINFO.
+ DEBUG | CHECKED | RELEASE | RELWITHDEBINFO)
+ buildtype=$upperI
+ ;;
+ NINJA)
+ generator=Ninja
+ ;;
+ SCAN-BUILD)
+ echo "Static analysis is turned on for this build."
+ scan_build=ON
+ ;;
+ *)
+ __UnprocessedCMakeArgs="${__UnprocessedCMakeArgs}${__UnprocessedCMakeArgs:+ }$i"
+ esac
+done
+
+OS=`uname`
+
+cmake_extra_defines=
+if [ "$CROSSCOMPILE" == "1" ]; then
+ if ! [[ -n "$ROOTFS_DIR" ]]; then
+ echo "ROOTFS_DIR not set for crosscompile"
+ exit 1
+ fi
+ export TARGET_BUILD_ARCH=$build_arch
+ cmake_extra_defines="$cmake_extra_defines -C $tryrun_dir/tryrun.cmake"
+ cmake_extra_defines="$cmake_extra_defines -DCMAKE_TOOLCHAIN_FILE=$scriptroot/toolchain.cmake"
+fi
+
+cmake_command=$(command -v cmake)
+
+if [[ "$scan_build" == "ON" && "$SCAN_BUILD_COMMAND" != "" ]]; then
+ cmake_command="$SCAN_BUILD_COMMAND $cmake_command"
+fi
+
+# Include CMAKE_USER_MAKE_RULES_OVERRIDE as uninitialized since it will hold its value in the CMake cache otherwise can cause issues when branch switching
+$cmake_command \
+ -G "$generator" \
+ "-DCMAKE_BUILD_TYPE=$buildtype" \
+ "-DCMAKE_INSTALL_PREFIX=$__CMakeBinDir" \
+ $cmake_extra_defines \
+ $__UnprocessedCMakeArgs \
+ -S "$1" \
+ -B "$3"
- ${{ if and(eq(parameters.osGroup, 'Linux'), eq(parameters.osSubgroup, '_musl'), eq(parameters.archType, 'x64')) }}:
- name: clangArg
value: ''
+ # AppleClang has different version scheme, so we let complier introspection pick up the available clang from PATH
+ - ${{ if eq(parameters.osGroup, 'OSX') }}:
+ - name: clangArg
+ value: ''
- ${{ if and(ne(variables['System.TeamProject'], 'public'), ne(variables['Build.Reason'], 'PullRequest')) }}:
# Variables used to publish packages to blob feed
- name: dotnetfeedUrl
# Configure compiler settings for environment
#----------------------------------------------------
include(configurecompiler.cmake)
-include(configuretools.cmake)
+include(${CLR_COMMON_DIR}/configuretools.cmake)
#----------------------------------------------------
# Cross target Component build specific configuration
initTargetDistroRid()
{
- source ${__ProjectDir}/init-distro-rid.sh
+ source "${__ProjectDir}/init-distro-rid.sh"
local passedRootfsDir=""
# Only pass ROOTFS_DIR if cross is specified.
if [ "$__CrossBuild" = 1 ]; then
- passedRootfsDir=${ROOTFS_DIR}
+ passedRootfsDir="${ROOTFS_DIR}"
fi
initDistroRidGlobal "$__BuildOS" "$__BuildArch" "$__PortableBuild" "$passedRootfsDir"
isMSBuildOnNETCoreSupported()
{
- __isMSBuildOnNETCoreSupported=$__msbuildonunsupportedplatform
+ __isMSBuildOnNETCoreSupported="$__msbuildonunsupportedplatform"
if [ "$__isMSBuildOnNETCoreSupported" = 1 ]; then
return
echo ""
echo "Additional Options:"
echo ""
- for i in ${!usage_list[@]}; do
+ for i in "${!usage_list[@]}"; do
echo "${usage_list[${i}]}"
done
echo ""
CPUName=$(uname -m)
fi
-case $CPUName in
+case "$CPUName" in
aarch64)
__BuildArch=arm64
__HostArch=arm64
# Use uname to determine what the OS is.
OSName=$(uname -s)
-case $OSName in
+case "$OSName" in
Darwin)
__BuildOS=OSX
__HostOS=OSX
esac
while :; do
- if [ $# -le 0 ]; then
+ if [ "$#" -le 0 ]; then
break
fi
lowerI="$(echo "$1" | awk '{print tolower($0)}')"
- case $lowerI in
+ case "$lowerI" in
-\?|-h|--help)
usage
exit 1
mkdir "$__RootBinDir"
fi
__RootBinParent=$(dirname "$__RootBinDir")
- __RootBinName=${__RootBinDir##*/}
+ __RootBinName="${__RootBinDir##*/}"
__RootBinDir="$(cd "$__RootBinParent" &>/dev/null && printf %s/%s "$PWD" "$__RootBinName")"
shift
else
__ErrMsgPrefix="##vso[task.logissue type=error]"
;;
- clang3.5|-clang3.5)
- __ClangMajorVersion=3
- __ClangMinorVersion=5
- ;;
-
- clang3.6|-clang3.6)
- __ClangMajorVersion=3
- __ClangMinorVersion=6
- ;;
-
- clang3.7|-clang3.7)
- __ClangMajorVersion=3
- __ClangMinorVersion=7
- ;;
-
- clang3.8|-clang3.8)
- __ClangMajorVersion=3
- __ClangMinorVersion=8
- ;;
-
- clang3.9|-clang3.9)
- __ClangMajorVersion=3
- __ClangMinorVersion=9
- ;;
-
- clang4.0|-clang4.0)
- __ClangMajorVersion=4
- __ClangMinorVersion=0
- ;;
-
- clang5.0|-clang5.0)
- __ClangMajorVersion=5
- __ClangMinorVersion=0
- ;;
-
- clang6.0|-clang6.0)
- __ClangMajorVersion=6
- __ClangMinorVersion=0
- ;;
-
- clang7|-clang7)
- __ClangMajorVersion=7
- __ClangMinorVersion=
- ;;
-
- clang8|-clang8)
- __ClangMajorVersion=8
- __ClangMinorVersion=
- ;;
-
- clang9|-clang9)
- __ClangMajorVersion=9
- __ClangMinorVersion=
+ clang*|-clang*)
+ __Compiler=clang
+ # clangx.y or clang-x.y
+ version="$(echo "$lowerI" | tr -d '[:alpha:]-=')"
+ parts=(${version//./ })
+ __CompilerMajorVersion="${parts[0]}"
+ __CompilerMinorVersion="${parts[1]}"
+ if [ -z "$__CompilerMinorVersion" ] && [ "$__CompilerMajorVersion" -le 6 ]; then
+ __CompilerMinorVersion=0;
+ fi
;;
cmakeargs|-cmakeargs)
__BuildType=Debug
;;
- gcc5|-gcc5)
- __GccMajorVersion=5
- __GccMinorVersion=
- __GccBuild=1
- ;;
-
- gcc6|-gcc6)
- __GccMajorVersion=6
- __GccMinorVersion=
- __GccBuild=1
- ;;
-
- gcc7|-gcc7)
- __GccMajorVersion=7
- __GccMinorVersion=
- __GccBuild=1
- ;;
-
- gcc8|-gcc8)
- __GccMajorVersion=8
- __GccMinorVersion=
- __GccBuild=1
- ;;
-
- gcc9|-gcc9)
- __GccMajorVersion=9
- __GccMinorVersion=
- __GccBuild=1
- ;;
-
- gcc|-gcc)
- __GccMajorVersion=
- __GccMinorVersion=
- __GccBuild=1
+ gcc*|-gcc*)
+ __Compiler=gcc
+ # gccx.y or gcc-x.y
+ version="$(echo "$lowerI" | tr -d '[:alpha:]-=')"
+ parts=(${version//./ })
+ __CompilerMajorVersion="${parts[0]}"
+ __CompilerMinorVersion="${parts[1]}"
;;
msbuildonunsupportedplatform|-msbuildonunsupportedplatform)
export VERBOSE=1
__CommonMSBuildArgs="$__CommonMSBuildArgs /v:detailed"
fi
-
-# Set default clang version
-if [ "$__ClangMajorVersion" = 0 ] && [ "$__ClangMinorVersion" = 0 ]; then
- if [ "$__BuildArch" = "arm" ] || [ "$__BuildArch" = "armel" ]; then
- __ClangMajorVersion=5
- __ClangMinorVersion=0
- else
- __ClangMajorVersion=3
- __ClangMinorVersion=9
- fi
-fi
)
if not exist "%VSINSTALLDIR%DIA SDK" goto NoDIA
-set __ExtraCmakeArgs="-DCMAKE_SYSTEM_VERSION=10.0"
+set __ExtraCmakeArgs="-DCMAKE_SYSTEM_VERSION=10.0" "-DCLR_COMMON_DIR=%__RepoRootDir%/eng/common"
call "%__SourceDir%\pal\tools\gen-buildsys.cmd" "%__ProjectFilesDir%" "%__NativeTestIntermediatesDir%" %__VSVersion% %__BuildArch% !__ExtraCmakeArgs!
if not !errorlevel! == 0 (
fi
fi
- scriptDir="$__ProjectRoot/src/pal/tools"
- if [[ $__GccBuild == 0 ]]; then
- echo "Invoking \"$scriptDir/find-clang.sh\" $__ClangMajorVersion \"$__ClangMinorVersion\""
- source "$scriptDir/find-clang.sh" $__ClangMajorVersion "$__ClangMinorVersion"
- else
- echo "Invoking \"$scriptDir/find-gcc.sh\" \"$__GccMajorVersion\" \"$__GccMinorVersion\""
- source "$scriptDir/find-gcc.sh" "$__GccMajorVersion" "$__GccMinorVersion"
- fi
-
if [[ -n "$__CodeCoverage" ]]; then
extraCmakeArguments="$extraCmakeArguments -DCLR_CMAKE_ENABLE_CODE_COVERAGE=1"
fi
- nextCommand="\"$scriptDir/gen-buildsys.sh\" \"$__TestDir\" \"$intermediatesForBuild\" $platformArch $__BuildType $generator $extraCmakeArguments $__cmakeargs"
+ commonDir="$__RepoRootDir/eng/common"
+ __cmakeargs="$__cmakeargs -DCLR_COMMON_DIR=\"$commonDir\""
+ nextCommand="\"$commonDir/cross/gen-buildsys.sh\" \"$__TestDir\" \"$__ProjectRoot\" \"$intermediatesForBuild\" $platformArch $__Compiler \"$__CompilerMajorVersion\" \"$__CompilerMinorVersion\" $__BuildType $generator $extraCmakeArguments $__cmakeargs"
echo "Invoking $nextCommand"
eval $nextCommand
export __ProjectDir="$__ProjectRoot"
__BuildTestWrappers=1
__BuildTestWrappersOnly=
-__ClangMajorVersion=0
-__ClangMinorVersion=0
+__Compiler=clang
+__CompilerMajorVersion=
+__CompilerMinorVersion=
__CommonMSBuildArgs=
__ConfigureOnly=0
__CopyNativeProjectsAfterCombinedTestBuild=true
__DoCrossgen=0
__DoCrossgen2=0
__DotNetCli="$__RepoRootDir/dotnet.sh"
-__GccBuild=0
-__GccMajorVersion=0
-__GccMinorVersion=0
__GenerateLayoutOnly=
__GenerateTestHostOnly=
__MSBCleanBuildArgs=
set __CMakeBinDir=%__CrossComponentBinDir%
set "__CMakeBinDir=!__CMakeBinDir:\=/!"
- set __ExtraCmakeArgs="-DCLR_CROSS_COMPONENTS_BUILD=1" "-DCLR_CMAKE_TARGET_ARCH=%__BuildArch%" "-DCLR_CMAKE_PGO_INSTRUMENT=%__PgoInstrument%" "-DCLR_CMAKE_OPTDATA_PATH=%__PgoOptDataPath%" "-DCLR_CMAKE_PGO_OPTIMIZE=%__PgoOptimize%" "-DCMAKE_SYSTEM_VERSION=10.0"
+ set __ExtraCmakeArgs="-DCLR_CROSS_COMPONENTS_BUILD=1" "-DCLR_CMAKE_TARGET_ARCH=%__BuildArch%" "-DCLR_CMAKE_PGO_INSTRUMENT=%__PgoInstrument%" "-DCLR_CMAKE_OPTDATA_PATH=%__PgoOptDataPath%" "-DCLR_CMAKE_PGO_OPTIMIZE=%__PgoOptimize%" "-DCMAKE_SYSTEM_VERSION=10.0" "-DCLR_COMMON_DIR=%__RepoRootDir%/eng/common"
call "%__SourceDir%\pal\tools\gen-buildsys.cmd" "%__ProjectDir%" "%__CrossCompIntermediatesDir%" %__VSVersion% %__CrossArch% !__ExtraCmakeArgs!
if not !errorlevel! == 0 (
echo %__MsgPrefix%Regenerating the Visual Studio solution
- set __ExtraCmakeArgs=!___SDKVersion! !___CrossBuildDefine! "-DCLR_CMAKE_PGO_INSTRUMENT=%__PgoInstrument%" "-DCLR_CMAKE_OPTDATA_PATH=%__PgoOptDataPath%" "-DCLR_CMAKE_PGO_OPTIMIZE=%__PgoOptimize%"
+ set __ExtraCmakeArgs=!___SDKVersion! !___CrossBuildDefine! "-DCLR_CMAKE_PGO_INSTRUMENT=%__PgoInstrument%" "-DCLR_CMAKE_OPTDATA_PATH=%__PgoOptDataPath%" "-DCLR_CMAKE_PGO_OPTIMIZE=%__PgoOptimize%" "-DCLR_COMMON_DIR=%__RepoRootDir%/eng/common"
call "%__SourceDir%\pal\tools\gen-buildsys.cmd" "%__ProjectDir%" "%__IntermediatesDir%" %__VSVersion% %__BuildArch% !__ExtraCmakeArgs!
if not !errorlevel! == 0 (
echo %__ErrMsgPrefix%%__MsgPrefix%Error: failed to generate native component build project!
if [[ $(version $cmake_version) -lt $(version 3.14.0) ]]; then
echo "Please install CMake 3.14 or newer from http://www.cmake.org/download/ or https://apt.kitware.com and ensure it is on your path."; exit 1;
fi
-
- # Minimum required version of clang is version 4.0 for arm/armel cross build
- if [[ $__CrossBuild == 1 && $__GccBuild == 0 && ("$__BuildArch" == "arm" || "$__BuildArch" == "armel") ]]; then
- if ! [[ "$__ClangMajorVersion" -ge "4" ]]; then
- echo "Please install clang4.0 or latest for arm/armel cross build"; exit 1;
- fi
- fi
-
- # Check for clang
- if [[ $__GccBuild == 0 ]]; then
- __ClangCombinedDottedVersion=$__ClangMajorVersion;
- if [[ "$__ClangMinorVersion" != "" ]]; then
- __ClangCombinedDottedVersion=$__ClangCombinedDottedVersion.$__ClangMinorVersion
- fi
- hash clang-$__ClangCombinedDottedVersion 2>/dev/null || hash clang$__ClangMajorVersion$__ClangMinorVersion 2>/dev/null || hash clang 2>/dev/null || { echo >&2 "Please install clang-$__ClangMajorVersion.$__ClangMinorVersion before running this script"; exit 1; }
- else
- __GccCombinedDottedVersion=$__GccMajorVersion;
- if [[ "$__GccMinorVersion" != "" ]]; then
- __GccCombinedDottedVersion=$__GccCombinedDottedVersion.$__GccMinorVersion
- fi
- hash gcc-$__GccCombinedDottedVersion 2>/dev/null || hash gcc$__GccMajorVersion$__GccMinorVersion 2>/dev/null || hash gcc 2>/dev/null || { echo >&2 "Please install gcc-$__GccMajorVersion.$__GccMinorVersion before running this script"; exit 1; }
- fi
-
}
restore_optdata()
# Regenerate the CMake solution
- scriptDir="$__ProjectRoot/src/pal/tools"
- if [[ $__GccBuild == 0 ]]; then
- echo "Invoking \"$scriptDir/find-clang.sh\" $__ClangMajorVersion \"$__ClangMinorVersion\""
- source "$scriptDir/find-clang.sh" $__ClangMajorVersion "$__ClangMinorVersion"
- if [[ $__StaticAnalyzer == 1 ]]; then
- scan_build=scan-build
- fi
- else
- echo "Invoking \"$scriptDir/find-gcc.sh\" \"$__GccMajorVersion\" \"$__GccMinorVersion\""
- source "$scriptDir/find-gcc.sh" "$__GccMajorVersion" "$__GccMinorVersion"
+ if [ "$__StaticAnalyzer" = 1 ]; then
+ scan_build=scan-build
fi
-
if [[ -n "$__CodeCoverage" ]]; then
extraCmakeArguments="$extraCmakeArguments -DCLR_CMAKE_ENABLE_CODE_COVERAGE=1"
fi
- nextCommand="\"$scriptDir/gen-buildsys.sh\" \"$__ProjectRoot\" \"$intermediatesForBuild\" $platformArch $__BuildType $generator $scan_build $extraCmakeArguments $__cmakeargs"
+ commonDir="$__RepoRootDir/eng/common"
+ __cmakeargs="$__cmakeargs -DCLR_COMMON_DIR=\"$commonDir\""
+ nextCommand="\"$commonDir/cross/gen-buildsys.sh\" \"$__ProjectRoot\" \"$__ProjectRoot\" \"$intermediatesForBuild\" $platformArch $__Compiler \"$__CompilerMajorVersion\" \"$__CompilerMinorVersion\" $__BuildType $generator $scan_build $extraCmakeArguments $__cmakeargs"
echo "Invoking $nextCommand"
eval $nextCommand
# Set the various build properties here so that CMake and MSBuild can pick them up
__BuildManagedTools=1
-__ClangMajorVersion=0
-__ClangMinorVersion=0
+__Compiler=clang
+__CompilerMajorVersion=
+__CompilerMinorVersion=
__CommonMSBuildArgs=
__ConfigureOnly=0
__CrossBuild=0
__CrossgenOnly=0
__DistroRid=""
-__GccBuild=0
-__GccMajorVersion=0
-__GccMinorVersion=0
__IbcOptDataPath=""
__IbcTuning=""
__MSBCleanBuildArgs=
+++ /dev/null
-#!/usr/bin/env bash
-#
-# This file finds Clang on the system.
-#
-
-if [ $# -lt 2 ]
-then
- echo "Usage..."
- echo "find-clang.sh <ClangMajorVersion> <ClangMinorVersion>"
- echo "Specify the clang version to use, split into major and minor version"
- exit 1
-fi
-
-# Set up the environment to be used for building with clang.
-if command -v "clang-$1.$2" > /dev/null
- then
- desired_llvm_version="-$1.$2"
-elif command -v "clang$1$2" > /dev/null
- then
- desired_llvm_version="$1$2"
-elif command -v "clang-$1$2" > /dev/null
- then
- desired_llvm_version="-$1$2"
-elif command -v clang > /dev/null
- then
- desired_llvm_version=
-else
- echo "Unable to find Clang Compiler"
- exit 1
-fi
-
-export CC="$(command -v clang$desired_llvm_version)"
-export CXX="$(command -v clang++$desired_llvm_version)"
-export CCC_CC=$CC
-export CCC_CXX=$CXX
-export SCAN_BUILD_COMMAND=$(command -v scan-build$desired_llvm_version)
+++ /dev/null
-#!/usr/bin/env sh
-#
-# This file finds GCC on the system.
-#
-
-if [ $# -lt 2 ]
-then
- echo "Usage..."
- echo "find-gcc.sh <GccMajorVersion> <GccMinorVersion>"
- echo "Specify the Gcc version to use, split into major and minor version"
- exit 1
-fi
-
-# Locate gcc
-gcc_prefix=""
-
-if [ "$CROSSCOMPILE" = "1" ]; then
- # Locate gcc
- if [ -n "$TOOLCHAIN" ]; then
- gcc_prefix="$TOOLCHAIN-"
- fi
-fi
-
-# Set up the environment to be used for building with gcc.
-if command -v "${gcc_prefix}gcc-$1.$2" > /dev/null
- then
- desired_gcc_version="-$1.$2"
-elif command -v "${gcc_prefix}gcc$1$2" > /dev/null
- then
- desired_gcc_version="$1$2"
-elif command -v "${gcc_prefix}gcc-$1$2" > /dev/null
- then
- desired_gcc_version="-$1$2"
-elif command -v "${gcc_prefix}gcc" > /dev/null
- then
- desired_gcc_version=
-else
- echo "Unable to find ${gcc_prefix}gcc Compiler"
- exit 1
-fi
-
-if [ -z "$CLR_CC" ]; then
- CC="$(command -v "${gcc_prefix}gcc$desired_gcc_version")"
-else
- CC="$CLR_CC"
-fi
-
-if [ -z "$CLR_CXX" ]; then
- CXX="$(command -v "${gcc_prefix}g++$desired_gcc_version")"
-else
- CXX="$CLR_CXX"
-fi
-
-export CC
-export CXX
+++ /dev/null
-#!/usr/bin/env bash
-#
-# This file invokes cmake and generates the build system for Clang.
-#
-
-source="${BASH_SOURCE[0]}"
-
-# resolve $SOURCE until the file is no longer a symlink
-while [[ -h $source ]]; do
- scriptroot="$( cd -P "$( dirname "$source" )" && pwd )"
- source="$(readlink "$source")"
-
- # if $source was a relative symlink, we need to resolve it relative to the path where the
- # symlink file was located
- [[ $source != /* ]] && source="$scriptroot/$source"
-done
-scriptroot="$( cd -P "$( dirname "$source" )" && pwd )"
-
-if [ $# -lt 4 ]
-then
- echo "Usage..."
- echo "gen-buildsys.sh <path to top level CMakeLists.txt> <path to intermediate directory> <Architecture> [build flavor] [ninja] [scan-build] [cmakeargs]"
- echo "Specify the path to the top level CMake file."
- echo "Specify the path that the build system files are generated in."
- echo "Specify the target architecture."
- echo "Optionally specify the build configuration (flavor.) Defaults to DEBUG."
- echo "Optionally specify 'scan-build' to enable build with clang static analyzer."
- echo "Use the Ninja generator instead of the Unix Makefiles generator."
- echo "Pass additional arguments to CMake call."
- exit 1
-fi
-
-__CoreClrDir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/../../.."
-__RepoRootDir=${__CoreClrDir}/../..
-
-build_arch="$3"
-buildtype=DEBUG
-code_coverage=OFF
-build_tests=OFF
-scan_build=OFF
-generator="Unix Makefiles"
-__UnprocessedCMakeArgs=""
-
-for i in "${@:4}"; do
- upperI="$(echo $i | awk '{print toupper($0)}')"
- case $upperI in
- # Possible build types are DEBUG, CHECKED, RELEASE, RELWITHDEBINFO.
- DEBUG | CHECKED | RELEASE | RELWITHDEBINFO)
- buildtype=$upperI
- ;;
- NINJA)
- generator=Ninja
- ;;
- SCAN-BUILD)
- echo "Static analysis is turned on for this build."
- scan_build=ON
- ;;
- *)
- __UnprocessedCMakeArgs="${__UnprocessedCMakeArgs}${__UnprocessedCMakeArgs:+ }$i"
- esac
-done
-
-OS=`uname`
-
-cmake_extra_defines=
-if [ "$CROSSCOMPILE" == "1" ]; then
- if ! [[ -n "$ROOTFS_DIR" ]]; then
- echo "ROOTFS_DIR not set for crosscompile"
- exit 1
- fi
- export TARGET_BUILD_ARCH=$build_arch
- cmake_extra_defines="$cmake_extra_defines -C ${__CoreClrDir}/tryrun.cmake"
- cmake_extra_defines="$cmake_extra_defines -DCMAKE_TOOLCHAIN_FILE=${__RepoRootDir}/eng/common/cross/toolchain.cmake"
-fi
-
-cmake_command=$(command -v cmake)
-
-if [[ "$scan_build" == "ON" && "$SCAN_BUILD_COMMAND" != "" ]]; then
- cmake_command="$SCAN_BUILD_COMMAND $cmake_command"
-fi
-
-# Include CMAKE_USER_MAKE_RULES_OVERRIDE as uninitialized since it will hold its value in the CMake cache otherwise can cause issues when branch switching
-$cmake_command \
- -G "$generator" \
- "-DCMAKE_BUILD_TYPE=$buildtype" \
- "-DCMAKE_INSTALL_PREFIX=$__CMakeBinDir" \
- $cmake_extra_defines \
- $__UnprocessedCMakeArgs \
- -S "$1" \
- -B "$2"
# Include global configure settings
include(${CMAKE_CURRENT_SOURCE_DIR}/../configurecompiler.cmake)
-include(${CMAKE_CURRENT_SOURCE_DIR}/../configuretools.cmake)
+include(${CLR_COMMON_DIR}/configuretools.cmake)
# Compile options
if (WIN32)
-cmake_minimum_required(VERSION 2.8.12)
+cmake_minimum_required(VERSION 3.14)
+cmake_policy(SET CMP0042 NEW)
+
project(CoreFX C)
if(NOT CMAKE_SYSTEM_NAME STREQUAL Emscripten)
endfunction()
include(configure.cmake)
+include(${CLR_COMMON_DIR}/configuretools.cmake)
add_subdirectory(System.IO.Compression.Native)
message(FATAL_ERROR "Cannot find libicui18n, try installing libicu-dev (or the appropriate package for your platform)")
return()
endif()
-
- add_custom_command(TARGET System.Globalization.Native POST_BUILD
- COMMENT "Verifying System.Globalization.Native.so dependencies"
- COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/../verify-so.sh
- $<TARGET_FILE:System.Globalization.Native>
- "Verification failed. System.Globalization.Native.so has undefined dependencies. These are likely ICU APIs that need to be added to icushim.h."
- VERBATIM
- )
endif()
include(configure.cmake)
set_target_properties(System.Globalization.Native-Static PROPERTIES OUTPUT_NAME System.Globalization.Native CLEAN_DIRECT_OUTPUT 1)
install (TARGETS System.Globalization.Native-Static DESTINATION .)
+
+if(NOT CMAKE_SYSTEM_NAME STREQUAL Darwin)
+ add_custom_command(TARGET System.Globalization.Native POST_BUILD
+ COMMENT "Verifying System.Globalization.Native.so dependencies"
+ COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/../verify-so.sh
+ $<TARGET_FILE:System.Globalization.Native>
+ "Verification failed. System.Globalization.Native.so has undefined dependencies. These are likely ICU APIs that need to be added to icushim.h."
+ VERBATIM
+ )
+endif()
+++ /dev/null
-#!/usr/bin/env bash
-#
-# This file invokes cmake and generates the build system for Clang.
-#
-
-source="${BASH_SOURCE[0]}"
-
-# resolve $SOURCE until the file is no longer a symlink
-while [[ -h $source ]]; do
- scriptroot="$( cd -P "$( dirname "$source" )" && pwd )"
- source="$(readlink "$source")"
-
- # if $source was a relative symlink, we need to resolve it relative to the path where the
- # symlink file was located
- [[ $source != /* ]] && source="$scriptroot/$source"
-done
-scriptroot="$( cd -P "$( dirname "$source" )" && pwd )"
-
-if [ $# -lt 5 -o $# -gt 7 ]
-then
- echo "Usage..."
- echo "gen-buildsys-clang.sh <path to repo root> <path to top level CMakeLists.txt> <ClangMajorVersion> <ClangMinorVersion> <Architecture> [build flavor] [cmakeargs]"
- echo "Specify the path to the top level CMake file - <corefx>/src/Native/Unix"
- echo "Specify the clang version to use, split into major and minor version"
- echo "Specify the target architecture."
- echo "Optionally specify the build configuration (flavor.) Defaults to DEBUG."
- echo "Optionally pass additional arguments to CMake call."
- exit 1
-fi
-
-#root directory of the project
-repo_root=$1
-
-# Set up the environment to be used for building with clang.
-if which "clang-$3.$4" > /dev/null 2>&1
- then
- export CC="$(which clang-$3.$4)"
-elif which "clang-$3$4" > /dev/null 2>&1
- then
- export CC="$(which clang-$3$4)"
-elif which "clang$3$4" > /dev/null 2>&1
- then
- export CC="$(which clang$3$4)"
-elif which clang > /dev/null 2>&1
- then
- export CC="$(which clang)"
-else
- echo "Unable to find Clang Compiler"
- exit 1
-fi
-
-build_arch="$5"
-# Possible build types are DEBUG, RELEASE, RELWITHDEBINFO, MINSIZEREL.
-# Default to DEBUG
-if [ -z "$6" ]
-then
- echo "Defaulting to DEBUG build."
- buildtype="DEBUG"
-else
- buildtype="$6"
-fi
-
-cmake_cmd=cmake
-cmake_extra_defines="-DCMAKE_BUILD_TYPE=$buildtype"
-if [[ -n "$CROSSCOMPILE" ]]; then
- if ! [[ -n "$ROOTFS_DIR" ]]; then
- echo "ROOTFS_DIR not set for crosscompile"
- exit 1
- fi
- if [[ -z "$CONFIG_DIR" ]]; then
- CONFIG_DIR="$repo_root/eng/common/cross"
- fi
- export TARGET_BUILD_ARCH=$build_arch
- cmake_extra_defines="$cmake_extra_defines -C $scriptroot/tryrun.cmake"
- cmake_extra_defines="$cmake_extra_defines -DCMAKE_TOOLCHAIN_FILE=$CONFIG_DIR/toolchain.cmake"
-fi
-if [ "$build_arch" == "armel" ]; then
- cmake_extra_defines="$cmake_extra_defines -DARM_SOFTFP=1"
-fi
-if [ "$build_arch" == "wasm" ]; then
- if [ "$EMSCRIPTEN_ROOT" == "" ]; then
- EMSCRIPTEN_ROOT="$EMSDK_PATH/upstream/emscripten"
- fi
- cmake_cmd="emcmake cmake"
- cmake_extra_defines="$cmake_extra_defines -DCMAKE_TOOLCHAIN_FILE=$EMSCRIPTEN_ROOT/cmake/Modules/Platform/Emscripten.cmake -DEMSCRIPTEN_GENERATE_BITCODE_STATIC_LIBRARIES=1"
-fi
-
-__UnprocessedCMakeArgs=""
-if [ -z "$7" ]; then
- echo "No CMake extra Args specified"
-else
- __UnprocessedCMakeArgs="$7"
-fi
-
-echo "Invoking \"$cmake_cmd $cmake_extra_defines $__UnprocessedCMakeArgs $2\""
-$cmake_cmd $cmake_extra_defines \
- $__UnprocessedCMakeArgs \
- $2
+++ /dev/null
-#!/usr/bin/env sh
-#
-# This file invokes cmake and generates the build system for Gcc.
-#
-
-source="${BASH_SOURCE[0]}"
-
-# resolve $SOURCE until the file is no longer a symlink
-while [[ -h $source ]]; do
- scriptroot="$( cd -P "$( dirname "$source" )" && pwd )"
- source="$(readlink "$source")"
-
- # if $source was a relative symlink, we need to resolve it relative to the path where the
- # symlink file was located
- [[ $source != /* ]] && source="$scriptroot/$source"
-done
-scriptroot="$( cd -P "$( dirname "$source" )" && pwd )"
-
-if [ $# -lt 5 ]
-then
- echo "Usage..."
- echo "gen-buildsys-gcc.sh <path to repo root> <path to top level CMakeLists.txt> <GccMajorVersion> <GccMinorVersion> <Architecture> [build flavor] [cmakeargs]"
- echo "Specify the path to the top level CMake file - <corefx>/src/Native/Unix"
- echo "Specify the gcc version to use, split into major and minor version"
- echo "Specify the target architecture."
- echo "Optionally specify the build configuration (flavor.) Defaults to DEBUG."
- echo "Optionally pass additional arguments to CMake call."
- exit 1
-fi
-
-#root directory of the project
-repo_root=$1
-
-# Locate gcc
-gcc_prefix=""
-
-if [ "$CROSSCOMPILE" = "1" ]; then
- # Locate gcc
- if [ -n "$TOOLCHAIN" ]; then
- gcc_prefix="$TOOLCHAIN-"
- fi
-fi
-
-# Set up the environment to be used for building with gcc.
-if command -v "${gcc_prefix}gcc-$3.$4" > /dev/null
- then
- desired_gcc_version="-$3.$4"
-elif command -v "${gcc_prefix}gcc$3$4" > /dev/null
- then
- desired_gcc_version="$3$4"
-elif command -v "${gcc_prefix}gcc-$3$4" > /dev/null
- then
- desired_gcc_version="-$3$4"
-elif command -v "${gcc_prefix}gcc" > /dev/null
- then
- desired_gcc_version=
-else
- echo "Unable to find ${gcc_prefix}gcc Compiler"
- exit 1
-fi
-
-if [ -z "$CLR_CC" ]; then
- CC="$(command -v "${gcc_prefix}gcc$desired_gcc_version")"
-else
- CC="$CLR_CC"
-fi
-
-if [ -z "$CLR_CXX" ]; then
- CXX="$(command -v "${gcc_prefix}g++$desired_gcc_version")"
-else
- CXX="$CLR_CXX"
-fi
-
-export CC CXX
-
-build_arch="$5"
-buildtype=DEBUG
-__UnprocessedCMakeArgs=""
-
-ITER=-1
-for i in "$@"; do
- ITER=$((ITER + 1))
- if [ $ITER -lt 5 ]; then continue; fi
- upperI="$(echo "$i" | awk '{print toupper($0)}')"
- case $upperI in
- # Possible build types are DEBUG, CHECKED, RELEASE, RELWITHDEBINFO, MINSIZEREL.
- DEBUG | CHECKED | RELEASE | RELWITHDEBINFO | MINSIZEREL)
- buildtype=$upperI
- ;;
- *)
- __UnprocessedCMakeArgs="${__UnprocessedCMakeArgs}${__UnprocessedCMakeArgs:+ }$i"
- esac
-done
-
-OS=$(uname)
-
-locate_gcc_exec() {
- ENV_KNOB="CLR_$(echo "$2" | tr '[:lower:]' '[:upper:]')"
- if env | grep -q "^$ENV_KNOB="; then
- eval "echo \"\$$ENV_KNOB\""
- return
- fi
-
- if command -v "$gcc_prefix$2$desired_gcc_version" > /dev/null 2>&1
- then
- command -v "$gcc_prefix$2$desired_gcc_version"
- elif command -v "$gcc_prefix$2" > /dev/null 2>&1
- then
- command -v "$gcc_prefix$2"
- 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"
-fi
-if [ -n "$LLDB_INCLUDE_DIR" ]; then
- cmake_extra_defines="$cmake_extra_defines -DWITH_LLDB_INCLUDES=$LLDB_INCLUDE_DIR"
-fi
-if [ "$CROSSCOMPILE" = "1" ]; then
- if [ -z "$ROOTFS_DIR" ]; then
- echo "ROOTFS_DIR not set for crosscompile"
- exit 1
- fi
- if [ -z "$CONFIG_DIR" ]; then
- CONFIG_DIR="$repo_root/eng/common/cross"
- fi
- export TARGET_BUILD_ARCH=$build_arch
- cmake_extra_defines="$cmake_extra_defines -C $scriptroot/tryrun.cmake"
- cmake_extra_defines="$cmake_extra_defines -DCMAKE_TOOLCHAIN_FILE=$CONFIG_DIR/toolchain.cmake"
- cmake_extra_defines="$cmake_extra_defines --sysroot=$ROOTFS_DIR"
- cmake_extra_defines="$cmake_extra_defines -DCLR_UNIX_CROSS_BUILD=1"
-fi
-if [ "$build_arch" = "armel" ]; then
- cmake_extra_defines="$cmake_extra_defines -DARM_SOFTFP=1"
-fi
-
-cmake \
- "-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 " \
- $cmake_extra_defines \
- "$__UnprocessedCMakeArgs" \
- "$2"
# Check presence of CMake on the path
hash cmake 2>/dev/null || { echo >&2 "Please install cmake before running this script"; exit 1; }
-
- if [ "$__GccBuild" = 0 ]; then
- # Minimum required version of clang is version 3.9 for arm/armel cross build
- if [ "$__CrossBuild" = 1 ] && { [ "$__BuildArch" = "arm" ] || [ "$__BuildArch" = "armel" ]; }; then
- if [ "$__ClangMajorVersion" -lt 3 ] || { [ "$__ClangMajorVersion" -eq 3 ] && [ "$__ClangMinorVersion" -lt 9 ]; }; then
- echo "Please install clang3.9 or latest for arm/armel cross build"; exit 1;
- fi
- fi
-
- # Check for clang
- hash "clang-$__ClangMajorVersion.$__ClangMinorVersion" 2>/dev/null || hash "clang-$__ClangMajorVersion$__ClangMinorVersion" 2>/dev/null || hash "clang$__ClangMajorVersion$__ClangMinorVersion" 2>/dev/null || hash clang 2>/dev/null || { echo >&2 "Please install clang before running this script"; exit 1; }
- else
- # Minimum required version of gcc is version 5.0 for arm/armel cross build
- if [ "$__CrossBuild" = 1 ] && { [ "$__BuildArch" = "arm" ] || [ "$__BuildArch" = "armel" ]; }; then
- if [ "$__GccMajorVersion" -lt 5 ]; then
- echo "Please install gcc version 5 or latest for arm/armel cross build"; exit 1;
- fi
- fi
-
- # Check for gcc
- hash "gcc-$__GccMajorVersion.$__GccMinorVersion" 2>/dev/null || hash "gcc$__GccMajorVersion$__GccMinorVersion" 2>/dev/null || hash gcc 2>/dev/null || { echo >&2 "Please install gcc before running this script"; exit 1; }
- fi
}
prepare_native_build()
fi
# Regenerate the CMake solution
- if [ "$__GccBuild" = 0 ]; then
- echo "Invoking \"$__nativeroot/gen-buildsys-clang.sh\" \"$__rootRepo\" \"$__nativeroot\" \"$__ClangMajorVersion\" \"$__ClangMinorVersion\" \"$__BuildArch\" \"$__CMakeArgs\" \"$__CMakeExtraArgs\""
- "$__nativeroot/gen-buildsys-clang.sh" "$__rootRepo" "$__nativeroot" "$__ClangMajorVersion" "$__ClangMinorVersion" "$__BuildArch" "$__CMakeArgs" "$__CMakeExtraArgs"
- else
- echo "Invoking \"$__nativeroot/gen-buildsys-gcc.sh\" \"$__rootRepo\" \"$__nativeroot\" \"$__GccMajorVersion\" \"$__GccMinorVersion\" \"$__BuildArch\" \"$__CMakeArgs\" \"$__CMakeExtraArgs\""
- "$__nativeroot/gen-buildsys-gcc.sh" "$__rootRepo" "$__nativeroot" "$__GccMajorVersion" "$__GccMinorVersion" "$__BuildArch" "$__CMakeArgs" "$__CMakeExtraArgs"
+ commonDir="$__rootRepo/eng/common"
+ __CMakeExtraArgs="$__CMakeExtraArgs -DCLR_COMMON_DIR=\"$commonDir\""
+ nextCommand="\"$commonDir/cross/gen-buildsys.sh\" \"$__nativeroot\" \"$__nativeroot\" \"$__IntermediatesDir\" $__BuildArch $__Compiler \"$__CompilerMajorVersion\" \"$__CompilerMinorVersion\" $__BuildType $__CMakeArgs $__CMakeExtraArgs"
+ echo "Invoking $nextCommand"
+ eval "$nextCommand"
+
+ if [ $? != 0 ]; then
+ echo "Failed to generate $message build project!"
+ exit 1
fi
# Check that the makefiles were created.
- if [ ! -f "$__IntermediatesDir/Makefile" ]; then
- echo "Failed to generate native component build project!"
+ if [ ! -f "$__IntermediatesDir/CMakeCache.txt" ]; then
+ echo "Unable to find generated build files for native component project!"
exit 1
fi
__BuildOS=Linux
__NumProc=1
__UnprocessedBuildArgs=
-__GccBuild=0
-__GccMajorVersion=0
-__GccMinorVersion=0
__CrossBuild=0
__ServerGC=0
__VerboseBuild=false
-__ClangMajorVersion=0
-__ClangMinorVersion=0
+__Compiler=clang
+__CompilerMajorVersion=
+__CompilerMinorVersion=
__StaticLibLink=0
__PortableBuild=0
stripsymbols|-stripsymbols)
__CMakeExtraArgs="$__CMakeExtraArgs -DSTRIP_SYMBOLS=true"
;;
- --numproc|-numproc|numproc)
+ numproc|-numproc|--numproc)
shift
__NumProc=$1
;;
staticliblink|-staticliblink)
__StaticLibLink=1
;;
- -portable|-portable)
+ portable|-portable)
# Portable native components are only supported on Linux
if [ "$__HostOS" == "Linux" ]; then
__PortableBuild=1
fi
;;
- --clang*)
+ clang*|-clang*|--clang*)
+ __Compiler=clang
# clangx.y or clang-x.y
- v=`echo $lowerI | tr -d '[:alpha:]-='`
- __ClangMajorVersion=`echo $v | cut -d '.' -f1`
- __ClangMinorVersion=`echo $v | cut -d '.' -f2`
- ;;
- clang3.5|-clang3.5)
- __ClangMajorVersion=3
- __ClangMinorVersion=5
- ;;
- clang3.6|-clang3.6)
- __ClangMajorVersion=3
- __ClangMinorVersion=6
- ;;
- clang3.7|-clang3.7)
- __ClangMajorVersion=3
- __ClangMinorVersion=7
- ;;
- clang3.8|-clang3.8)
- __ClangMajorVersion=3
- __ClangMinorVersion=8
- ;;
- clang3.9|-clang3.9)
- __ClangMajorVersion=3
- __ClangMinorVersion=9
- ;;
- clang4.0|-clang4.0)
- __ClangMajorVersion=4
- __ClangMinorVersion=0
- ;;
- gcc5|-gcc5)
- __GccMajorVersion=5
- __GccMinorVersion=
- __GccBuild=1
- ;;
- gcc6|-gcc6)
- __GccMajorVersion=6
- __GccMinorVersion=
- __GccBuild=1
- ;;
- gcc7|-gcc7)
- __GccMajorVersion=7
- __GccMinorVersion=
- __GccBuild=1
- ;;
- gcc8|-gcc8)
- __GccMajorVersion=8
- __GccMinorVersion=
- __GccBuild=1
- ;;
- gcc|-gcc)
- __GccMajorVersion=
- __GccMinorVersion=
- __GccBuild=1
+ version="$(echo "$lowerI" | tr -d '[:alpha:]-=')"
+ parts=(${version//./ })
+ __CompilerMajorVersion="${parts[0]}"
+ __CompilerMinorVersion="${parts[1]}"
+ if [ -z "$__CompilerMinorVersion" ] && [ "$__CompilerMajorVersion" -le 6 ]; then
+ __CompilerMinorVersion=0;
+ fi
+ ;;
+ gcc*|-gcc*)
+ __Compiler=gcc
+ # gccx.y or gcc-x.y
+ version="$(echo "$lowerI" | tr -d '[:alpha:]-=')"
+ parts=(${version//./ })
+ __CompilerMajorVersion="${parts[0]}"
+ __CompilerMinorVersion="${parts[1]}"
;;
cross|-cross)
__CrossBuild=1
__CMakeExtraArgs="$__CMakeExtraArgs -DCMAKE_OSX_DEPLOYMENT_TARGET=10.13"
fi
-# Set the default clang version if not already set
-if [[ $__ClangMajorVersion == 0 && $__ClangMinorVersion == 0 ]]; then
- __ClangMajorVersion=9
- __ClangMinorVersion=
-fi
-
# Set the remaining variables based upon the determined build configuration
__outConfig=${__outConfig:-"$__BuildOS-$__BuildArch-$__BuildType"}
__IntermediatesDir="$__artifactsDir/obj/native/$__outConfig"