Skip to content

Commit d08a2a0

Browse files
committed
[cmake] Make install of stdlib target libraries OPTIONAL
This fixes using --install-swift on macOS when not building all of the variant stdlibs (e.g. iphonesimulator, etc.). When we build swift on macOS, by default we build only the macOS stdlib. The other stdlib variants are still configured and there are targets to build them if you e.g. run `ninja swift-stdlib-iphonesimulator-x86_64` manually. However, we do not separate the _install_ actions. This meant that you couldn't install without building all the configured stdlib variants.
1 parent 049c3cd commit d08a2a0

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

cmake/modules/AddSwift.cmake

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1985,7 +1985,8 @@ function(add_swift_target_library name)
19851985
swift_install_in_component("${SWIFTLIB_INSTALL_IN_COMPONENT}"
19861986
FILES "${UNIVERSAL_LIBRARY_NAME}"
19871987
DESTINATION "lib${LLVM_LIBDIR_SUFFIX}/${resource_dir}/${resource_dir_sdk_subdir}"
1988-
PERMISSIONS ${file_permissions})
1988+
PERMISSIONS ${file_permissions}
1989+
OPTIONAL)
19891990
endif()
19901991
if(sdk STREQUAL WINDOWS)
19911992
foreach(arch ${SWIFT_SDK_WINDOWS_ARCHITECTURES})
@@ -2032,7 +2033,8 @@ function(add_swift_target_library name)
20322033
PERMISSIONS
20332034
OWNER_READ OWNER_WRITE
20342035
GROUP_READ
2035-
WORLD_READ)
2036+
WORLD_READ
2037+
OPTIONAL)
20362038
endif()
20372039

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

cmake/modules/SwiftSource.cmake

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,8 @@ function(_compile_swift_files
349349

350350
swift_install_in_component("${SWIFTFILE_INSTALL_IN_COMPONENT}"
351351
FILES ${module_outputs}
352-
DESTINATION "lib${LLVM_LIBDIR_SUFFIX}/swift/${library_subdir}")
352+
DESTINATION "lib${LLVM_LIBDIR_SUFFIX}/swift/${library_subdir}"
353+
OPTIONAL)
353354

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

0 commit comments

Comments
 (0)