summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Bieneman <beanz@apple.com>2016-08-19 22:22:35 +0000
committerChris Bieneman <beanz@apple.com>2016-08-19 22:22:35 +0000
commit9b818ac5d9a617dc2485ca3ed83b08f46d30824b (patch)
tree16d2ce1132d408fb287403dc77a45025e654e368
parent11da66fc103687beeb785eee224ede91669d9013 (diff)
downloadbcm5719-llvm-9b818ac5d9a617dc2485ca3ed83b08f46d30824b.tar.gz
bcm5719-llvm-9b818ac5d9a617dc2485ca3ed83b08f46d30824b.zip
[CMake] Support building on OS X without Xcode installation
This should resolve PR23162. This patch has two parts. First we need to check the error code from xcodebuild when querying for SDKs, second if the OS X SDK is not discovered, we ensure that /usr/include exists and use / as the OS X sysroot. llvm-svn: 279336
-rw-r--r--compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake8
-rw-r--r--compiler-rt/cmake/config-ix.cmake8
2 files changed, 14 insertions, 2 deletions
diff --git a/compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake b/compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake
index 95a06ce9fec..28d39867212 100644
--- a/compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake
+++ b/compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake
@@ -7,13 +7,15 @@ function(find_darwin_sdk_dir var sdk_name)
# Let's first try the internal SDK, otherwise use the public SDK.
execute_process(
COMMAND xcodebuild -version -sdk ${sdk_name}.internal Path
+ RESULT_VARIABLE result_process
OUTPUT_VARIABLE var_internal
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_FILE /dev/null
)
- if("" STREQUAL "${var_internal}")
+ if((NOT result_process EQUAL 0) OR "" STREQUAL "${var_internal}")
execute_process(
COMMAND xcodebuild -version -sdk ${sdk_name} Path
+ RESULT_VARIABLE result_process
OUTPUT_VARIABLE var_internal
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_FILE /dev/null
@@ -21,7 +23,9 @@ function(find_darwin_sdk_dir var sdk_name)
else()
set(${var}_INTERNAL ${var_internal} PARENT_SCOPE)
endif()
- set(${var} ${var_internal} PARENT_SCOPE)
+ if(result_process EQUAL 0)
+ set(${var} ${var_internal} PARENT_SCOPE)
+ endif()
endfunction()
# There isn't a clear mapping of what architectures are supported with a given
diff --git a/compiler-rt/cmake/config-ix.cmake b/compiler-rt/cmake/config-ix.cmake
index 67d0c7c2284..9eb135398cf 100644
--- a/compiler-rt/cmake/config-ix.cmake
+++ b/compiler-rt/cmake/config-ix.cmake
@@ -174,6 +174,14 @@ if(APPLE)
find_darwin_sdk_dir(DARWIN_tvossim_SYSROOT appletvsimulator)
find_darwin_sdk_dir(DARWIN_tvos_SYSROOT appletvos)
+ if(NOT DARWIN_osx_SYSROOT)
+ if(EXISTS /usr/include)
+ set(DARWIN_osx_SYSROOT /)
+ else()
+ message(ERROR "Could not detect OS X Sysroot. Either install Xcode or the Apple Command Line Tools")
+ endif()
+ endif()
+
if(COMPILER_RT_ENABLE_IOS)
list(APPEND DARWIN_EMBEDDED_PLATFORMS ios)
set(DARWIN_ios_MIN_VER_FLAG -miphoneos-version-min)
OpenPOWER on IntegriCloud