Skip to content

Commit 06425c3

Browse files
authored
Revert "[CMake] Enable package CMO if possible (#2740)"
This reverts commit 6a4f5d8.
1 parent 82a453c commit 06425c3

File tree

3 files changed

+16
-88
lines changed

3 files changed

+16
-88
lines changed

CMakeLists.txt

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -42,24 +42,23 @@ option(SWIFT_SYNTAX_ENABLE_WMO_PRE_3_26
4242
$<IF:$<AND:$<NOT:$<CONFIG:Debug>>,$<PLATFORM_ID:Darwin>>,YES,NO>)
4343

4444
include(AddSwiftHostLibrary)
45-
include(SwiftCompilerCapability)
4645

47-
# Don't link with 'string-processing' and 'backtracing'.
48-
swift_supports_implicit_module("string-processing" SWIFT_SUPPORTS_DISABLE_IMPLICIT_STRING_PROCESSING_MODULE_IMPORT)
49-
swift_supports_implicit_module("backtracing" SWIFT_SUPPORTS_DISABLE_IMPLICIT_BACKTRACING_MODULE_IMPORT)
50-
if(SWIFT_SUPPORTS_DISABLE_IMPLICIT_STRING_PROCESSING_MODULE_IMPORT)
51-
add_compile_options("$<$<COMPILE_LANGUAGE:Swift>:SHELL:-Xfrontend -disable-implicit-string-processing-module-import>")
52-
endif()
53-
if(SWIFT_SUPPORTS_DISABLE_IMPLICIT_BACKTRACING_MODULE_IMPORT)
54-
add_compile_options("$<$<COMPILE_LANGUAGE:Swift>:SHELL:-Xfrontend -disable-implicit-backtracing-module-import>")
55-
endif()
56-
57-
# SWIFTSYNTAX_EMIT_MODULE is TRUE by default
58-
if(NOT DEFINED SWIFTSYNTAX_EMIT_MODULE)
59-
set(SWIFTSYNTAX_EMIT_MODULE TRUE)
60-
endif()
61-
if(SWIFTSYNTAX_EMIT_MODULE)
62-
swift_get_package_cmo_support(SWIFT_PACKAGE_CMO_SUPPORT)
46+
# Ensure that we do not link the _StringProcessing module. But we can
47+
# only pass this flag for new-enough compilers that support it.
48+
file(WRITE "${CMAKE_BINARY_DIR}/tmp/empty-check-string-processing.swift" "")
49+
execute_process(
50+
COMMAND
51+
"${CMAKE_Swift_COMPILER}"
52+
-Xfrontend -disable-implicit-string-processing-module-import
53+
-Xfrontend -parse-stdlib
54+
-typecheck "${CMAKE_BINARY_DIR}/tmp/empty-check-string-processing.swift"
55+
OUTPUT_QUIET ERROR_QUIET
56+
RESULT_VARIABLE
57+
SWIFT_SUPPORTS_DISABLE_IMPLICIT_STRING_PROCESSING_MODULE_IMPORT)
58+
if (NOT SWIFT_SUPPORTS_DISABLE_IMPLICIT_STRING_PROCESSING_MODULE_IMPORT)
59+
add_compile_options(
60+
$<$<COMPILE_LANGUAGE:Swift>:-Xfrontend>
61+
$<$<COMPILE_LANGUAGE:Swift>:-disable-implicit-string-processing-module-import>)
6362
endif()
6463

6564
# Determine the module triple.

cmake/modules/AddSwiftHostLibrary.cmake

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -87,25 +87,6 @@ function(add_swift_syntax_library name)
8787
-emit-module-interface-path;${module_interface_file};
8888
-emit-private-module-interface-path;${module_private_interface_file}
8989
>)
90-
91-
# Enable package CMO if possible.
92-
if(SWIFT_PACKAGE_CMO_SUPPORT STREQUAL "IMPLEMENTED")
93-
target_compile_options("${name}" PRIVATE
94-
$<$<COMPILE_LANGUAGE:Swift>:
95-
"SHELL:-package-name ${SWIFT_MODULE_ABI_NAME_PREFIX}${PROJECT_NAME}"
96-
"SHELL:-Xfrontend -package-cmo"
97-
"SHELL:-Xfrontend -allow-non-resilient-access"
98-
>)
99-
elseif(SWIFT_PACKAGE_CMO_SUPPORT STREQUAL "EXPERIMENTAL")
100-
target_compile_options("${name}" PRIVATE
101-
$<$<COMPILE_LANGUAGE:Swift>:
102-
"SHELL:-package-name ${SWIFT_MODULE_ABI_NAME_PREFIX}${PROJECT_NAME}"
103-
"SHELL:-Xfrontend -experimental-package-cmo"
104-
"SHELL:-Xfrontend -experimental-allow-non-resilient-access"
105-
"SHELL:-Xfrontend -experimental-package-bypass-resilience"
106-
>)
107-
endif()
108-
10990
if(SWIFT_MODULE_ABI_NAME_PREFIX)
11091
# ABI name prefix. this can be used to avoid name conflicts.
11192
target_compile_options("${name}" PRIVATE

cmake/modules/SwiftCompilerCapability.cmake

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

0 commit comments

Comments
 (0)