Skip to content

Commit 876ca7e

Browse files
authored
Merge pull request #31287 from benlangmuir/export-list-sourcekitd-linux
[sourcekitd] Use add_llvm_symbol_exports instead of our old copy
2 parents 974f8c7 + e96f98b commit 876ca7e

File tree

1 file changed

+2
-40
lines changed

1 file changed

+2
-40
lines changed

tools/SourceKit/cmake/modules/AddSwiftSourceKit.cmake

Lines changed: 2 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,3 @@
1-
2-
function(add_sourcekit_symbol_exports target_name export_file)
3-
# Makefile.rules contains special cases for different platforms.
4-
# We restrict ourselves to Darwin for the time being.
5-
if("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin")
6-
add_custom_command(OUTPUT symbol.exports
7-
COMMAND sed -e "s/^/_/" < ${export_file} > symbol.exports
8-
DEPENDS ${export_file}
9-
VERBATIM
10-
COMMENT "Creating export file for ${target_name}")
11-
add_custom_target(${target_name}_exports DEPENDS symbol.exports)
12-
set_property(DIRECTORY APPEND
13-
PROPERTY ADDITIONAL_MAKE_CLEAN_FILES symbol.exports)
14-
set_target_properties(${target_name}_exports PROPERTIES
15-
FOLDER "SourceKit libraries")
16-
17-
get_property(srcs TARGET ${target_name} PROPERTY SOURCES)
18-
foreach(src ${srcs})
19-
get_filename_component(extension ${src} EXT)
20-
if(extension STREQUAL ".cpp")
21-
set(first_source_file ${src})
22-
break()
23-
endif()
24-
endforeach()
25-
26-
# Force re-linking when the exports file changes. Actually, it
27-
# forces recompilation of the source file. The LINK_DEPENDS target
28-
# property only works for makefile-based generators.
29-
set_property(SOURCE ${first_source_file} APPEND PROPERTY
30-
OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/symbol.exports)
31-
32-
set_property(TARGET ${target_name} APPEND_STRING PROPERTY
33-
LINK_FLAGS " -Wl,-exported_symbols_list,${CMAKE_CURRENT_BINARY_DIR}/symbol.exports")
34-
35-
add_dependencies(${target_name} ${target_name}_exports)
36-
endif()
37-
endfunction()
38-
391
# Add default compiler and linker flags to 'target'.
402
#
413
# FIXME: this is a HACK. All SourceKit CMake code using this function should be
@@ -155,7 +117,7 @@ macro(add_sourcekit_library name)
155117
swift_common_llvm_config(${name} ${SOURCEKITLIB_LLVM_LINK_COMPONENTS})
156118

157119
if(SOURCEKITLIB_SHARED AND EXPORTED_SYMBOL_FILE)
158-
add_sourcekit_symbol_exports(${name} ${EXPORTED_SYMBOL_FILE})
120+
add_llvm_symbol_exports(${name} ${EXPORTED_SYMBOL_FILE})
159121
endif()
160122

161123
if("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin")
@@ -302,7 +264,7 @@ macro(add_sourcekit_framework name)
302264
swift_common_llvm_config(${name} ${SOURCEKITFW_LLVM_LINK_COMPONENTS})
303265

304266
if (EXPORTED_SYMBOL_FILE)
305-
add_sourcekit_symbol_exports(${name} ${EXPORTED_SYMBOL_FILE})
267+
add_llvm_symbol_exports(${name} ${EXPORTED_SYMBOL_FILE})
306268
endif()
307269

308270
if(SOURCEKITFW_MODULEMAP)

0 commit comments

Comments
 (0)