Skip to content

Commit

Permalink
CMake: add an option that forces the use of internal SDK
Browse files Browse the repository at this point in the history
rdar://22866512

Swift SVN r32316
  • Loading branch information
gribozavr committed Sep 29, 2015
1 parent 38197e1 commit 26e5be0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
7 changes: 5 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,10 @@ option(SWIFT_EMBED_BITCODE_SECTION
"If non-empty, embeds LLVM bitcode binary sections in the standard library and overlay binaries for supported platforms"
FALSE)

option(SWIFT_DARWIN_USE_INTERNAL_SDK
"If true, selects the internal SDK on Darwin"
FALSE)

option(SWIFT_RUNTIME_CRASH_REPORTER_CLIENT
"Whether to enable CrashReporter integration"
FALSE)
Expand Down Expand Up @@ -231,11 +235,10 @@ find_program(LIPO "lipo")

if("${SWIFT_NATIVE_LLVM_TOOLS_PATH}" STREQUAL "")
set(SWIFT_CROSS_COMPILING FALSE)
set(SWIFT_USE_INTERNAL_SDK FALSE)
else()
set(SWIFT_CROSS_COMPILING TRUE)
# Cross compiling tools requires the internal SDK.
set(SWIFT_USE_INTERNAL_SDK TRUE)
set(SWIFT_DARWIN_USE_INTERNAL_SDK TRUE)
endif()

# Reset CMAKE_SYSTEM_PROCESSOR if not cross-compiling.
Expand Down
5 changes: 4 additions & 1 deletion cmake/modules/SwiftConfigureSDK.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,15 @@ macro(configure_sdk_darwin
set(SWIFT_SDK_${prefix}_PATH "" CACHE PATH "Path to the ${name} SDK")

if(NOT SWIFT_SDK_${prefix}_PATH)
if(${SWIFT_USE_INTERNAL_SDK})
if(${SWIFT_DARWIN_USE_INTERNAL_SDK})
# Prefer the internal SDK, if present, for building C code and linking.
execute_process(
COMMAND "xcrun" "--sdk" "${xcrun_name}.internal" "--show-sdk-path"
OUTPUT_VARIABLE SWIFT_SDK_${prefix}_PATH
OUTPUT_STRIP_TRAILING_WHITESPACE)
if(NOT EXISTS "${SWIFT_SDK_${prefix}_PATH}/System/Library/Frameworks/module.map")
message(FATAL_ERROR "Internal ${name} SDK not found at SWIFT_SDK_${prefix}_PATH.")
endif()
endif()
endif()

Expand Down

0 comments on commit 26e5be0

Please sign in to comment.