Skip to content

Commit 6199876

Browse files
committed
cmake: remove support for non-libswift swift support in host libraries/executables.
This is not needed anymore because all swift code will be contained in libswift. Also, remove the corresponding tests.
1 parent 22c6f9f commit 6199876

File tree

10 files changed

+4
-181
lines changed

10 files changed

+4
-181
lines changed

CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1175,7 +1175,6 @@ endif()
11751175

11761176
if(SWIFT_INCLUDE_TESTS)
11771177
add_subdirectory(test)
1178-
add_subdirectory(validation-test)
11791178
add_subdirectory(unittests)
11801179
endif()
11811180
if(SWIFT_INCLUDE_DOCS)

cmake/modules/AddSwift.cmake

Lines changed: 4 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,6 @@ endfunction()
428428
# [SHARED]
429429
# [STATIC]
430430
# [OBJECT]
431-
# [PURE_SWIFT]
432431
# [LLVM_LINK_COMPONENTS comp1 ...]
433432
# source1 [source2 source3 ...])
434433
#
@@ -447,18 +446,13 @@ endfunction()
447446
# LLVM_LINK_COMPONENTS
448447
# LLVM components this library depends on.
449448
#
450-
# PURE_SWIFT
451-
# This has two effects if set: we do not use llvm_update_compile_flags to
452-
# generate cflags/etc and we leave the linking mode of the library as swift.
453-
#
454449
# source1 ...
455450
# Sources to add into this library.
456451
function(add_swift_host_library name)
457452
set(options
458453
SHARED
459454
STATIC
460-
OBJECT
461-
PURE_SWIFT)
455+
OBJECT)
462456
set(single_parameter_options)
463457
set(multiple_parameter_options
464458
LLVM_LINK_COMPONENTS)
@@ -521,9 +515,7 @@ function(add_swift_host_library name)
521515
if (LLVM_COMMON_DEPENDS)
522516
add_dependencies(${name} ${LLVM_COMMON_DEPENDS})
523517
endif()
524-
if (NOT ASHL_PURE_SWIFT)
525-
llvm_update_compile_flags(${name})
526-
endif()
518+
llvm_update_compile_flags(${name})
527519
swift_common_llvm_config(${name} ${ASHL_LLVM_LINK_COMPONENTS})
528520
set_output_directory(${name}
529521
BINARY_DIR ${SWIFT_RUNTIME_OUTPUT_INTDIR}
@@ -582,11 +574,7 @@ function(add_swift_host_library name)
582574
NO_SONAME YES)
583575
endif()
584576
585-
# Always link as CXX even if we have swift content unless we only contain
586-
# swift content signaled via us being marked "PURE_SWIFT".
587-
if (NOT ASHL_PURE_SWIFT)
588-
set_target_properties(${name} PROPERTIES LINKER_LANGUAGE CXX)
589-
endif()
577+
set_target_properties(${name} PROPERTIES LINKER_LANGUAGE CXX)
590578
591579
if(${SWIFT_HOST_VARIANT_SDK} IN_LIST SWIFT_DARWIN_PLATFORMS)
592580
target_link_options(${name} PRIVATE
@@ -596,30 +584,6 @@ function(add_swift_host_library name)
596584
"LINKER:-current_version,${SWIFT_COMPILER_VERSION}")
597585
endif()
598586
599-
# If we found a swift compiler and are going to use swift code in swift
600-
# host side tools but link with clang, add the appropriate -L paths so we
601-
# find all of the necessary swift libraries on Darwin.
602-
if (NOT ASHL_PURE_SWIFT)
603-
if (CMAKE_Swift_COMPILER)
604-
# Add in the toolchain directory so we can grab compatibility libraries
605-
get_filename_component(TOOLCHAIN_BIN_DIR ${CMAKE_Swift_COMPILER} DIRECTORY)
606-
get_filename_component(TOOLCHAIN_LIB_DIR "${TOOLCHAIN_BIN_DIR}/../lib/swift/macosx" ABSOLUTE)
607-
target_link_directories(${name} PUBLIC ${TOOLCHAIN_LIB_DIR})
608-
609-
# Add in the SDK directory for the host platform.
610-
#
611-
# NOTE: We do this /after/ target_link_directorying TOOLCHAIN_LIB_DIR to
612-
# ensure that we first find libraries from the toolchain, rather than
613-
# from the SDK. The reason why this is important is that when we perform
614-
# a stage2 build, this path is into the stage1 build. This is not a pure
615-
# SDK and also contains compatibility libraries. We need to make sure
616-
# that the compiler sees the actual toolchain's compatibility libraries
617-
# first before the just built compability libraries or build errors occur.
618-
target_link_directories(${name} PRIVATE
619-
${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_ARCH_${SWIFT_HOST_VARIANT_ARCH}_PATH}/usr/lib/swift)
620-
endif()
621-
endif()
622-
623587
# For now turn off on Darwin swift targets, debug info if we are compiling a static
624588
# library and set up an rpath so that if someone works around this by using
625589
# shared libraries that in the short term we can find shared libraries.
@@ -941,25 +905,7 @@ function(add_swift_host_tool executable)
941905
set_property(TARGET ${executable} APPEND_STRING PROPERTY
942906
LINK_FLAGS " -lobjc ")
943907
944-
else() # ASHT_HAS_LIBSWIFT AND LIBSWIFT_BUILD_MODE
945-
946-
# TODO: do we really need this? Do any tools which don't link libswift include other swift code?
947-
948-
# Add in the SDK directory for the host platform.
949-
#
950-
# NOTE: We do this /after/ target_link_directorying TOOLCHAIN_LIB_DIR to
951-
# ensure that we first find libraries from the toolchain, rather than from
952-
# the SDK.
953-
target_link_directories(${executable} PRIVATE "${sdk_dir}")
954-
955-
# We also want to be able to find libraries from the base toolchain
956-
# directory. This is so swiftc can rely on its own host side dylibs that may
957-
# contain swift content.
958-
list(APPEND RPATH_LIST "@executable_path/../lib")
959-
960-
# Also include the abi stable system stdlib in our rpath.
961-
list(APPEND RPATH_LIST "/usr/lib/swift")
962-
endif()
908+
endif() # ASHT_HAS_LIBSWIFT AND LIBSWIFT_BUILD_MODE
963909
964910
set_target_properties(${executable} PROPERTIES
965911
BUILD_WITH_INSTALL_RPATH YES

validation-test/BuildSystem/CMakeLists.txt

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

validation-test/BuildSystem/swift-cmake/CMakeLists.txt

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

validation-test/BuildSystem/swift-cmake/CPPLib.cpp

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

validation-test/BuildSystem/swift-cmake/CPPLib.h

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

validation-test/BuildSystem/swift-cmake/CPPTool.cpp

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

validation-test/BuildSystem/swift-cmake/Klass.swift

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

validation-test/BuildSystem/swift-cmake/RunCPPTools.test

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

validation-test/CMakeLists.txt

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

0 commit comments

Comments
 (0)