Skip to content

Instantly share code, notes, and snippets.

@stephencelis
Created February 25, 2016 01:59
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 stephencelis/7f76f8d26a1df64ee3ff to your computer and use it in GitHub Desktop.
Save stephencelis/7f76f8d26a1df64ee3ff to your computer and use it in GitHub Desktop.
#define __STDC_CONSTANT_MACROS
#define __STDC_LIMIT_MACROS
module CLLVM [extern_c] [system] {
header "defines.h"
header "/usr/local/opt/llvm/include/llvm-c/Analysis.h"
header "/usr/local/opt/llvm/include/llvm-c/Core.h"
header "/usr/local/opt/llvm/include/llvm/Support/DataTypes.h"
header "/usr/local/opt/llvm/include/llvm-c/Support.h"
link "c++"
link "curses"
link "m"
link "pthread"
link "z"
// .a, unlike .dylib and .so, isn't picked up by swiftpm
// link "LLVMAnalysis"
// link "LLVMCore"
// link "LLVMMC"
// link "LLVMSupport"
// link "LLVMTarget"
export *
}
TOOLCHAIN = /Library/Developer/Toolchains/swift-latest.xctoolchain
SPM = ${TOOLCHAIN}/usr/bin/swift build
LLVM_PATH = /usr/local/opt/llvm
LLVM_INCLUDE = ${LLVM_PATH}/include
LLVM_LIB = ${LLVM_PATH}/lib
LLVM_STATIC_LIBRARIES += Analysis Core MC Support Target
SPM_FLAGS = \
-Xcc -I${LLVM_INCLUDE} \
-Xlinker -L${LLVM_LIB} \
$(addprefix -Xlinker -lLLVM,${LLVM_STATIC_LIBRARIES}) \
-vv \
all:
${SPM} ${SPM_FLAGS}
clean:
${SPM} --clean=dist
.PHONY: clean
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment