Fixes.
authorPat Gavlin <pagavlin@microsoft.com>
Mon, 2 Mar 2015 23:27:12 +0000 (15:27 -0800)
committerPat Gavlin <pagavlin@microsoft.com>
Mon, 2 Mar 2015 23:27:12 +0000 (15:27 -0800)
- 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.

CMakeLists.txt
build.sh
src/ToolBox/SOS/lldbplugin/CMakeLists.txt
src/pal/tools/gen-buildsys-clang.sh

index 25c3029..d8c704d 100644 (file)
@@ -4,6 +4,14 @@ cmake_minimum_required(VERSION 2.8.12)
 # 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)
 
index bcc2aba..ce2c3e5 100755 (executable)
--- a/build.sh
+++ b/build.sh
@@ -88,15 +88,22 @@ echo "Commencing CoreCLR Repo build"
 # 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
index 44ed059..6847e05 100644 (file)
@@ -3,22 +3,25 @@ project(sosplugin)
 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()
index 24e75da..43d0065 100755 (executable)
@@ -73,13 +73,13 @@ if [[ -n "$LLDB_INCLUDE_DIR" ]]; then
     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"
-