Skip to content

Instantly share code, notes, and snippets.

@dduan
Created December 29, 2021 08:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dduan/4df72c12f4b4ef8ad1c5562eae5bb40f to your computer and use it in GitHub Desktop.
Save dduan/4df72c12f4b4ef8ad1c5562eae5bb40f to your computer and use it in GitHub Desktop.
How to link to libdispatch on Linux - an example Makefile
SHELL = /bin/bash
ifeq ($(shell uname),Darwin)
EXTRA_SWIFT_FLAGS = "--disable-sandbox"
else
SWIFT_TOOLCHAIN = "$(shell dirname $(shell swift -print-target-info | grep runtimeResourcePath | cut -f 2 -d ':' | cut -f 2 -d '"'))"
EXTRA_SWIFT_FLAGS = -Xcxx -I${SWIFT_TOOLCHAIN}/swift -Xcxx -I${SWIFT_TOOLCHAIN}/swift/Block
endif
.PHONY: test
test:
@swift test ${EXTRA_SWIFT_FLAGS}
.PHONY: build
build:
@swift build --configuration release -Xswiftc -warnings-as-errors ${EXTRA_SWIFT_FLAGS}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment