Skip to content
This repository has been archived by the owner on Mar 28, 2020. It is now read-only.

[IndexStore] Enable blocks support on Linux builds #291

Open
wants to merge 1 commit into
base: upstream-with-swift
Choose a base branch
from

Conversation

kastiglione
Copy link
Contributor

This enables block support for Linux builds of IndexStore. The motivation is to have the various _apply functions be present (ex indexstore_store_units_apply). Without this, only the function pointer variants are available (ex indexstore_store_units_apply_f).

@kastiglione
Copy link
Contributor Author

Note that the Swift 5 Linux release includes a libIndexStore.so that is missing those symbols.

@kastiglione
Copy link
Contributor Author

cc @benlangmuir

@@ -49,6 +49,10 @@ if(APPLE)

set_property(TARGET IndexStore APPEND_STRING PROPERTY
LINK_FLAGS ${INDEXSTORE_LINK_FLAGS})
else()
# Blocks are off by default on non-darwin platforms.
target_compile_options(IndexStore PRIVATE -fblocks)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be hoisted out of the condition as it is safe to apply -fblocks when building for Darwin. However, please ensure that you do not apply this when the C++ compiler is not clang. The Windows builds use cl to build the toolchain as it is much faster and better.

else()
# Blocks are off by default on non-darwin platforms.
target_compile_options(IndexStore PRIVATE -fblocks)
target_link_libraries(IndexStore PRIVATE BlocksRuntime)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ugh, this is really annoying. The BlocksRuntime really should come from libdispatch, as that is the canonical one that is used elsewhere in the swift project. I don't know how to break this cycle.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants