Skip to content

Commit

Permalink
Remove checks and references to internal Apple SDKs.
Browse files Browse the repository at this point in the history
These aren't available for use outside of Apple.

rdar://problem/23302539
  • Loading branch information
bitjammer committed Nov 17, 2015
1 parent 69d3b20 commit d9bbb6c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 77 deletions.
6 changes: 0 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,6 @@ 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 @@ -270,8 +266,6 @@ if("${SWIFT_NATIVE_LLVM_TOOLS_PATH}" STREQUAL "")
set(SWIFT_CROSS_COMPILING FALSE)
else()
set(SWIFT_CROSS_COMPILING TRUE)
# Cross compiling tools requires the internal SDK.
set(SWIFT_DARWIN_USE_INTERNAL_SDK TRUE)
endif()

# Reset CMAKE_SYSTEM_PROCESSOR if not cross-compiling.
Expand Down
36 changes: 8 additions & 28 deletions cmake/modules/AddSwift.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -40,40 +40,33 @@ endfunction()


function(_add_variant_c_compile_link_flags
sdk arch build_type enable_assertions use_internal_sdk result_var_name)
sdk arch build_type enable_assertions result_var_name)
set(result
${${result_var_name}}
"-target" "${SWIFT_SDK_${sdk}_ARCH_${arch}_TRIPLE}")

if(use_internal_sdk)
list(APPEND result
"-isysroot" "${SWIFT_SDK_${sdk}_INTERNAL_PATH}")
else()
list(APPEND result
"-isysroot" "${SWIFT_SDK_${sdk}_PATH}")
endif()
list(APPEND result
"-isysroot" "${SWIFT_SDK_${sdk}_PATH}")

if("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin")
list(APPEND result
"-arch" "${arch}"
"-F" "${SWIFT_SDK_${sdk}_PATH}/../../../Developer/Library/Frameworks"
"-F" "${SWIFT_SDK_${sdk}_PATH}/../../../Developer/AppleInternal/Library/Frameworks"
"-m${SWIFT_SDK_${sdk}_VERSION_MIN_NAME}-version-min=${SWIFT_SDK_${sdk}_DEPLOYMENT_VERSION}")
endif()

set("${result_var_name}" "${result}" PARENT_SCOPE)
endfunction()

function(_add_variant_c_compile_flags
sdk arch build_type enable_assertions use_internal_sdk result_var_name)
sdk arch build_type enable_assertions result_var_name)
set(result ${${result_var_name}})

_add_variant_c_compile_link_flags(
"${sdk}"
"${arch}"
"${build_type}"
"${enable_assertions}"
${use_internal_sdk}
result)

is_build_type_optimized("${build_type}" optimized)
Expand Down Expand Up @@ -114,8 +107,7 @@ function(_add_variant_swift_compile_flags

if("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin")
list(APPEND result
"-F" "${SWIFT_SDK_${sdk}_PATH}/../../../Developer/Library/Frameworks"
"-F" "${SWIFT_SDK_${sdk}_PATH}/../../../Developer/AppleInternal/Library/Frameworks")
"-F" "${SWIFT_SDK_${sdk}_PATH}/../../../Developer/Library/Frameworks")
endif()

is_build_type_optimized("${build_type}" optimized)
Expand All @@ -138,7 +130,7 @@ function(_add_variant_swift_compile_flags
endfunction()

function(_add_variant_link_flags
sdk arch build_type enable_assertions use_internal_sdk result_var_name)
sdk arch build_type enable_assertions result_var_name)

if("${sdk}" STREQUAL "")
message(FATAL_ERROR "Should specify an SDK")
Expand All @@ -155,7 +147,6 @@ function(_add_variant_link_flags
"${arch}"
"${build_type}"
"${enable_assertions}"
${use_internal_sdk}
result)

