Skip to content

Commit 222cc51

Browse files
committed
Remove SWIFTLIB_SINGLE_TARGET_LIBRARY
1 parent 47f156f commit 222cc51

File tree

1 file changed

+27
-43
lines changed

1 file changed

+27
-43
lines changed

stdlib/cmake/modules/AddSwiftStdlib.cmake

Lines changed: 27 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -622,7 +622,6 @@ function(_add_swift_target_library_single target name)
622622
OBJECT_LIBRARY
623623
SHARED
624624
STATIC
625-
TARGET_LIBRARY
626625
INSTALL_WITH_SHARED)
627626
set(SWIFTLIB_SINGLE_single_parameter_options
628627
ARCHITECTURE
@@ -850,7 +849,7 @@ function(_add_swift_target_library_single target name)
850849
endforeach()
851850

852851
set(SWIFTLIB_SINGLE_XCODE_WORKAROUND_SOURCES)
853-
if(XCODE AND SWIFTLIB_SINGLE_TARGET_LIBRARY)
852+
if(XCODE)
854853
set(SWIFTLIB_SINGLE_XCODE_WORKAROUND_SOURCES
855854
# Note: the dummy.cpp source file provides no definitions. However,
856855
# it forces Xcode to properly link the static library.
@@ -873,8 +872,7 @@ function(_add_swift_target_library_single target name)
873872
target_include_directories(${target} BEFORE PRIVATE
874873
${SWIFT_SOURCE_DIR}/stdlib/include)
875874
if(("${SWIFT_SDK_${SWIFTLIB_SINGLE_SDK}_OBJECT_FORMAT}" STREQUAL "ELF" OR
876-
"${SWIFT_SDK_${SWIFTLIB_SINGLE_SDK}_OBJECT_FORMAT}" STREQUAL "COFF") AND
877-
SWIFTLIB_SINGLE_TARGET_LIBRARY)
875+
"${SWIFT_SDK_${SWIFTLIB_SINGLE_SDK}_OBJECT_FORMAT}" STREQUAL "COFF"))
878876
if("${libkind}" STREQUAL "SHARED" AND NOT SWIFTLIB_SINGLE_NOSWIFTRT)
879877
# TODO(compnerd) switch to the generator expression when cmake is upgraded
880878
# to a version which supports it.
@@ -937,27 +935,25 @@ function(_add_swift_target_library_single target name)
937935
SUFFIX ${LLVM_PLUGIN_EXT})
938936
endif()
939937

940-
if(SWIFTLIB_SINGLE_TARGET_LIBRARY)
941-
# Install runtime libraries to lib/swift instead of lib. This works around
942-
# the fact that -isysroot prevents linking to libraries in the system
943-
# /usr/lib if Swift is installed in /usr.
944-
set_target_properties("${target}" PROPERTIES
945-
LIBRARY_OUTPUT_DIRECTORY ${SWIFTLIB_DIR}/${SWIFTLIB_SINGLE_SUBDIR}
946-
ARCHIVE_OUTPUT_DIRECTORY ${SWIFTLIB_DIR}/${SWIFTLIB_SINGLE_SUBDIR})
947-
if(SWIFTLIB_SINGLE_SDK STREQUAL WINDOWS AND SWIFTLIB_SINGLE_IS_STDLIB_CORE
948-
AND libkind STREQUAL SHARED)
949-
add_custom_command(TARGET ${target} POST_BUILD
950-
COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:${target}> ${SWIFTLIB_DIR}/${SWIFTLIB_SINGLE_SUBDIR})
951-
endif()
952-
953-
foreach(config ${CMAKE_CONFIGURATION_TYPES})
954-
string(TOUPPER ${config} config_upper)
955-
escape_path_for_xcode("${config}" "${SWIFTLIB_DIR}" config_lib_dir)
956-
set_target_properties(${target} PROPERTIES
957-
LIBRARY_OUTPUT_DIRECTORY_${config_upper} ${config_lib_dir}/${SWIFTLIB_SINGLE_SUBDIR}
958-
ARCHIVE_OUTPUT_DIRECTORY_${config_upper} ${config_lib_dir}/${SWIFTLIB_SINGLE_SUBDIR})
959-
endforeach()
960-
endif()
938+
# Install runtime libraries to lib/swift instead of lib. This works around
939+
# the fact that -isysroot prevents linking to libraries in the system
940+
# /usr/lib if Swift is installed in /usr.
941+
set_target_properties("${target}" PROPERTIES
942+
LIBRARY_OUTPUT_DIRECTORY ${SWIFTLIB_DIR}/${SWIFTLIB_SINGLE_SUBDIR}
943+
ARCHIVE_OUTPUT_DIRECTORY ${SWIFTLIB_DIR}/${SWIFTLIB_SINGLE_SUBDIR})
944+
if(SWIFTLIB_SINGLE_SDK STREQUAL WINDOWS AND SWIFTLIB_SINGLE_IS_STDLIB_CORE
945+
AND libkind STREQUAL SHARED)
946+
add_custom_command(TARGET ${target} POST_BUILD
947+
COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:${target}> ${SWIFTLIB_DIR}/${SWIFTLIB_SINGLE_SUBDIR})
948+
endif()
949+
950+
foreach(config ${CMAKE_CONFIGURATION_TYPES})
951+
string(TOUPPER ${config} config_upper)
952+
escape_path_for_xcode("${config}" "${SWIFTLIB_DIR}" config_lib_dir)
953+
set_target_properties(${target} PROPERTIES
954+
LIBRARY_OUTPUT_DIRECTORY_${config_upper} ${config_lib_dir}/${SWIFTLIB_SINGLE_SUBDIR}
955+
ARCHIVE_OUTPUT_DIRECTORY_${config_upper} ${config_lib_dir}/${SWIFTLIB_SINGLE_SUBDIR})
956+
endforeach()
961957

