mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[build-script] Remove Xcode generation support
This was quite brittle and has now been superseded by swift-xcodegen. Remove the CMake/build-script logic for it, leaving the option behind to inform users to switch to using xcodegen instead.
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
include(macCatalystUtils)
|
||||
include(SwiftList)
|
||||
include(SwiftXcodeSupport)
|
||||
include(SwiftWindowsSupport)
|
||||
include(SwiftAndroidSupport)
|
||||
include(SwiftCXXUtils)
|
||||
@@ -689,24 +688,6 @@ function(add_swift_host_library name)
|
||||
list(APPEND ASHL_LLVM_LINK_COMPONENTS "demangle")
|
||||
endif()
|
||||
|
||||
if(XCODE)
|
||||
get_filename_component(base_dir ${CMAKE_CURRENT_SOURCE_DIR} NAME)
|
||||
|
||||
file(GLOB_RECURSE ASHL_HEADERS
|
||||
${SWIFT_SOURCE_DIR}/include/swift/${base_dir}/*.h
|
||||
${SWIFT_SOURCE_DIR}/include/swift/${base_dir}/*.def
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/*.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/*.def)
|
||||
file(GLOB_RECURSE ASHL_TDS
|
||||
${SWIFT_SOURCE_DIR}/include/swift${base_dir}/*.td)
|
||||
|
||||
set_source_files_properties(${ASHL_HEADERS} ${ASHL_TDS} PROPERTIES
|
||||
HEADER_FILE_ONLY true)
|
||||
source_group("TableGen descriptions" FILES ${ASHL_TDS})
|
||||
|
||||
set(ASHL_SOURCES ${ASHL_SOURCES} ${ASHL_HEADERS} ${ASHL_TDS})
|
||||
endif()
|
||||
|
||||
if(ASHL_SHARED)
|
||||
set(libkind SHARED)
|
||||
elseif(ASHL_STATIC)
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
include(CMakeParseArguments)
|
||||
include(SwiftXcodeSupport)
|
||||
|
||||
include(CheckCXXCompilerFlag)
|
||||
|
||||
@@ -39,13 +38,8 @@ macro(swift_common_standalone_build_config_llvm product)
|
||||
mark_as_advanced(LLVM_ENABLE_ASSERTIONS)
|
||||
|
||||
precondition(LLVM_TOOLS_BINARY_DIR)
|
||||
escape_path_for_xcode("${LLVM_BUILD_TYPE}" "${LLVM_TOOLS_BINARY_DIR}" LLVM_TOOLS_BINARY_DIR)
|
||||
|
||||
precondition_translate_flag(LLVM_BUILD_LIBRARY_DIR LLVM_LIBRARY_DIR)
|
||||
escape_path_for_xcode("${LLVM_BUILD_TYPE}" "${LLVM_LIBRARY_DIR}" LLVM_LIBRARY_DIR)
|
||||
|
||||
precondition(LLVM_LIBRARY_DIRS)
|
||||
escape_path_for_xcode("${LLVM_BUILD_TYPE}" "${LLVM_LIBRARY_DIRS}" LLVM_LIBRARY_DIRS)
|
||||
|
||||
# This could be computed using ${CMAKE_CFG_INTDIR} if we want to link Swift
|
||||
# against a matching LLVM build configuration. However, we usually want to be
|
||||
@@ -54,10 +48,6 @@ macro(swift_common_standalone_build_config_llvm product)
|
||||
set(LLVM_BINARY_OUTPUT_INTDIR "${LLVM_TOOLS_BINARY_DIR}")
|
||||
set(LLVM_LIBRARY_OUTPUT_INTDIR "${LLVM_LIBRARY_DIR}")
|
||||
|
||||
if(XCODE)
|
||||
fix_imported_targets_for_xcode("${LLVM_EXPORTED_TARGETS}")
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_CROSSCOMPILING)
|
||||
set(${product}_NATIVE_LLVM_TOOLS_PATH "${LLVM_TOOLS_BINARY_DIR}")
|
||||
endif()
|
||||
@@ -175,7 +165,6 @@ macro(swift_common_standalone_build_config_llvm product)
|
||||
"Version number that will be placed into the libclang library , in the form XX.YY")
|
||||
|
||||
foreach(INCLUDE_DIR ${LLVM_INCLUDE_DIRS})
|
||||
escape_path_for_xcode("${LLVM_BUILD_TYPE}" "${INCLUDE_DIR}" INCLUDE_DIR)
|
||||
include_directories(${INCLUDE_DIR})
|
||||
endforeach ()
|
||||
|
||||
@@ -184,9 +173,6 @@ macro(swift_common_standalone_build_config_llvm product)
|
||||
link_directories("${LLVM_LIBRARY_DIR}")
|
||||
|
||||
set(LIT_ARGS_DEFAULT "-sv")
|
||||
if(XCODE)
|
||||
set(LIT_ARGS_DEFAULT "${LIT_ARGS_DEFAULT} --no-progress-bar")
|
||||
endif()
|
||||
set(LLVM_LIT_ARGS "${LIT_ARGS_DEFAULT}" CACHE STRING "Default options for lit")
|
||||
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
|
||||
@@ -209,10 +195,6 @@ macro(swift_common_standalone_build_config_clang product)
|
||||
set(${product}_NATIVE_CLANG_TOOLS_PATH "${LLVM_TOOLS_BINARY_DIR}")
|
||||
endif()
|
||||
|
||||
if(XCODE)
|
||||
fix_imported_targets_for_xcode("${CLANG_EXPORTED_TARGETS}")
|
||||
endif()
|
||||
|
||||
include_directories(${CLANG_INCLUDE_DIRS})
|
||||
endmacro()
|
||||
|
||||
|
||||
@@ -1,134 +0,0 @@
|
||||
# This file contains cmake configuration specifically related to support for the
|
||||
# Xcode generator in CMake.
|
||||
|
||||
function(escape_path_for_xcode config path result_var_name)
|
||||
# If we are not using the Xcode generator, be defensive and early exit.
|
||||
if (NOT XCODE)
|
||||
set(${result_var_name} "${path}" PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
# Hack to deal with the fact that paths contain the build-time
|
||||
# variables. Note that this fix is Xcode-specific.
|
||||
string(REPLACE "$(CONFIGURATION)" "${config}" result "${path}")
|
||||
string(REPLACE "$(EFFECTIVE_PLATFORM_NAME)" "" result "${result}")
|
||||
set("${result_var_name}" "${result}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(check_imported_target_has_imported_configuration target config)
|
||||
get_target_property(IMPORTED_CONFIGS_LIST ${target} IMPORTED_CONFIGURATIONS)
|
||||
if ("${IMPORTED_CONFIGS_LIST}" STREQUAL "IMPORTED_CONFIGS_LIST-NOTFOUND")
|
||||
message(FATAL_ERROR "No import configuration of ${target} specified?!")
|
||||
endif()
|
||||
|
||||
if(NOT "${config}" IN_LIST IMPORTED_CONFIGS_LIST)
|
||||
message(FATAL_ERROR "${target} does not have imported config '${config}'?! Instead: ${IMPORTED_CONFIGS_LIST}")
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(fixup_imported_target_property_for_xcode target property llvm_build_type)
|
||||
set(FULL_PROP_NAME "${property}_${llvm_build_type}")
|
||||
|
||||
# First try to lookup the value associated with the "real build type".
|
||||
get_target_property(PROP_VALUE ${target} ${FULL_PROP_NAME})
|
||||
|
||||
# If the property is unspecified, return.
|
||||
if ("${PROP_VALUE}" STREQUAL "PROP_VALUE-NOTFOUND")
|
||||
return()
|
||||
endif()
|
||||
|
||||
# Otherwise for each cmake configuration that is not real_build_type, hardcode
|
||||
# its value to be PROP_VALUE.
|
||||
foreach(build_type ${CMAKE_CONFIGURATION_TYPES})
|
||||
string(TOUPPER "${build_type}" build_type_upper)
|
||||
if ("${build_type_upper}" STREQUAL "${llvm_build_type}")
|
||||
continue()
|
||||
endif()
|
||||
set(SWIFT_BUILD_PROPERTY_NAME "${property}_${build_type_upper}")
|
||||
set_target_properties(${target} PROPERTIES "${SWIFT_BUILD_PROPERTY_NAME}" "${PROP_VALUE}")
|
||||
endforeach()
|
||||
endfunction()
|
||||
|
||||
# When building with Xcode, we only support compiling against the LLVM
|
||||
# configuration that was specified by build-script. This becomes a problem since
|
||||
# if we compile LLVM-Release and Swift-Debug, Swift is going to look in the
|
||||
# Debug, not the Release folder for LLVM's code and thus will be compiling
|
||||
# against an unintended set of libraries, if those libraries exist at all.
|
||||
#
|
||||
# Luckily, via LLVMConfig.cmake, we know the configuration that LLVM was
|
||||
# compiled in, so we can grab the imported location for that configuration and
|
||||
# splat it across the other configurations as well.
|
||||
function(fix_imported_targets_for_xcode imported_targets)
|
||||
string(TOUPPER "${LLVM_BUILD_TYPE}" LLVM_BUILD_TYPE_UPPER)
|
||||
|
||||
# This is the set of configuration specific cmake properties that are
|
||||
# supported for imported targets in cmake 3.4.3. Sadly, beyond hacks, it seems
|
||||
# that there is no way to dynamically query the list of set properties of a
|
||||
# target.
|
||||
#
|
||||
# *NOTE* In fixup_imported_target_property_for_xcode, we add the _${CONFIG}
|
||||
# *suffix.
|
||||
set(imported_target_properties
|
||||
IMPORTED_IMPLIB
|
||||
IMPORTED_LINK_DEPENDENT_LIBRARIES
|
||||
IMPORTED_LINK_INTERFACE_LANGUAGES
|
||||
IMPORTED_LINK_INTERFACE_LIBRARIES
|
||||
IMPORTED_LINK_INTERFACE_MULTIPLICITY
|
||||
IMPORTED_LOCATION
|
||||
IMPORTED_NO_SONAME
|
||||
IMPORTED_SONAME)
|
||||
|
||||
foreach(target ${imported_targets})
|
||||
if (NOT TARGET ${target})
|
||||
message(FATAL_ERROR "${target} is not a target?!")
|
||||
endif()
|
||||
|
||||
# First check that we actually imported the configuration that LLVM said
|
||||
# that we did. This is just a soundness check.
|
||||
check_imported_target_has_imported_configuration(${target} ${LLVM_BUILD_TYPE_UPPER})
|
||||
|
||||
# Then loop through all of the imported properties and translate.
|
||||
foreach(property ${imported_target_properties})
|
||||
fixup_imported_target_property_for_xcode(
|
||||
${target} ${property} ${LLVM_BUILD_TYPE_UPPER})
|
||||
endforeach()
|
||||
endforeach()
|
||||
endfunction()
|
||||
|
||||
# Common additional cmake project config for Xcode.
|
||||
macro(swift_common_xcode_cxx_config)
|
||||
# Force usage of Clang.
|
||||
set(CMAKE_XCODE_ATTRIBUTE_GCC_VERSION "com.apple.compilers.llvm.clang.1_0"
|
||||
CACHE STRING "Xcode Compiler")
|
||||
# Use C++'14.
|
||||
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++14"
|
||||
CACHE STRING "Xcode C++ Language Standard")
|
||||
# Use libc++.
|
||||
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++"
|
||||
CACHE STRING "Xcode C++ Standard Library")
|
||||
# Enable some warnings not enabled by default. These
|
||||
# mostly reset clang back to its default settings, since
|
||||
# Xcode passes -Wno... for many warnings that are not enabled
|
||||
# by default.
|
||||
set(CMAKE_XCODE_ATTRIBUTE_GCC_WARN_ABOUT_RETURN_TYPE "YES")
|
||||
set(CMAKE_XCODE_ATTRIBUTE_GCC_WARN_ABOUT_MISSING_NEWLINE "YES")
|
||||
set(CMAKE_XCODE_ATTRIBUTE_GCC_WARN_UNUSED_VALUE "YES")
|
||||
set(CMAKE_XCODE_ATTRIBUTE_GCC_WARN_UNUSED_VARIABLE "YES")
|
||||
set(CMAKE_XCODE_ATTRIBUTE_GCC_WARN_SIGN_COMPARE "YES")
|
||||
set(CMAKE_XCODE_ATTRIBUTE_GCC_WARN_UNUSED_FUNCTION "YES")
|
||||
set(CMAKE_XCODE_ATTRIBUTE_GCC_WARN_HIDDEN_VIRTUAL_FUNCTIONS "YES")
|
||||
set(CMAKE_XCODE_ATTRIBUTE_GCC_WARN_UNINITIALIZED_AUTOS "YES")
|
||||
set(CMAKE_XCODE_ATTRIBUTE_CLANG_WARN_DOCUMENTATION_COMMENTS "YES")
|
||||
set(CMAKE_XCODE_ATTRIBUTE_CLANG_WARN_BOOL_CONVERSION "YES")
|
||||
set(CMAKE_XCODE_ATTRIBUTE_CLANG_WARN_EMPTY_BODY "YES")
|
||||
set(CMAKE_XCODE_ATTRIBUTE_CLANG_WARN_ENUM_CONVERSION "YES")
|
||||
set(CMAKE_XCODE_ATTRIBUTE_CLANG_WARN_INT_CONVERSION "YES")
|
||||
set(CMAKE_XCODE_ATTRIBUTE_CLANG_WARN_CONSTANT_CONVERSION "YES")
|
||||
set(CMAKE_XCODE_ATTRIBUTE_GCC_WARN_NON_VIRTUAL_DESTRUCTOR "YES")
|
||||
|
||||
# Disable RTTI
|
||||
set(CMAKE_XCODE_ATTRIBUTE_GCC_ENABLE_CPP_RTTI "NO")
|
||||
|
||||
# Disable exceptions
|
||||
set(CMAKE_XCODE_ATTRIBUTE_GCC_ENABLE_CPP_EXCEPTIONS "NO")
|
||||
endmacro()
|
||||
Reference in New Issue
Block a user