if("${sdk}" STREQUAL "LINUX")
Expand Down Expand Up @@ -630,7 +621,6 @@ endfunction()
# _add_swift_library_single(
# target
# name
# [USE_INTERNAL_SDK]
# [SHARED]
# [SDK sdk]
# [ARCHITECTURE architecture]
Expand Down Expand Up @@ -711,15 +701,12 @@ endfunction()
# INSTALL_IN_COMPONENT comp
# The Swift installation component that this library belongs to.
#
# USE_INTERNAL_SDK
# Use the 'internal' sdk variant.
#
# source1 ...
# Sources to add into this library
function(_add_swift_library_single target name)
set(SWIFTLIB_SINGLE_options
SHARED IS_STDLIB IS_STDLIB_CORE IS_SDK_OVERLAY
API_NOTES_NON_OVERLAY DONT_EMBED_BITCODE USE_INTERNAL_SDK)
API_NOTES_NON_OVERLAY DONT_EMBED_BITCODE)
cmake_parse_arguments(SWIFTLIB_SINGLE
"${SWIFTLIB_SINGLE_options}"
"SDK;ARCHITECTURE;INSTALL_IN_COMPONENT"
Expand Down Expand Up @@ -1033,14 +1020,12 @@ function(_add_swift_library_single target name)
"${SWIFTLIB_SINGLE_ARCHITECTURE}"
"${build_type}"
"${enable_assertions}"
${SWIFTLIB_SINGLE_USE_INTERNAL_SDK}
c_compile_flags)
_add_variant_link_flags(
"${SWIFTLIB_SINGLE_SDK}"
"${SWIFTLIB_SINGLE_ARCHITECTURE}"
"${build_type}"
"${enable_assertions}"
${SWIFTLIB_SINGLE_USE_INTERNAL_SDK}
link_flags)

