Skip to content

Revert "[6.0][CMake] Enable package CMO if possible" #2761

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 16 additions & 17 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,24 +42,23 @@ option(SWIFT_SYNTAX_ENABLE_WMO_PRE_3_26
$<IF:$<AND:$<NOT:$<CONFIG:Debug>>,$<PLATFORM_ID:Darwin>>,YES,NO>)

include(AddSwiftHostLibrary)
include(SwiftCompilerCapability)

# Don't link with 'string-processing' and 'backtracing'.
swift_supports_implicit_module("string-processing" SWIFT_SUPPORTS_DISABLE_IMPLICIT_STRING_PROCESSING_MODULE_IMPORT)
swift_supports_implicit_module("backtracing" SWIFT_SUPPORTS_DISABLE_IMPLICIT_BACKTRACING_MODULE_IMPORT)
if(SWIFT_SUPPORTS_DISABLE_IMPLICIT_STRING_PROCESSING_MODULE_IMPORT)
add_compile_options("$<$<COMPILE_LANGUAGE:Swift>:SHELL:-Xfrontend -disable-implicit-string-processing-module-import>")
endif()
if(SWIFT_SUPPORTS_DISABLE_IMPLICIT_BACKTRACING_MODULE_IMPORT)
add_compile_options("$<$<COMPILE_LANGUAGE:Swift>:SHELL:-Xfrontend -disable-implicit-backtracing-module-import>")
endif()

# SWIFTSYNTAX_EMIT_MODULE is TRUE by default
if(NOT DEFINED SWIFTSYNTAX_EMIT_MODULE)
set(SWIFTSYNTAX_EMIT_MODULE TRUE)
endif()
if(SWIFTSYNTAX_EMIT_MODULE)
swift_get_package_cmo_support(SWIFT_PACKAGE_CMO_SUPPORT)
# Ensure that we do not link the _StringProcessing module. But we can
# only pass this flag for new-enough compilers that support it.
file(WRITE "${CMAKE_BINARY_DIR}/tmp/empty-check-string-processing.swift" "")
execute_process(
COMMAND
"${CMAKE_Swift_COMPILER}"
-Xfrontend -disable-implicit-string-processing-module-import
-Xfrontend -parse-stdlib
-typecheck "${CMAKE_BINARY_DIR}/tmp/empty-check-string-processing.swift"
OUTPUT_QUIET ERROR_QUIET
RESULT_VARIABLE
SWIFT_SUPPORTS_DISABLE_IMPLICIT_STRING_PROCESSING_MODULE_IMPORT)
if (NOT SWIFT_SUPPORTS_DISABLE_IMPLICIT_STRING_PROCESSING_MODULE_IMPORT)
add_compile_options(
$<$<COMPILE_LANGUAGE:Swift>:-Xfrontend>
$<$<COMPILE_LANGUAGE:Swift>:-disable-implicit-string-processing-module-import>)
endif()

# Determine the module triple.
Expand Down
19 changes: 0 additions & 19 deletions cmake/modules/AddSwiftHostLibrary.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -87,25 +87,6 @@ function(add_swift_syntax_library name)
-emit-module-interface-path;${module_interface_file};
-emit-private-module-interface-path;${module_private_interface_file}
>)

# Enable package CMO if possible.
if(SWIFT_PACKAGE_CMO_SUPPORT STREQUAL "IMPLEMENTED")
target_compile_options("${name}" PRIVATE
$<$<COMPILE_LANGUAGE:Swift>:
"SHELL:-package-name ${SWIFT_MODULE_ABI_NAME_PREFIX}${PROJECT_NAME}"
"SHELL:-Xfrontend -package-cmo"
"SHELL:-Xfrontend -allow-non-resilient-access"
>)
elseif(SWIFT_PACKAGE_CMO_SUPPORT STREQUAL "EXPERIMENTAL")
target_compile_options("${name}" PRIVATE
$<$<COMPILE_LANGUAGE:Swift>:
"SHELL:-package-name ${SWIFT_MODULE_ABI_NAME_PREFIX}${PROJECT_NAME}"
"SHELL:-Xfrontend -experimental-package-cmo"
"SHELL:-Xfrontend -experimental-allow-non-resilient-access"
"SHELL:-Xfrontend -experimental-package-bypass-resilience"
>)
endif()

if(SWIFT_MODULE_ABI_NAME_PREFIX)
# ABI name prefix. this can be used to avoid name conflicts.
target_compile_options("${name}" PRIVATE
Expand Down
52 changes: 0 additions & 52 deletions cmake/modules/SwiftCompilerCapability.cmake

This file was deleted.