Skip to content

Commit fe3ec0c

Browse files
authored
Revert "build: improve libedit handling for builds"
1 parent 35277b5 commit fe3ec0c

File tree

7 files changed

+17
-82
lines changed

7 files changed

+17
-82
lines changed

CMakeLists.txt

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -915,11 +915,14 @@ else()
915915
find_package(LibXml2)
916916
endif()
917917

918-
if(LLVM_ENABLE_LIBEDIT)
919-
find_package(LibEdit REQUIRED)
920-
else()
921-
find_package(LibEdit)
918+
# You need libedit linked in order to check if you have el_wgets.
919+
cmake_push_check_state()
920+
list(APPEND CMAKE_REQUIRED_LIBRARIES "edit")
921+
check_symbol_exists(el_wgets "histedit.h" HAVE_EL_WGETS)
922+
if(HAVE_EL_WGETS)
923+
set(HAVE_UNICODE_LIBEDIT 1)
922924
endif()
925+
cmake_pop_check_state()
923926

924927
check_symbol_exists(wait4 "sys/wait.h" HAVE_WAIT4)
925928

cmake/modules/FindLibEdit.cmake

Lines changed: 0 additions & 62 deletions
This file was deleted.

include/swift/CMakeLists.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@ if(SWIFT_BUILD_REMOTE_MIRROR)
55
endif()
66

77
if(SWIFT_INCLUDE_TOOLS)
8-
if(libedit_FOUND)
9-
set(HAVE_UNICODE_LIBEDIT TRUE)
10-
endif()
118
configure_file(Config.h.in ${CMAKE_CURRENT_BINARY_DIR}/Config.h
129
ESCAPE_QUOTES @ONLY)
1310
add_subdirectory(Option)

tools/SourceKit/tools/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ include_directories(
66

77
add_swift_lib_subdirectory(sourcekitd)
88
add_swift_tool_subdirectory(sourcekitd-test)
9-
if(libedit_FOUND)
9+
if(HAVE_UNICODE_LIBEDIT)
1010
add_swift_tool_subdirectory(sourcekitd-repl)
1111
endif()
1212
add_swift_tool_subdirectory(complete-test)

tools/SourceKit/tools/sourcekitd-repl/CMakeLists.txt

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
if(libedit_FOUND)
1+
set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} edit)
2+
check_symbol_exists(el_wgets "histedit.h" HAVE_UNICODE_LIBEDIT)
3+
4+
if(HAVE_UNICODE_LIBEDIT)
25
if(SWIFT_SOURCEKIT_USE_INPROC_LIBRARY)
36
set(SOURCEKITD_REPL_LINK_LIBS sourcekitdInProc)
47
else()
@@ -7,13 +10,9 @@ if(libedit_FOUND)
710

811
add_sourcekit_executable(sourcekitd-repl
912
sourcekitd-repl.cpp
10-
LINK_LIBS ${SOURCEKITD_REPL_LINK_LIBS}
13+
LINK_LIBS ${SOURCEKITD_REPL_LINK_LIBS} edit
1114
LLVM_LINK_COMPONENTS support coverage lto
1215
)
13-
target_include_directories(sourcekitd-repl PRIVATE
14-
${libedit_INCLUDE_DIRS})
15-
target_link_libraries(sourcekitd-repl PRIVATE
16-
${libedit_LIBRARIES})
1716
if(SWIFT_NEED_EXPLICIT_LIBDISPATCH)
1817
target_link_libraries(sourcekitd-repl PRIVATE dispatch BlocksRuntime)
1918
endif()

tools/driver/CMakeLists.txt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,8 @@ target_link_libraries(swift
99
PRIVATE
1010
swiftDriver
1111
swiftFrontendTool)
12-
if(libedit_FOUND)
13-
target_link_libraries(swift PRIVATE
14-
${libedit_LIBRARIES})
12+
if(HAVE_UNICODE_LIBEDIT)
13+
target_link_libraries(swift PRIVATE edit)
1514
endif()
1615

1716
swift_create_post_build_symlink(swift

tools/swift-remoteast-test/CMakeLists.txt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,8 @@ target_link_libraries(swift-remoteast-test
77
swiftFrontendTool
88
swiftRemoteAST)
99
set_target_properties(swift-remoteast-test PROPERTIES ENABLE_EXPORTS 1)
10-
if(libedit_FOUND)
11-
target_link_libraries(swift-remoteast-test PRIVATE
12-
${libedit_LIBRARIES})
10+
if(HAVE_UNICODE_LIBEDIT)
11+
target_link_libraries(swift-remoteast-test PRIVATE edit)
1312
endif()
1413

1514
# If building as part of clang, make sure the headers are installed.

0 commit comments

Comments
 (0)