Skip to content

Commit e2b3307

Browse files
committed
[Backtracing] Add missing CxxStdlib dependency.
To do this we also need to fix AddSwiftStdlib because if you set the `INSTALL_WITH_SHARED` flag, the CMake scripts don't make a target with the `-static` suffix, but AddSwiftStdlib also assumes that it should dad `-static` to any module dependencies when building a static library.
1 parent 4016e25 commit e2b3307

File tree

2 files changed

+36
-24
lines changed

2 files changed

+36
-24
lines changed

stdlib/cmake/modules/AddSwiftStdlib.cmake

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -698,7 +698,7 @@ function(_add_swift_lipo_target)
698698
DEPENDS ${source_targets})
699699
endif()
700700
endfunction()
701-
701+
702702
# Add a single variant of a new Swift library.
703703
#
704704
# Usage:
@@ -1317,38 +1317,42 @@ function(add_swift_target_library_single target name)
13171317
# Set compile and link flags for the non-static target.
13181318
# Do these LAST.
13191319
set(target_static)
1320-
if(SWIFTLIB_SINGLE_IS_STDLIB AND SWIFTLIB_SINGLE_STATIC AND NOT SWIFTLIB_SINGLE_INSTALL_WITH_SHARED)
1321-
set(target_static "${target}-static")
1320+
if(SWIFTLIB_SINGLE_IS_STDLIB AND SWIFTLIB_SINGLE_STATIC)
1321+
if (SWIFTLIB_SINGLE_INSTALL_WITH_SHARED)
1322+
add_library("${target}-static" ALIAS ${target})
1323+
else()
1324+
set(target_static "${target}-static")
13221325

1323-
# We have already compiled Swift sources. Link everything into a static
1324-
# library.
1325-
add_library(${target_static} STATIC
1326+
# We have already compiled Swift sources. Link everything into a static
1327+
# library.
1328+
add_library(${target_static} STATIC
13261329
${SWIFTLIB_SINGLE_SOURCES}
13271330
${SWIFTLIB_INCORPORATED_OBJECT_LIBRARIES_EXPRESSIONS}
13281331
${SWIFTLIB_SINGLE_XCODE_WORKAROUND_SOURCES})
13291332

1330-
set_output_directory(${target_static}
1333+
set_output_directory(${target_static}
13311334
BINARY_DIR ${out_bin_dir}
13321335
LIBRARY_DIR ${out_lib_dir})
13331336

1334-
if(SWIFTLIB_INSTALL_WITH_SHARED)
1335-
set(swift_lib_dir ${lib_dir})
1336-
else()
1337-
set(swift_lib_dir ${static_lib_dir})
1338-
endif()
1337+
if(SWIFTLIB_INSTALL_WITH_SHARED)
1338+
set(swift_lib_dir ${lib_dir})
1339+
else()
1340+
set(swift_lib_dir ${static_lib_dir})
1341+
endif()
13391342

1340-
foreach(config ${CMAKE_CONFIGURATION_TYPES})
1341-
string(TOUPPER ${config} config_upper)
1342-
escape_path_for_xcode(
1343+
foreach(config ${CMAKE_CONFIGURATION_TYPES})
1344+
string(TOUPPER ${config} config_upper)
1345+
escape_path_for_xcode(
13431346
"${config}" "${swift_lib_dir}" config_lib_dir)
1344-
set_target_properties(${target_static} PROPERTIES
1345-
LIBRARY_OUTPUT_DIRECTORY_${config_upper} ${config_lib_dir}/${output_sub_dir}
1346-
ARCHIVE_OUTPUT_DIRECTORY_${config_upper} ${config_lib_dir}/${output_sub_dir})
1347-
endforeach()
1347+
set_target_properties(${target_static} PROPERTIES
1348+
LIBRARY_OUTPUT_DIRECTORY_${config_upper} ${config_lib_dir}/${output_sub_dir}
1349+
ARCHIVE_OUTPUT_DIRECTORY_${config_upper} ${config_lib_dir}/${output_sub_dir})
1350+
endforeach()
13481351

1349-
set_target_properties(${target_static} PROPERTIES
1350-
LIBRARY_OUTPUT_DIRECTORY ${swift_lib_dir}/${output_sub_dir}
1351-
ARCHIVE_OUTPUT_DIRECTORY ${swift_lib_dir}/${output_sub_dir})
1352+
set_target_properties(${target_static} PROPERTIES
1353+
LIBRARY_OUTPUT_DIRECTORY ${swift_lib_dir}/${output_sub_dir}
1354+
ARCHIVE_OUTPUT_DIRECTORY ${swift_lib_dir}/${output_sub_dir})
1355+
endif()
13521356
endif()
13531357

13541358
set_target_properties(${target}

stdlib/public/RuntimeModule/CMakeLists.txt

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@
1111
#===------------------------------------------------------------------------===#
1212
#
1313
# The Runtime module isn't the runtime itself; that lives in libswiftCore;
14-
# rather, it's a high level Swift interface to things
14+
# rather, it's a high level Swift interface to things in the runtime.
15+
#
16+
#===------------------------------------------------------------------------===#
17+
1518
set(swift_runtime_link_libraries
1619
swiftCore
1720
swift_Concurrency
@@ -22,6 +25,11 @@ if(SWIFT_BUILD_STDLIB AND SWIFT_ENABLE_EXPERIMENTAL_CONCURRENCY)
2225
set(concurrency _Concurrency)
2326
endif()
2427

28+
set(cxxstdlib_overlay)
29+
if(SWIFT_ENABLE_EXPERIMENTAL_CXX_INTEROP)
30+
set(cxxstdlib_overlay CxxStdlib)
31+
endif()
32+
2533
set(RUNTIME_SOURCES
2634
Address.swift
2735
Backtrace.swift
@@ -90,7 +98,7 @@ set(LLVM_OPTIONAL_SOURCES
9098
add_swift_target_library(swiftRuntime ${SWIFT_STDLIB_LIBRARY_BUILD_TYPES} IS_STDLIB
9199
${RUNTIME_SOURCES}
92100

93-
SWIFT_MODULE_DEPENDS ${concurrency}
101+
SWIFT_MODULE_DEPENDS ${concurrency} ${cxxstdlib_overlay}
94102

95103
SWIFT_MODULE_DEPENDS_ANDROID Android
96104
SWIFT_MODULE_DEPENDS_LINUX Glibc

0 commit comments

Comments
 (0)