Skip to content

Commit 467ae9f

Browse files
committed
Merge pull request #2641 from apple/cmake-build-target-libraries-with-stdlib
CMake: build target libraries with stdlib
2 parents 7f31d4e + d9d0825 commit 467ae9f

File tree

3 files changed

+13
-9
lines changed

3 files changed

+13
-9
lines changed

cmake/modules/AddSwift.cmake

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,8 @@ endfunction()
443443
function(_add_swift_library_single target name)
444444
set(SWIFTLIB_SINGLE_options
445445
SHARED IS_STDLIB IS_STDLIB_CORE IS_SDK_OVERLAY
446-
API_NOTES_NON_OVERLAY DONT_EMBED_BITCODE TARGET_LIBRARY)
446+
TARGET_LIBRARY HOST_LIBRARY
447+
API_NOTES_NON_OVERLAY DONT_EMBED_BITCODE)
447448
cmake_parse_arguments(SWIFTLIB_SINGLE
448449
"${SWIFTLIB_SINGLE_options}"
449450
"SDK;ARCHITECTURE;INSTALL_IN_COMPONENT;DEPLOYMENT_VERSION_IOS"
@@ -693,7 +694,7 @@ function(_add_swift_library_single target name)
693694

694695
# Don't build standard libraries by default. We will enable building
695696
# standard libraries that the user requested; the rest can be built on-demand.
696-
if(SWIFTLIB_SINGLE_IS_STDLIB)
697+
if(SWIFTLIB_SINGLE_TARGET_LIBRARY)
697698
foreach(t "${target}" ${target_static})
698699
set_target_properties(${t} PROPERTIES EXCLUDE_FROM_ALL TRUE)
699700
endforeach()
@@ -980,7 +981,8 @@ endfunction()
980981
# Sources to add into this library.
981982
function(add_swift_library name)
982983
set(SWIFTLIB_options
983-
SHARED IS_STDLIB IS_STDLIB_CORE IS_SDK_OVERLAY TARGET_LIBRARY IS_HOST
984+
SHARED IS_STDLIB IS_STDLIB_CORE IS_SDK_OVERLAY
985+
TARGET_LIBRARY HOST_LIBRARY
984986
API_NOTES_NON_OVERLAY DONT_EMBED_BITCODE HAS_SWIFT_CONTENT)
985987
cmake_parse_arguments(SWIFTLIB
986988
"${SWIFTLIB_options}"
@@ -1061,8 +1063,10 @@ function(add_swift_library name)
10611063
# SDKs building the variants of this library.
10621064
list_intersect(
10631065
"${SWIFTLIB_TARGET_SDKS}" "${SWIFT_SDKS}" SWIFTLIB_TARGET_SDKS)
1064-
if(SWIFTLIB_IS_HOST)
1065-
list_union("${SWIFTLIB_TARGET_SDKS}" "${SWIFT_HOST_VARIANT_SDK}" SWIFTLIB_TARGET_SDKS)
1066+
if(SWIFTLIB_HOST_LIBRARY)
1067+
list_union(
1068+
"${SWIFTLIB_TARGET_SDKS}" "${SWIFT_HOST_VARIANT_SDK}"
1069+
SWIFTLIB_TARGET_SDKS)
10661070
endif()
10671071
foreach(sdk ${SWIFTLIB_TARGET_SDKS})
10681072
set(THIN_INPUT_TARGETS)
@@ -1164,6 +1168,7 @@ function(add_swift_library name)
11641168
${SWIFTLIB_IS_STDLIB_CORE_keyword}
11651169
${SWIFTLIB_IS_SDK_OVERLAY_keyword}
11661170
${SWIFTLIB_TARGET_LIBRARY_keyword}
1171+
${SWIFTLIB_HOST_LIBRARY_keyword}
11671172
INSTALL_IN_COMPONENT "${SWIFTLIB_INSTALL_IN_COMPONENT}"
11681173
DEPLOYMENT_VERSION_IOS "${SWIFTLIB_DEPLOYMENT_VERSION_IOS}"
11691174
)
@@ -1268,7 +1273,7 @@ function(add_swift_library name)
12681273

12691274
# Add Swift standard library targets as dependencies to the top-level
12701275
# convenience target.
1271-
if(SWIFTLIB_IS_STDLIB)
1276+
if(SWIFTLIB_TARGET_LIBRARY)
12721277
foreach(arch ${SWIFT_SDK_${sdk}_ARCHITECTURES})
12731278
set(VARIANT_SUFFIX "-${SWIFT_SDK_${sdk}_LIB_SUBDIR}-${arch}")
12741279
if(TARGET "swift-stdlib${VARIANT_SUFFIX}" AND TARGET "swift-test-stdlib${VARIANT_SUFFIX}")

stdlib/public/Reflection/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
add_swift_library(swiftReflection TARGET_LIBRARY IS_HOST
1+
add_swift_library(swiftReflection TARGET_LIBRARY HOST_LIBRARY
22
Demangle.cpp
33
MetadataSource.cpp
44
Remangle.cpp

utils/build-script-impl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1907,8 +1907,6 @@ for deployment_target in "${HOST_TARGET}" "${CROSS_COMPILE_TOOLS_DEPLOYMENT_TARG
19071907

19081908
# When we are building LLVM create symlinks to the c++ headers.
19091909
if [[ "${product}" == "llvm" ]]; then
1910-
set -x
1911-
19121910
# Find the location of the c++ header dir.
19131911
if [[ "$(uname -s)" == "Darwin" ]] ; then
19141912
HOST_CXX_DIR=$(dirname ${HOST_CXX})
@@ -1922,6 +1920,7 @@ for deployment_target in "${HOST_TARGET}" "${CROSS_COMPILE_TOOLS_DEPLOYMENT_TARG
19221920
BUILT_CXX_INCLUDE_DIR="$llvm_build_dir/include"
19231921

19241922
echo "symlinking the system headers ($HOST_CXX_HEADERS_DIR) into the local clang build directory ($BUILT_CXX_INCLUDE_DIR)."
1923+
set -x
19251924
ln -s -f "$HOST_CXX_HEADERS_DIR" "$BUILT_CXX_INCLUDE_DIR"
19261925
{ set +x; } 2>/dev/null
19271926
fi

0 commit comments

Comments
 (0)