Skip to content

repair static builds of Foundation #1787

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 2 commits into from
Nov 28, 2018
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
33 changes: 26 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,6 @@ add_swift_library(Foundation
Foundation
MODULE_PATH
${CMAKE_CURRENT_BINARY_DIR}/swift/Foundation.swiftmodule
OUTPUT
${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_SHARED_LIBRARY_PREFIX}Foundation${CMAKE_SHARED_LIBRARY_SUFFIX}
SOURCES
Foundation/AffineTransform.swift
Foundation/Array.swift
Expand Down Expand Up @@ -250,7 +248,7 @@ add_swift_library(Foundation
-L${install_dir}/usr/lib
-lCoreFoundation
${CURL_LIBRARIES}
${ICU_UC_LIBRARIES} ${ICU_I18N_LIBRARIES}
${ICU_UC_LIBRARY} ${ICU_I18N_LIBRARY}
${LIBXML2_LIBRARIES}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@compnerd This change seems to have broken it and also in the set(Foundation_INTERFACE_LIBRARIES below.

${libdispatch_ldflags}
${uuid_LIBRARIES}
Expand All @@ -265,6 +263,17 @@ add_swift_library(Foundation
DEPENDS
CoreFoundation)

if(NOT BUILD_SHARED_LIBS)
set(Foundation_INTERFACE_LIBRARIES
-L${install_dir}/usr/lib
-lCoreFoundation
${CURL_LIBRARIES}
${ICU_UC_LIBRARY}
${ICU_I18N_LIBRARY}
${LIBXML2_LIBRARIES}
${uuid_LIBRARIES})
endif()

add_swift_executable(plutil
SOURCES
Tools/plutil/main.swift
Expand All @@ -276,6 +285,7 @@ add_swift_executable(plutil
-L${CMAKE_CURRENT_BINARY_DIR}
${libdispatch_ldflags}
-lFoundation
${Foundation_INTERFACE_LIBRARIES}
SWIFT_FLAGS
-DDEPLOYMENT_RUNTIME_SWIFT
${deployment_enable_libdispatch}
Expand All @@ -298,6 +308,7 @@ if(ENABLE_TESTING)
${libdispatch_ldflags}
-L${CMAKE_CURRENT_BINARY_DIR}
-lFoundation
${Foundation_INTERFACE_LIBRARIES}
SOURCES
TestFoundation/xdgTestHelper/main.swift
SWIFT_FLAGS
Expand Down Expand Up @@ -404,6 +415,7 @@ if(ENABLE_TESTING)
${libdispatch_ldflags}
-L${CMAKE_CURRENT_BINARY_DIR}
-lFoundation
${Foundation_INTERFACE_LIBRARIES}
-L${FOUNDATION_PATH_TO_XCTEST_BUILD}
-lXCTest
RESOURCES
Expand Down Expand Up @@ -474,10 +486,17 @@ install(FILES
${CMAKE_CURRENT_BINARY_DIR}/swift/Foundation.swiftmodule
DESTINATION
lib/swift/${swift_os}/${swift_arch})
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_SHARED_LIBRARY_PREFIX}Foundation${CMAKE_SHARED_LIBRARY_SUFFIX}
DESTINATION
lib/swift/${swift_os})
if(BUILD_SHARED_LIBS)
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_SHARED_LIBRARY_PREFIX}Foundation${CMAKE_SHARED_LIBRARY_SUFFIX}
DESTINATION
lib/swift/${swift_os})
else()
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}Foundation${CMAKE_STATIC_LIBRARY_SUFFIX}
DESTINATION
lib/swift/${swift_os})
endif()
# TODO(compnerd) install as a Framework as that is how swift actually is built
install(DIRECTORY
${install_dir}/System/Library/Frameworks/CoreFoundation.framework/Headers/
Expand Down
2 changes: 2 additions & 0 deletions cmake/modules/FindICU.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ function(_icu_find)
set(component_cache_debug "${component_cache}_DEBUG")
set(component_found "${component_cache}_FOUND")

unset(component_libnames)
unset(component_debug_libnames)
list(APPEND component_libnames "icu${component}")
list(APPEND component_debug_libnames "icu${component}d")
if(component STREQUAL data)
Expand Down