Skip to content

SwiftRemoteMirror: add a host build for the tools #21904

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

Merged
merged 1 commit into from
Feb 4, 2019
Merged
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
4 changes: 4 additions & 0 deletions cmake/modules/AddSwift.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2136,6 +2136,10 @@ function(_add_swift_executable_single name)
"${SWIFTEXE_SINGLE_LINK_FAT_LIBRARIES}"
"-${SWIFT_SDK_${SWIFTEXE_SINGLE_SDK}_LIB_SUBDIR}"
SWIFTEXE_SINGLE_LINK_FAT_LIBRARIES_TARGETS)
_list_add_string_suffix(
"${SWIFTEXE_SINGLE_LINK_FAT_LIBRARIES}"
"-${SWIFT_SDK_${SWIFTEXE_SINGLE_SDK}_LIB_SUBDIR}-${SWIFTEXE_SINGLE_ARCHITECTURE}"
SWIFTEXE_SINGLE_LINK_FAT_LIBRARIES)
else()
_list_add_string_suffix(
"${SWIFTEXE_SINGLE_LINK_FAT_LIBRARIES}"
Expand Down
43 changes: 32 additions & 11 deletions stdlib/public/SwiftRemoteMirror/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,15 +1,36 @@
# libswiftRemoteMirror.dylib should not have runtime dependencies; it's
# always built as a shared library.
if(SWIFT_BUILD_DYNAMIC_STDLIB OR SWIFT_BUILD_REMOTE_MIRROR)
if(SWIFT_BUILD_DYNAMIC_STDLIB)
add_swift_target_library(swiftRemoteMirror
SHARED TARGET_LIBRARY DONT_EMBED_BITCODE NOSWIFTRT
SwiftRemoteMirror.cpp
LINK_LIBRARIES
swiftReflection
C_COMPILE_FLAGS
${SWIFT_RUNTIME_CXX_FLAGS} -DswiftRemoteMirror_EXPORTS
LINK_FLAGS
${SWIFT_RUNTIME_LINK_FLAGS}
INSTALL_IN_COMPONENT
swift-remote-mirror)
SHARED TARGET_LIBRARY DONT_EMBED_BITCODE NOSWIFTRT
SwiftRemoteMirror.cpp
LINK_LIBRARIES
swiftReflection
C_COMPILE_FLAGS
${SWIFT_RUNTIME_CXX_FLAGS} -DswiftRemoteMirror_EXPORTS
LINK_FLAGS
${SWIFT_RUNTIME_LINK_FLAGS}
INSTALL_IN_COMPONENT
swift-remote-mirror)
endif()

# Build a specific version for the host with the host toolchain. This is going
# to be used by tools (e.g. lldb)
if(SWIFT_INCLUDE_TOOLS)
if(NOT SWIFT_BUILD_DYNAMIC_STDLIB)
add_custom_target(swiftRemoteMirror-${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_LIB_SUBDIR})
endif()

if(NOT SWIFT_BUILD_RUNTIME_WITH_HOST_COMPILER)
set(CMAKE_C_COMPILER ${HOST_CMAKE_C_COMPILER})
set(CMAKE_CXX_COMPILER ${HOST_CMAKE_CXX_COMPILER})
endif()

add_swift_host_library(swiftRemoteMirror STATIC
SwiftRemoteMirror.cpp)
target_compile_options(swiftRemoteMirror PRIVATE
${SWIFT_RUNTIME_CXX_FLAGS})
set_property(TARGET swiftRemoteMirror APPEND_STRING PROPERTY LINK_FLAGS
${SWIFT_RUNTIME_LINK_FLAGS})
endif()

3 changes: 2 additions & 1 deletion stdlib/tools/swift-reflection-test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ add_swift_target_executable(swift-reflection-test BUILD_WITH_STDLIB
swift-reflection-test.c
overrides.c
LINK_FAT_LIBRARIES
swiftRemoteMirror)
swiftRemoteMirror
swiftReflection)