Skip to content
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

[SourceKit] Link with libdispatch & libswiftCore on Linux #3594

Merged
merged 3 commits into from
Jul 21, 2016
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
14 changes: 14 additions & 0 deletions tools/SourceKit/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -506,5 +506,19 @@ include_directories(BEFORE
${SOURCEKIT_SOURCE_DIR}/include
)

if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
include_directories(AFTER ${SWIFT_PATH_TO_LIBDISPATCH_SOURCE})

add_library(dispatch SHARED IMPORTED)
set_target_properties(dispatch PROPERTIES
IMPORTED_LOCATION ${SWIFT_PATH_TO_LIBDISPATCH_BUILD}/src/.libs/libdispatch.so)

add_library(swiftCore SHARED IMPORTED)
set_target_properties(swiftCore PROPERTIES
IMPORTED_LOCATION ${SOURCEKIT_BINARY_DIR}/lib/swift/linux/libswiftCore.so)

set(SOURCEKIT_NEED_EXPLICIT_LIBDISPATCH TRUE)
endif()

add_subdirectory(lib)
add_subdirectory(tools)
11 changes: 5 additions & 6 deletions tools/SourceKit/lib/Support/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
set(SourceKitSupport_sources
Concurrency-libdispatch.cpp
FuzzyStringMatcher.cpp
Logging.cpp
ImmutableTextBuffer.cpp
Expand All @@ -7,14 +8,12 @@ set(SourceKitSupport_sources
UIDRegistry.cpp
)

set(SourceKitSupport_Darwin_sources
Concurrency-Mac.cpp)
set(LLVM_OPTIONAL_SOURCES ${SourceKitSupport_Darwin_sources})
if(APPLE)
list(APPEND SourceKitSupport_sources ${SourceKitSupport_Darwin_sources})
set(SOURCEKIT_SUPPORT_DEPEND swiftBasic clangBasic clangRewrite)
if(SOURCEKIT_NEED_EXPLICIT_LIBDISPATCH)
list(APPEND SOURCEKIT_SUPPORT_DEPEND dispatch BlocksRuntime)
endif()

add_sourcekit_library(SourceKitSupport
${SourceKitSupport_sources}
DEPENDS swiftBasic clangBasic clangRewrite
DEPENDS ${SOURCEKIT_SUPPORT_DEPEND}
)
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//===--- Concurrency-Mac.cpp ----------------------------------------------===//
//===--- Concurrency-libdispatch.cpp --------------------------------------===//
//
// This source file is part of the Swift.org open source project
//
Expand Down
4 changes: 4 additions & 0 deletions tools/SourceKit/tools/complete-test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ else()
set(SOURCEKITD_TEST_DEPEND sourcekitd)
endif()

if(SOURCEKIT_NEED_EXPLICIT_LIBDISPATCH)
set(SOURCEKITD_TEST_DEPEND ${SOURCEKITD_TEST_DEPEND} dispatch swiftCore)
endif()

add_sourcekit_executable(complete-test
complete-test.cpp
DEPENDS ${SOURCEKITD_TEST_DEPEND}
Expand Down
4 changes: 4 additions & 0 deletions tools/SourceKit/tools/sourcekitd-repl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ if(HAVE_UNICODE_LIBEDIT)
set(SOURCEKITD_REPL_DEPEND sourcekitd)
endif()

if(SOURCEKIT_NEED_EXPLICIT_LIBDISPATCH)
set(SOURCEKITD_REPL_DEPEND ${SOURCEKITD_REPL_DEPEND} dispatch swiftCore)
endif()

add_sourcekit_executable(sourcekitd-repl
sourcekitd-repl.cpp
DEPENDS ${SOURCEKITD_REPL_DEPEND} edit
Expand Down
4 changes: 4 additions & 0 deletions tools/SourceKit/tools/sourcekitd-test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ else()
set(SOURCEKITD_TEST_DEPEND sourcekitd)
endif()

if(SOURCEKIT_NEED_EXPLICIT_LIBDISPATCH)
set(SOURCEKITD_TEST_DEPEND ${SOURCEKITD_TEST_DEPEND} dispatch swiftCore)
endif()

add_sourcekit_executable(sourcekitd-test
sourcekitd-test.cpp
TestOptions.cpp
Expand Down
4 changes: 4 additions & 0 deletions tools/SourceKit/tools/sourcekitd/bin/InProc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ else()
)
endif()

if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
target_link_libraries(sourcekitdInProc PUBLIC BlocksRuntime)
endif()

if (SOURCEKIT_BUILT_STANDALONE)
# Create the symlinks necessary to find the swift runtime.
add_custom_command(TARGET sourcekitdInProc PRE_BUILD
Expand Down
2 changes: 2 additions & 0 deletions utils/build-script-impl
Original file line number Diff line number Diff line change
Expand Up @@ -1987,6 +1987,8 @@ for host in "${ALL_HOSTS[@]}"; do
-DSWIFT_PATH_TO_LLVM_BUILD:PATH="${llvm_build_dir}"
-DSWIFT_PATH_TO_CMARK_SOURCE:PATH="${CMARK_SOURCE_DIR}"
-DSWIFT_PATH_TO_CMARK_BUILD:PATH="$(build_directory ${host} cmark)"
-DSWIFT_PATH_TO_LIBDISPATCH_SOURCE:PATH="${LIBDISPATCH_SOURCE_DIR}"
-DSWIFT_PATH_TO_LIBDISPATCH_BUILD:PATH="$(build_directory ${host} libdispatch)"
)

if [[ "${CMAKE_GENERATOR}" == "Xcode" ]] ; then
Expand Down