962958
if(SWIFTLIB_SINGLE_SDK IN_LIST SWIFT_APPLE_PLATFORMS)
963959
set(install_name_dir "@rpath")
@@ -993,9 +989,7 @@ function(_add_swift_target_library_single target name)
993989
# for an Android cross-build from a macOS host. Construct the proper linker
994990
# flags manually in add_swift_target_library instead, see there with
995991
# variable `swiftlib_link_flags_all`.
996-
if(SWIFTLIB_SINGLE_TARGET_LIBRARY)
997-
set_target_properties("${target}" PROPERTIES NO_SONAME TRUE)
998-
endif()
992+
set_target_properties("${target}" PROPERTIES NO_SONAME TRUE)
999993
# Only set the install RPATH if the toolchain and stdlib will be in Termux
1000994
# or some other native sysroot on Android.
1001995
if(NOT "${SWIFT_ANDROID_NATIVE_SYSROOT}" STREQUAL "")
@@ -1062,11 +1056,9 @@ function(_add_swift_target_library_single target name)
10621056

10631057
# Don't build standard libraries by default. We will enable building
10641058
# standard libraries that the user requested; the rest can be built on-demand.
1065-
if(SWIFTLIB_SINGLE_TARGET_LIBRARY)
1066-
foreach(t "${target}" ${target_static})
1067-
set_target_properties(${t} PROPERTIES EXCLUDE_FROM_ALL TRUE)
1068-
endforeach()
1069-
endif()
1059+
foreach(t "${target}" ${target_static})
1060+
set_target_properties(${t} PROPERTIES EXCLUDE_FROM_ALL TRUE)
1061+
endforeach()
10701062

10711063
# Handle linking and dependencies.
10721064
add_dependencies_multiple_targets(
@@ -1141,15 +1133,8 @@ function(_add_swift_target_library_single target name)
11411133
list(APPEND library_search_directories "${SWIFT_SDK_${sdk}_ARCH_${arch}_PATH}/usr/lib/swift")
11421134

11431135
# Add variant-specific flags.
1144-
if(SWIFTLIB_SINGLE_TARGET_LIBRARY)
1145-
set(build_type "${SWIFT_STDLIB_BUILD_TYPE}")
1146-
set(enable_assertions "${SWIFT_STDLIB_ASSERTIONS}")
1147-
else()
1148-
set(build_type "${CMAKE_BUILD_TYPE}")
1149-
set(enable_assertions "${LLVM_ENABLE_ASSERTIONS}")
1150-
set(analyze_code_coverage "${SWIFT_ANALYZE_CODE_COVERAGE}")
1151-
endif()
1152-
1136+
set(build_type "${SWIFT_STDLIB_BUILD_TYPE}")
1137+
set(enable_assertions "${SWIFT_STDLIB_ASSERTIONS}")
11531138
set(lto_type "${SWIFT_STDLIB_ENABLE_LTO}")
11541139

11551140
_add_target_variant_c_compile_flags(
@@ -1988,7 +1973,6 @@ function(add_swift_target_library name)
19881973
${SWIFTLIB_OBJECT_LIBRARY_keyword}
19891974
${SWIFTLIB_INSTALL_WITH_SHARED_keyword}
19901975
${SWIFTLIB_SOURCES}
1991-
TARGET_LIBRARY
19921976
MODULE_TARGETS ${module_variant_names}
19931977
SDK ${sdk}
19941978
ARCHITECTURE ${arch}

0 commit comments

Comments
 (0)