From d7e2e1f93eede6bc14bcbec4133bea71c4b2e35c Mon Sep 17 00:00:00 2001 From: Brian Gesiak Date: Wed, 25 May 2016 16:26:06 -0400 Subject: [PATCH] [SR-1613][SourceKit] Require blocks runtime SourceKit makes heavy use of blocks. In order to port SourceKit to Linux, we either need to rewrite much of it to use function pointers, or we must require a blocks runtime. This commit requires a blocks runtime, but only when SourceKit is being built. Currently, SourceKit is not built on Linux, so this should not affect anyone. --- README.md | 2 +- tools/SourceKit/CMakeLists.txt | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index f821113980762..6829d9a08df3b 100644 --- a/README.md +++ b/README.md @@ -58,7 +58,7 @@ For OS X, you need [the latest Xcode](https://developer.apple.com/xcode/download For Ubuntu, you'll need the following development dependencies: - sudo apt-get install git cmake ninja-build clang python uuid-dev libicu-dev icu-devtools libbsd-dev libedit-dev libxml2-dev libsqlite3-dev swig libpython-dev libncurses5-dev pkg-config + sudo apt-get install git cmake ninja-build clang python uuid-dev libicu-dev icu-devtools libbsd-dev libedit-dev libxml2-dev libsqlite3-dev swig libpython-dev libncurses5-dev pkg-config libblocksruntime-dev **Note:** LLDB currently requires at least `swig-1.3.40` but will successfully build with version 2 shipped with Ubuntu. diff --git a/tools/SourceKit/CMakeLists.txt b/tools/SourceKit/CMakeLists.txt index d2ffbfd219dad..7ecd8e8a6ee9b 100644 --- a/tools/SourceKit/CMakeLists.txt +++ b/tools/SourceKit/CMakeLists.txt @@ -84,6 +84,11 @@ function(add_sourcekit_default_compiler_flags target) ANALYZE_CODE_COVERAGE "${analyze_code_coverage}" RESULT_VAR_NAME link_flags) + if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux") + list(APPEND c_compile_flags "-fblocks") + list(APPEND link_flags "-lBlocksRuntime") + endif() + # Convert variables to space-separated strings. _list_escape_for_shell("${c_compile_flags}" c_compile_flags) _list_escape_for_shell("${link_flags}" link_flags)