Skip to content

Fix fallout from "CMake: use object libraries" #2840

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 3 commits into from
Jun 2, 2016
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
File renamed without changes.
18 changes: 14 additions & 4 deletions cmake/modules/AddSwift.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,10 @@ function(_add_swift_library_single target name)

file(GLOB_RECURSE SWIFTLIB_SINGLE_TDS
${SWIFT_SOURCE_DIR}/include/swift${dir}/*.td)

set_source_files_properties(${SWIFTLIB_SINGLE_HEADERS} ${SWIFTLIB_SINGLE_TDS}
PROPERTIES
HEADER_FILE_ONLY true)
source_group("TableGen descriptions" FILES ${SWIFTLIB_SINGLE_TDS})

set(SWIFTLIB_SINGLE_SOURCES ${SWIFTLIB_SINGLE_SOURCES} ${SWIFTLIB_SINGLE_HEADERS} ${SWIFTLIB_SINGLE_TDS})
Expand Down Expand Up @@ -575,11 +579,20 @@ function(_add_swift_library_single target name)
$<TARGET_OBJECTS:${object_library}${VARIANT_SUFFIX}>)
endforeach()

set(SWIFTLIB_SINGLE_XCODE_WORKAROUND_SOURCES)
if(XCODE AND SWIFTLIB_SINGLE_TARGET_LIBRARY)
set(SWIFTLIB_SINGLE_XCODE_WORKAROUND_SOURCES
# Note: the dummy.cpp source file provides no definitions. However,
# it forces Xcode to properly link the static library.
${SWIFT_SOURCE_DIR}/cmake/dummy.cpp)
endif()

add_library("${target}" ${libkind}
${SWIFT_SECTIONS_OBJECT_BEGIN}
${SWIFTLIB_SINGLE_SOURCES}
${SWIFTLIB_SINGLE_EXTERNAL_SOURCES}
${SWIFTLIB_INCORPORATED_OBJECT_LIBRARIES_EXPRESSIONS}
${SWIFTLIB_SINGLE_XCODE_WORKAROUND_SOURCES}
${SWIFT_SECTIONS_OBJECT_END})

# The section metadata objects are generated sources, and we need to tell CMake
Expand Down Expand Up @@ -661,10 +674,7 @@ function(_add_swift_library_single target name)
add_library(${target_static} STATIC
${SWIFTLIB_SINGLE_SOURCES}
${SWIFTLIB_INCORPORATED_OBJECT_LIBRARIES_EXPRESSIONS}

# Note: the dummy.c source file provides no definitions. However,
# it forces Xcode to properly link the static library.
${SWIFT_SOURCE_DIR}/cmake/dummy.c)
${SWIFTLIB_SINGLE_XCODE_WORKAROUND_SOURCES})

set_output_directory(${target_static}
BINARY_DIR ${SWIFT_RUNTIME_OUTPUT_INTDIR}
Expand Down
6 changes: 3 additions & 3 deletions stdlib/public/runtime/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ set(swift_runtime_sources
Casting.cpp
Demangle.cpp
Enum.cpp
ErrorObject.cpp
ErrorObjectNative.cpp
Errors.cpp
Heap.cpp
HeapObject.cpp
Expand All @@ -59,9 +59,9 @@ set(swift_runtime_sources
Once.cpp
Portability.cpp
ProtocolConformance.cpp
Reflection.cpp
ReflectionNative.cpp
RuntimeEntrySymbols.cpp
SwiftObject.cpp)
SwiftObjectNative.cpp)

# Acknowledge that the following sources are known.
set(LLVM_OPTIONAL_SOURCES
Expand Down