Skip to content

Commit d260bd8

Browse files
committed
[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.
1 parent 7a7e6c2 commit d260bd8

File tree

21 files changed

+39
-511
lines changed

21 files changed

+39
-511
lines changed

CMakeLists.txt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1023,11 +1023,6 @@ set(SWIFT_GYB_FLAGS
10231023
set(SWIFT_MODULE_CACHE_PATH
10241024
"${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/module-cache")
10251025

1026-
# Xcode: use libc++ and c++11 using proper build settings.
1027-
if(XCODE)
1028-
swift_common_xcode_cxx_config()
1029-
endif()
1030-
10311026
# Check what linux distribution is being used.
10321027
# This can be used to determine the default linker to use.
10331028
if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.22")

cmake/modules/AddSwift.cmake

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
include(macCatalystUtils)
22
include(SwiftList)
3-
include(SwiftXcodeSupport)
43
include(SwiftWindowsSupport)
54
include(SwiftAndroidSupport)
65
include(SwiftCXXUtils)
@@ -689,24 +688,6 @@ function(add_swift_host_library name)
689688
list(APPEND ASHL_LLVM_LINK_COMPONENTS "demangle")
690689
endif()
691690
692-
if(XCODE)
693-
get_filename_component(base_dir ${CMAKE_CURRENT_SOURCE_DIR} NAME)
694-
695-
file(GLOB_RECURSE ASHL_HEADERS
696-
${SWIFT_SOURCE_DIR}/include/swift/${base_dir}/*.h
697-
${SWIFT_SOURCE_DIR}/include/swift/${base_dir}/*.def
698-
${CMAKE_CURRENT_SOURCE_DIR}/*.h
699-
${CMAKE_CURRENT_SOURCE_DIR}/*.def)
700-
file(GLOB_RECURSE ASHL_TDS
701-
${SWIFT_SOURCE_DIR}/include/swift${base_dir}/*.td)
702-
703-
set_source_files_properties(${ASHL_HEADERS} ${ASHL_TDS} PROPERTIES
704-
HEADER_FILE_ONLY true)
705-
source_group("TableGen descriptions" FILES ${ASHL_TDS})
706-
707-
set(ASHL_SOURCES ${ASHL_SOURCES} ${ASHL_HEADERS} ${ASHL_TDS})
708-
endif()
709-
710691
if(ASHL_SHARED)
711692
set(libkind SHARED)
712693
elseif(ASHL_STATIC)

cmake/modules/SwiftSharedCMakeConfig.cmake

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
include(CMakeParseArguments)
2-
include(SwiftXcodeSupport)
32

43
include(CheckCXXCompilerFlag)
54

@@ -39,13 +38,8 @@ macro(swift_common_standalone_build_config_llvm product)
3938
mark_as_advanced(LLVM_ENABLE_ASSERTIONS)
4039

4140
precondition(LLVM_TOOLS_BINARY_DIR)
42-
escape_path_for_xcode("${LLVM_BUILD_TYPE}" "${LLVM_TOOLS_BINARY_DIR}" LLVM_TOOLS_BINARY_DIR)
43-
4441
precondition_translate_flag(LLVM_BUILD_LIBRARY_DIR LLVM_LIBRARY_DIR)
45-
escape_path_for_xcode("${LLVM_BUILD_TYPE}" "${LLVM_LIBRARY_DIR}" LLVM_LIBRARY_DIR)
46-
4742
precondition(LLVM_LIBRARY_DIRS)
48-
escape_path_for_xcode("${LLVM_BUILD_TYPE}" "${LLVM_LIBRARY_DIRS}" LLVM_LIBRARY_DIRS)
4943

5044
# This could be computed using ${CMAKE_CFG_INTDIR} if we want to link Swift
5145
# against a matching LLVM build configuration. However, we usually want to be
@@ -54,10 +48,6 @@ macro(swift_common_standalone_build_config_llvm product)
5448
set(LLVM_BINARY_OUTPUT_INTDIR "${LLVM_TOOLS_BINARY_DIR}")
5549
set(LLVM_LIBRARY_OUTPUT_INTDIR "${LLVM_LIBRARY_DIR}")
5650

57-
if(XCODE)
58-
fix_imported_targets_for_xcode("${LLVM_EXPORTED_TARGETS}")
59-
endif()
60-
6151
if(NOT CMAKE_CROSSCOMPILING)
6252
set(${product}_NATIVE_LLVM_TOOLS_PATH "${LLVM_TOOLS_BINARY_DIR}")
6353
endif()
@@ -175,7 +165,6 @@ macro(swift_common_standalone_build_config_llvm product)
175165
"Version number that will be placed into the libclang library , in the form XX.YY")
176166

177167
foreach(INCLUDE_DIR ${LLVM_INCLUDE_DIRS})
178-
escape_path_for_xcode("${LLVM_BUILD_TYPE}" "${INCLUDE_DIR}" INCLUDE_DIR)
179168
include_directories(${INCLUDE_DIR})
180169
endforeach ()
181170

@@ -184,9 +173,6 @@ macro(swift_common_standalone_build_config_llvm product)
184173
link_directories("${LLVM_LIBRARY_DIR}")
185174

186175
set(LIT_ARGS_DEFAULT "-sv")
187-
if(XCODE)
188-
set(LIT_ARGS_DEFAULT "${LIT_ARGS_DEFAULT} --no-progress-bar")
189-
endif()
190176
set(LLVM_LIT_ARGS "${LIT_ARGS_DEFAULT}" CACHE STRING "Default options for lit")
191177

192178
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
@@ -209,10 +195,6 @@ macro(swift_common_standalone_build_config_clang product)
209195
set(${product}_NATIVE_CLANG_TOOLS_PATH "${LLVM_TOOLS_BINARY_DIR}")
210196
endif()
211197

212-
if(XCODE)
213-
fix_imported_targets_for_xcode("${CLANG_EXPORTED_TARGETS}")
214-
endif()
215-
216198
include_directories(${CLANG_INCLUDE_DIRS})
217199
endmacro()
218200

cmake/modules/SwiftXcodeSupport.cmake

Lines changed: 0 additions & 134 deletions
This file was deleted.

stdlib/cmake/modules/AddSwiftStdlib.cmake

Lines changed: 6 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -926,25 +926,6 @@ function(add_swift_target_library_single target name)
926926
endif()
927927
endif()
928928

929-
if(XCODE)
930-
string(REGEX MATCHALL "/[^/]+" split_path ${CMAKE_CURRENT_SOURCE_DIR})
931-
list(GET split_path -1 dir)
932-
file(GLOB_RECURSE SWIFTLIB_SINGLE_HEADERS
933-
${SWIFT_SOURCE_DIR}/include/swift${dir}/*.h
934-
${SWIFT_SOURCE_DIR}/include/swift${dir}/*.def
935-
${CMAKE_CURRENT_SOURCE_DIR}/*.def)
936-
937-
file(GLOB_RECURSE SWIFTLIB_SINGLE_TDS
938-
${SWIFT_SOURCE_DIR}/include/swift${dir}/*.td)
939-
940-
set_source_files_properties(${SWIFTLIB_SINGLE_HEADERS} ${SWIFTLIB_SINGLE_TDS}
941-
PROPERTIES
942-
HEADER_FILE_ONLY true)
943-
source_group("TableGen descriptions" FILES ${SWIFTLIB_SINGLE_TDS})
944-
945-
set(SWIFTLIB_SINGLE_SOURCES ${SWIFTLIB_SINGLE_SOURCES} ${SWIFTLIB_SINGLE_HEADERS} ${SWIFTLIB_SINGLE_TDS})
946-
endif()
947-
948929
# FIXME: swiftDarwin currently trips an assertion in SymbolGraphGen
949930
if (SWIFTLIB_IS_STDLIB AND SWIFT_STDLIB_BUILD_SYMBOL_GRAPHS AND NOT ${name} STREQUAL "swiftDarwin")
950931
list(APPEND SWIFTLIB_SINGLE_SWIFT_COMPILE_FLAGS "-Xfrontend;-emit-symbol-graph")
@@ -1122,14 +1103,6 @@ function(add_swift_target_library_single target name)
11221103
$<TARGET_OBJECTS:${object_library}${VARIANT_SUFFIX}>)
11231104
endforeach()
11241105

1125-
set(SWIFTLIB_SINGLE_XCODE_WORKAROUND_SOURCES)
1126-
if(XCODE)
1127-
set(SWIFTLIB_SINGLE_XCODE_WORKAROUND_SOURCES
1128-
# Note: the dummy.cpp source file provides no definitions. However,
1129-
# it forces Xcode to properly link the static library.
1130-
${SWIFT_SOURCE_DIR}/cmake/dummy.cpp)
1131-
endif()
1132-
11331106
set(INCORPORATED_OBJECT_LIBRARIES_EXPRESSIONS ${SWIFTLIB_INCORPORATED_OBJECT_LIBRARIES_EXPRESSIONS})
11341107
if(libkind STREQUAL "SHARED")
11351108
list(APPEND INCORPORATED_OBJECT_LIBRARIES_EXPRESSIONS
@@ -1148,8 +1121,7 @@ function(add_swift_target_library_single target name)
11481121
add_library("${target}" ${libkind}
11491122
${SWIFTLIB_SINGLE_SOURCES}
11501123
${SWIFTLIB_SINGLE_EXTERNAL_SOURCES}
1151-
${INCORPORATED_OBJECT_LIBRARIES_EXPRESSIONS}
1152-
${SWIFTLIB_SINGLE_XCODE_WORKAROUND_SOURCES})
1124+
${INCORPORATED_OBJECT_LIBRARIES_EXPRESSIONS})
11531125
if (NOT SWIFTLIB_SINGLE_OBJECT_LIBRARY AND TARGET "${install_in_component}")
11541126
add_dependencies("${install_in_component}" "${target}")
11551127
endif()
@@ -1249,10 +1221,9 @@ function(add_swift_target_library_single target name)
12491221

12501222
foreach(config ${CMAKE_CONFIGURATION_TYPES})
12511223
string(TOUPPER ${config} config_upper)
1252-
escape_path_for_xcode("${config}" "${swiftlib_prefix}" config_lib_dir)
12531224
set_target_properties(${target} PROPERTIES
1254-
LIBRARY_OUTPUT_DIRECTORY_${config_upper} ${config_lib_dir}/${output_sub_dir}
1255-
ARCHIVE_OUTPUT_DIRECTORY_${config_upper} ${config_lib_dir}/${output_sub_dir})
1225+
LIBRARY_OUTPUT_DIRECTORY_${config_upper} ${swiftlib_prefix}/${output_sub_dir}
1226+
ARCHIVE_OUTPUT_DIRECTORY_${config_upper} ${swiftlib_prefix}/${output_sub_dir})
12561227
endforeach()
12571228

12581229
if(SWIFTLIB_SINGLE_SDK IN_LIST SWIFT_DARWIN_PLATFORMS)
@@ -1331,8 +1302,7 @@ function(add_swift_target_library_single target name)
13311302
# library.
13321303
add_library(${target_static} STATIC
13331304
${SWIFTLIB_SINGLE_SOURCES}
1334-
${SWIFTLIB_INCORPORATED_OBJECT_LIBRARIES_EXPRESSIONS}
1335-
${SWIFTLIB_SINGLE_XCODE_WORKAROUND_SOURCES})
1305+
${SWIFTLIB_INCORPORATED_OBJECT_LIBRARIES_EXPRESSIONS})
13361306

13371307
set_output_directory(${target_static}
13381308
BINARY_DIR ${out_bin_dir}
@@ -1346,11 +1316,9 @@ function(add_swift_target_library_single target name)
13461316

13471317
foreach(config ${CMAKE_CONFIGURATION_TYPES})
13481318
string(TOUPPER ${config} config_upper)
1349-
escape_path_for_xcode(
1350-
"${config}" "${swift_lib_dir}" config_lib_dir)
13511319
set_target_properties(${target_static} PROPERTIES
1352-
LIBRARY_OUTPUT_DIRECTORY_${config_upper} ${config_lib_dir}/${output_sub_dir}
1353-
ARCHIVE_OUTPUT_DIRECTORY_${config_upper} ${config_lib_dir}/${output_sub_dir})
1320+
LIBRARY_OUTPUT_DIRECTORY_${config_upper} ${swift_lib_dir}/${output_sub_dir}
1321+
ARCHIVE_OUTPUT_DIRECTORY_${config_upper} ${swift_lib_dir}/${output_sub_dir})
13541322
endforeach()
13551323

13561324
set_target_properties(${target_static} PROPERTIES

stdlib/cmake/modules/SwiftSource.cmake

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -986,37 +986,6 @@ function(_compile_swift_files
986986
# over '-I' in this case.
987987
endif()
988988

989-
if(XCODE)
990-
# HACK: work around an issue with CMake Xcode generator and the Swift
991-
# driver.
992-
#
993-
# The Swift driver does not update the mtime of the output files if the
994-
# existing output files on disk are identical to the ones that are about
995-
# to be written. This behavior confuses the makefiles used in CMake Xcode
996-
# projects: the makefiles will not consider everything up to date after
997-
# invoking the compiler. As a result, the standard library gets rebuilt
998-
# multiple times during a single build.
999-
#
1000-
# To work around this issue we touch the output files so that their mtime
1001-
# always gets updated.
1002-
set(command_touch_standard_outputs
1003-
COMMAND "${CMAKE_COMMAND}" -E touch ${standard_outputs})
1004-
set(command_touch_module_outputs
1005-
COMMAND "${CMAKE_COMMAND}" -E touch ${module_outputs})
1006-
set(command_touch_sib_outputs
1007-
COMMAND "${CMAKE_COMMAND}" -E touch ${sib_outputs})
1008-
set(command_touch_sibopt_outputs
1009-
COMMAND "${CMAKE_COMMAND}" -E touch ${sibopt_outputs})
1010-
set(command_touch_sibgen_outputs
1011-
COMMAND "${CMAKE_COMMAND}" -E touch ${sibgen_outputs})
1012-
1013-
# macCatalyst zippered outputs
1014-
if(maccatalyst_build_flavor STREQUAL "zippered")
1015-
set(command_touch_maccatalyst_module_outputs
1016-
COMMAND "${CMAKE_COMMAND}" -E touch ${maccatalyst_module_outputs})
1017-
endif()
1018-
endif()
1019-
1020989
list(REMOVE_DUPLICATES dirs_to_create)
1021990

1022991
# Then we can compile both the object files and the swiftmodule files

test/lit.site.cfg.in

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -121,13 +121,6 @@ if "@SWIFT_ENABLE_REFLECTION@" == "TRUE":
121121
if "@SWIFT_ENABLE_RUNTIME_FUNCTION_COUNTERS@" == "TRUE":
122122
config.available_features.add('runtime_function_counters')
123123

124-
if "@CMAKE_GENERATOR@" == "Xcode":
125-
xcode_bin_dir = os.path.join(config.llvm_obj_root, "@LLVM_BUILD_TYPE@",
126-
'bin')
127-
lit_config.note('Adding to path: ' + xcode_bin_dir)
128-
config.environment['PATH'] = \
129-
os.path.pathsep.join((xcode_bin_dir, config.environment['PATH']))
130-
131124
config.available_features.add("CMAKE_GENERATOR=@CMAKE_GENERATOR@")
132125

133126
if "@SWIFT_ENABLE_MACCATALYST@" == "TRUE":

tools/SourceKit/cmake/modules/AddSwiftSourceKit.cmake

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ macro(add_sourcekit_library name)
212212
set(srcs ${SOURCEKITLIB_UNPARSED_ARGUMENTS})
213213

214214
llvm_process_sources(srcs ${srcs})
215-
if(MSVC_IDE OR XCODE)
215+
if(MSVC_IDE)
216216
# Add public headers
217217
file(RELATIVE_PATH lib_path
218218
${SOURCEKIT_SOURCE_DIR}/lib/
@@ -406,9 +406,9 @@ macro(add_sourcekit_framework name)
406406
endif()
407407
endforeach()
408408

409-
if(MSVC_IDE OR XCODE)
409+
if(MSVC_IDE)
410410
set_source_files_properties(${headers} PROPERTIES HEADER_FILE_ONLY ON)
411-
endif(MSVC_IDE OR XCODE)
411+
endif(MSVC_IDE)
412412

413413
if(LLVM_COMMON_DEPENDS)
414414
add_dependencies(${name} ${LLVM_COMMON_DEPENDS})

0 commit comments

Comments
 (0)