# Handle gold linker flags for shared libraries.
Expand Down Expand Up @@ -1228,15 +1213,12 @@ endfunction()
# INSTALL_IN_COMPONENT comp
# The Swift installation component that this library belongs to.
#
# USE_INTERNAL_SDK
# Use the 'internal' sdk variant.
#
# source1 ...
# Sources to add into this library.
function(add_swift_library name)
set(SWIFTLIB_options
SHARED IS_STDLIB IS_STDLIB_CORE IS_SDK_OVERLAY TARGET_LIBRARY
API_NOTES_NON_OVERLAY DONT_EMBED_BITCODE USE_INTERNAL_SDK)
API_NOTES_NON_OVERLAY DONT_EMBED_BITCODE)
cmake_parse_arguments(SWIFTLIB
"${SWIFTLIB_options}"
"INSTALL_IN_COMPONENT"
Expand Down Expand Up @@ -1372,7 +1354,6 @@ function(add_swift_library name)
_add_swift_library_single(
${VARIANT_NAME}
${name}
${SWIFTLIB_USE_INTERNAL_SDK_keyword}
${SWIFTLIB_SHARED_keyword}
${SWIFTLIB_SOURCES}
SDK ${sdk}
Expand Down Expand Up @@ -1519,7 +1500,6 @@ function(add_swift_library name)
_add_swift_library_single(
${name}
${name}
${SWIFTLIB_USE_INTERNAL_SDK_keyword}
${SWIFTLIB_SHARED_keyword}
${SWIFTLIB_SOURCES}
SDK ${sdk}
Expand Down
48 changes: 5 additions & 43 deletions cmake/modules/SwiftConfigureSDK.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ set(SWIFT_CONFIGURED_SDKS)
function(_report_sdk prefix)
message(STATUS "${SWIFT_SDK_${prefix}_NAME} SDK:")
message(STATUS " Path: ${SWIFT_SDK_${prefix}_PATH}")
message(STATUS " Path (public): ${SWIFT_SDK_${prefix}_PUBLIC_PATH}")
message(STATUS " Version: ${SWIFT_SDK_${prefix}_VERSION}")
message(STATUS " Build number: ${SWIFT_SDK_${prefix}_BUILD_NUMBER}")
message(STATUS " Deployment version: ${SWIFT_SDK_${prefix}_DEPLOYMENT_VERSION}")
Expand Down Expand Up @@ -40,16 +39,14 @@ endfunction()
# )
#
# Sadly there are three OS naming conventions.
# xcrun SDK name: macosx iphoneos iphonesimulator (+ "internal" or version)
# xcrun SDK name: macosx iphoneos iphonesimulator (+ version)
# -mOS-version-min: macosx ios ios-simulator
# swift -triple: macosx ios ios
#
# This macro attempts to configure a given SDK. When successful, it
# defines a number of variables:
#
# SWIFT_SDK_${prefix}_NAME Display name for the SDK
# SWIFT_SDK_${prefix}_PATH Path to the SDK (possibly internal)
# SWIFT_SDK_${prefix}_PUBLIC_PATH Path to the public SDK
# SWIFT_SDK_${prefix}_VERSION SDK version number (e.g., 10.9, 7.0)
# SWIFT_SDK_${prefix}_BUILD_NUMBER SDK build number (e.g., 14A389a)
# SWIFT_SDK_${prefix}_DEPLOYMENT_VERSION Deployment version (e.g., 10.9, 7.0)
Expand All @@ -67,51 +64,18 @@ macro(configure_sdk_darwin
# Find the SDK
set(SWIFT_SDK_${prefix}_PATH "" CACHE PATH "Path to the ${name} SDK")

if(NOT SWIFT_SDK_${prefix}_PATH)
if(${SWIFT_DARWIN_USE_INTERNAL_SDK})
# If requested, require the internal SDK.
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/PrivateFrameworks")
message(FATAL_ERROR "Internal ${name} SDK not found at SWIFT_SDK_${prefix}_PATH.")
endif()
endif()
endif()

if(NOT SWIFT_SDK_${prefix}_PATH)
execute_process(
COMMAND "xcrun" "--sdk" "${xcrun_name}" "--show-sdk-path"
OUTPUT_VARIABLE SWIFT_SDK_${prefix}_PUBLIC_PATH
OUTPUT_STRIP_TRAILING_WHITESPACE)
if(NOT EXISTS "${SWIFT_SDK_${prefix}_PUBLIC_PATH}/System/Library/Frameworks/module.map")
message(FATAL_ERROR "${name} SDK not found at SWIFT_SDK_${prefix}_PUBLIC_PATH.")
endif()

set(SWIFT_SDK_${prefix}_PATH "${SWIFT_SDK_${prefix}_PUBLIC_PATH}")
endif()

# Find the internal SDK if the user has not specified to use an external ICU
# library. Otherwise, we will just use the regular SDK.
set(SWIFT_SDK_${prefix}_INTERNAL_PATH "" CACHE PATH "Path to the internal ${name} SDK")
if (NOT SWIFT_DARWIN_ICU_INCLUDE_PATH)
if ("${prefix}" STREQUAL "IOS_SIMULATOR" OR
"${prefix}" STREQUAL "WATCHOS_SIMULATOR" OR
"${prefix}" STREQUAL "TVOS_SIMULATOR")
set(SWIFT_SDK_${prefix}_INTERNAL_PATH "${SWIFT_SDK_${prefix}_PATH}")
else()
execute_process(
COMMAND "xcrun" "--sdk" "${xcrun_name}.internal" "--show-sdk-path"
OUTPUT_VARIABLE SWIFT_SDK_${prefix}_INTERNAL_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 "${name} SDK not found at ${SWIFT_SDK_${prefix}_PATH}.")
endif()
else()
set(SWIFT_SDK_${prefix}_INTERNAL_PATH "${SWIFT_SDK_${prefix}_PATH}")
endif()

if(NOT EXISTS "${SWIFT_SDK_${prefix}_PATH}/System/Library/Frameworks/module.map")
message(FATAL_ERROR "${name} SDK not found at SWIFT_SDK_${prefix}_PATH.")
message(FATAL_ERROR "${name} SDK not found at ${SWIFT_SDK_${prefix}_PATH}.")
endif()

# Determine the SDK version we found.
Expand Down Expand Up @@ -151,8 +115,6 @@ macro(configure_sdk_unix

set(SWIFT_SDK_${prefix}_NAME "${name}")
set(SWIFT_SDK_${prefix}_PATH "/")
set(SWIFT_SDK_${prefix}_PUBLIC_PATH "/")
set(SWIFT_SDK_${prefix}_INTERNAL_PATH "/")
set(SWIFT_SDK_${prefix}_VERSION "don't use")
set(SWIFT_SDK_${prefix}_BUILD_NUMBER "don't use")
set(SWIFT_SDK_${prefix}_DEPLOYMENT_VERSION "don't use")
Expand Down

0 comments on commit d9bbb6c

Please sign in to comment.