[PATCH] D96962: [compiler-rt/mac]: use DARWIN_osx_SYSROOT to set OSX_SYSROOT_FLAG
Nico Weber via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 18 08:16:34 PST 2021
thakis created this revision.
thakis added reviewers: delcypher, hans.
Herald added subscribers: mgorny, dberris.
thakis requested review of this revision.
No behavior change, and less code.
While here, also un-bitrot the libc++ header copy suggestion a bit.
https://reviews.llvm.org/D96962
Files:
compiler-rt/cmake/Modules/CompilerRTCompile.cmake
compiler-rt/cmake/base-config-ix.cmake
compiler-rt/cmake/config-ix.cmake
Index: compiler-rt/cmake/config-ix.cmake
===================================================================
--- compiler-rt/cmake/config-ix.cmake
+++ compiler-rt/cmake/config-ix.cmake
@@ -363,6 +363,14 @@
endif()
endif()
+ # /usr/include/c++ doesn't exist on macOS 10.14 or newer.
+ # If this is the case, we need to find the OS X sysroot to pass to clang.
+ if(NOT EXISTS /usr/include/c++)
+ set(OSX_SYSROOT_FLAG "-isysroot${DARWIN_osx_SYSROOT}")
+ else()
+ set(OSX_SYSROOT_FLAG "")
+ endif()
+
if(COMPILER_RT_ENABLE_IOS)
list(APPEND DARWIN_EMBEDDED_PLATFORMS ios)
set(DARWIN_ios_MIN_VER 9.0)
Index: compiler-rt/cmake/base-config-ix.cmake
===================================================================
--- compiler-rt/cmake/base-config-ix.cmake
+++ compiler-rt/cmake/base-config-ix.cmake
@@ -101,24 +101,6 @@
endif()
if(APPLE)
- # On Darwin if /usr/include/c++ doesn't exist, the user probably has Xcode but
- # not the command line tools (or is using macOS 10.14 or newer). If this is
- # the case, we need to find the OS X sysroot to pass to clang.
- if(NOT EXISTS /usr/include/c++)
- execute_process(COMMAND xcrun -sdk macosx --show-sdk-path
- OUTPUT_VARIABLE OSX_SYSROOT
- ERROR_QUIET
- OUTPUT_STRIP_TRAILING_WHITESPACE)
- if (NOT OSX_SYSROOT OR NOT EXISTS ${OSX_SYSROOT})
- message(WARNING "Detected OSX_SYSROOT ${OSX_SYSROOT} does not exist")
- else()
- message(STATUS "Found OSX_SYSROOT: ${OSX_SYSROOT}")
- set(OSX_SYSROOT_FLAG "-isysroot${OSX_SYSROOT}")
- endif()
- else()
- set(OSX_SYSROOT_FLAG "")
- endif()
-
option(COMPILER_RT_ENABLE_IOS "Enable building for iOS" On)
option(COMPILER_RT_ENABLE_WATCHOS "Enable building for watchOS - Experimental" Off)
option(COMPILER_RT_ENABLE_TVOS "Enable building for tvOS - Experimental" Off)
Index: compiler-rt/cmake/Modules/CompilerRTCompile.cmake
===================================================================
--- compiler-rt/cmake/Modules/CompilerRTCompile.cmake
+++ compiler-rt/cmake/Modules/CompilerRTCompile.cmake
@@ -131,10 +131,7 @@
" then echo 'e.g. with:'"
" echo ' cp -r' $(dirname $(dirname $(xcrun -f clang)))/lib/c++ '${LLVM_BINARY_DIR}/include/'"
" fi"
- " echo 'This can also be fixed by checking out the libcxx project from llvm.org and installing the headers'"
- " echo 'into your build directory:'"
- " echo ' cd ${LLVM_MAIN_SRC_DIR}/projects && svn co http://llvm.org/svn/llvm-project/libcxx/trunk libcxx'"
- " echo ' cd ${LLVM_BINARY_DIR} && make -C ${LLVM_MAIN_SRC_DIR}/projects/libcxx installheaders HEADER_DIR=${LLVM_BINARY_DIR}/include'"
+ " echo 'This can also be fixed by adding libcxx to LLVM_ENABLE_PROJECTS and building the cxx-headers target.'"
" echo"
" false"
"fi"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D96962.324649.patch
Type: text/x-patch
Size: 2845 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210218/cb33cee9/attachment.bin>
More information about the llvm-commits
mailing list