- Enable @rpath support on OS X and silence the policy warning.
- Replace usage of uname -o, which is Linux-specific, with uname -s,
which is not.
- Document the WITH_LLDB_{LIBS,INCLUDES} variables.
- Stringify a couple of arguments to find_{library,paths} and
include_directories.
- Unstringify an argument to cmake in gen-buildsys-clang.sh.
# Set the project name
project(CoreCLR)
+if(APPLE)
+ # Enable @rpath support for shared libraries.
+ set(MACOSX_RPATH ON)
+ if(CMAKE_VERSION VERSION_EQUAL 3.0 OR CMAKE_VERSION VERSION_GREATER 3.0)
+ cmake_policy(SET CMP0042 NEW)
+ endif()
+endif()
+
set(CLR_DIR ${CMAKE_CURRENT_SOURCE_DIR})
set(VM_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src/vm)
# Obtain the location of the bash script to figure out whether the root of the repo is.
__ProjectRoot="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
__BuildArch=x64
-# Use uname to determine what the OS is.
-if [ $(uname -o | grep -i Linux) ]; then
- __BuildOS=linux
-elif [ $(uname -s | grep -i Darwin) ]; then
- __BuildOS=mac
-else
- echo "Unsupported OS detected, assuming linux"
- __BuildOS=linux
-fi
+# Use uname to determine what the OS is.
+OSName=$(uname -s)
+case $OSName in
+ Linux)
+ __BuildOS=linux
+ ;;
+
+ Darwin)
+ __BuildOS=mac
+ ;;
+
+ *)
+ echo "Unsupported OS $OSName detected, configuring as if for Linux"
+ __BuildOS=linux
+ ;;
+esac
__MSBuildBuildArch=x64
__BuildType=debug
__CMakeArgs=DEBUG
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(ENABLE_SOSPLUGIN OFF)
+set(WITH_LLDB_LIBS "" CACHE PATH "Path to LLDB libraries")
+set(WITH_LLDB_INCLUDES "" CACHE PATH "Path to LLDB headers")
+
if(CLR_CMAKE_PLATFORM_UNIX)
# Check for LLDB library
- find_library(LLDB NAMES lldb lldb-3.5 PATHS WITH_LLDB_LIBS)
+ find_library(LLDB NAMES lldb lldb-3.5 PATHS "${WITH_LLDB_LIBS}")
if(LLDB STREQUAL LLDB-NOTFOUND)
- message(FATAL_ERROR "Cannot find liblldb or liblldb-3.5. Try installing lldb-3.5-dev (or the appropriate package for your platform)")
+ message(FATAL_ERROR "Cannot find lldb or lldb-3.5. Try installing lldb-3.5-dev (or the appropriate package for your platform)")
endif()
# Check for LLDB headers
- find_path(LLDB_H "lldb/API/LLDB.h" PATHS WITH_LLDB_INCLUDES)
+ find_path(LLDB_H "lldb/API/LLDB.h" PATHS "${WITH_LLDB_INCLUDES}")
if(LLDB_H STREQUAL LLDB_H-NOTFOUND)
find_path(LLDB_H "lldb/API/LLDB.h" PATHS "/usr/lib/llvm-3.5/include")
if(LLDB_H STREQUAL LLDB_H-NOTFOUND)
message(FATAL_ERROR "Cannot find LLDB.h. Try installing lldb-3.5-dev (or the appropriate package for your platform)")
endif()
endif()
- include_directories(LLDB_H)
+ include_directories("${LLDB_H}")
set(ENABLE_SOSPLUGIN ON)
endif()
cmake_extra_defines="$cmake_extra_defines -DWITH_LLDB_INCLUDES=$LLDB_INCLUDE_DIR"
fi
-cmake "-DCMAKE_USER_MAKE_RULES_OVERRIDE=$1/src/pal/tools/clang-compiler-override.txt" \
+cmake \
+ "-DCMAKE_USER_MAKE_RULES_OVERRIDE=$1/src/pal/tools/clang-compiler-override.txt" \
"-DCMAKE_AR=$llvm_ar" \
"-DCMAKE_LINKER=$llvm_link" \
"-DCMAKE_NM=$llvm_nm" \
"-DCMAKE_OBJDUMP=$llvm_objdump" \
"-DCMAKE_RANLIB=$llvm_ranlib" \
"-DCMAKE_BUILD_TYPE=$buildtype" \
- "$cmake_extra_defines" \
+ $cmake_extra_defines \
"$1"
-