[compiler-rt] 8baedb8 - [compiler-rt] Use xcrun instead of xcodebuild to find the SDK directory
Alex Richardson via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 31 14:19:46 PDT 2019
Author: Alex Richardson
Date: 2019-10-31T21:17:56Z
New Revision: 8baedb82bafe2a9efb341b6207238b2af0f1ce07
URL: https://github.com/llvm/llvm-project/commit/8baedb82bafe2a9efb341b6207238b2af0f1ce07
DIFF: https://github.com/llvm/llvm-project/commit/8baedb82bafe2a9efb341b6207238b2af0f1ce07.diff
LOG: [compiler-rt] Use xcrun instead of xcodebuild to find the SDK directory
Summary:
xcodebuild does not work unless XCode is installed whereas xcrun also work
when only the Command Line Tools are installed. Unlike the check for the
version (D69610), this did not cause an erro for me since the fallback to
/usr/include for the OSX sysroot worked.
Reviewers: yln, delcypher
Reviewed By: yln
Subscribers: dberris, mgorny, #sanitizers, llvm-commits
Tags: #sanitizers, #llvm
Differential Revision: https://reviews.llvm.org/D69659
Added:
Modified:
compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake
compiler-rt/cmake/config-ix.cmake
Removed:
################################################################################
diff --git a/compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake b/compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake
index 96a5526c073c..7bef304f9b87 100644
--- a/compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake
+++ b/compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake
@@ -18,7 +18,7 @@ function(find_darwin_sdk_dir var sdk_name)
if(NOT DARWIN_PREFER_PUBLIC_SDK)
# Let's first try the internal SDK, otherwise use the public SDK.
execute_process(
- COMMAND xcodebuild -version -sdk ${sdk_name}.internal Path
+ COMMAND xcrun --sdk ${sdk_name}.internal --show-sdk-path
RESULT_VARIABLE result_process
OUTPUT_VARIABLE var_internal
OUTPUT_STRIP_TRAILING_WHITESPACE
@@ -27,7 +27,7 @@ function(find_darwin_sdk_dir var sdk_name)
endif()
if((NOT result_process EQUAL 0) OR "" STREQUAL "${var_internal}")
execute_process(
- COMMAND xcodebuild -version -sdk ${sdk_name} Path
+ COMMAND xcrun --sdk ${sdk_name} --show-sdk-path
RESULT_VARIABLE result_process
OUTPUT_VARIABLE var_internal
OUTPUT_STRIP_TRAILING_WHITESPACE
@@ -39,6 +39,7 @@ function(find_darwin_sdk_dir var sdk_name)
if(result_process EQUAL 0)
set(${var} ${var_internal} PARENT_SCOPE)
endif()
+ message(STATUS "Checking DARWIN_${sdk_name}_SYSROOT - '${var_internal}'")
set(DARWIN_${sdk_name}_CACHED_SYSROOT ${var_internal} CACHE STRING "Darwin SDK path for SDK ${sdk_name}." FORCE)
endfunction()
diff --git a/compiler-rt/cmake/config-ix.cmake b/compiler-rt/cmake/config-ix.cmake
index ed071796f589..f6d06c573e31 100644
--- a/compiler-rt/cmake/config-ix.cmake
+++ b/compiler-rt/cmake/config-ix.cmake
@@ -316,6 +316,7 @@ if(APPLE)
find_darwin_sdk_dir(DARWIN_tvos_SYSROOT appletvos)
if(NOT DARWIN_osx_SYSROOT)
+ message(WARNING "Could not determine OS X sysroot, trying /usr/include")
if(EXISTS /usr/include)
set(DARWIN_osx_SYSROOT /)
else()
More information about the llvm-commits
mailing list