Skip to content

Commit cba2670

Browse files
committed
[cmake] Update OPTIONAL install products to be Darwin-only
Per review feedback.
1 parent d08a2a0 commit cba2670

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

cmake/modules/AddSwift.cmake

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1974,6 +1974,12 @@ function(add_swift_target_library name)
19741974
WORLD_READ)
19751975
endif()
19761976

1977+
set(optional_arg)
1978+
if(sdk IN_LIST SWIFT_APPLE_PLATFORMS)
1979+
# Allow installation of stdlib without building all variants on Darwin.
1980+
set(optional_arg "OPTIONAL")
1981+
endif()
1982+
19771983
if(sdk STREQUAL WINDOWS AND CMAKE_SYSTEM_NAME STREQUAL Windows)
19781984
swift_install_in_component("${SWIFTLIB_INSTALL_IN_COMPONENT}"
19791985
TARGETS ${name}-windows-${SWIFT_PRIMARY_VARIANT_ARCH}
@@ -1986,7 +1992,7 @@ function(add_swift_target_library name)
19861992
FILES "${UNIVERSAL_LIBRARY_NAME}"
19871993
DESTINATION "lib${LLVM_LIBDIR_SUFFIX}/${resource_dir}/${resource_dir_sdk_subdir}"
19881994
PERMISSIONS ${file_permissions}
1989-
OPTIONAL)
1995+
"${optional_arg}")
19901996
endif()
19911997
if(sdk STREQUAL WINDOWS)
19921998
foreach(arch ${SWIFT_SDK_WINDOWS_ARCHITECTURES})
@@ -2034,7 +2040,7 @@ function(add_swift_target_library name)
20342040
OWNER_READ OWNER_WRITE
20352041
GROUP_READ
20362042
WORLD_READ
2037-
OPTIONAL)
2043+
"${optional_arg}")
20382044
endif()
20392045

20402046
# Add Swift standard library targets as dependencies to the top-level

cmake/modules/SwiftSource.cmake

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,10 +347,16 @@ function(_compile_swift_files
347347
list(APPEND module_outputs "${interface_file}")
348348
endif()
349349

350+
set(optional_arg)
351+
if(sdk IN_LIST SWIFT_APPLE_PLATFORMS)
352+
# Allow installation of stdlib without building all variants on Darwin.
353+
set(optional_arg "OPTIONAL")
354+
endif()
355+
350356
swift_install_in_component("${SWIFTFILE_INSTALL_IN_COMPONENT}"
351357
FILES ${module_outputs}
352358
DESTINATION "lib${LLVM_LIBDIR_SUFFIX}/swift/${library_subdir}"
353-
OPTIONAL)
359+
"${optional_arg}")
354360

355361
set(line_directive_tool "${SWIFT_SOURCE_DIR}/utils/line-directive")
356362
set(swift_compiler_tool "${SWIFT_NATIVE_SWIFT_TOOLS_PATH}/swiftc")

0 commit comments

Comments
 (0)