I'm attempting to use the LLVM C API in an Xcode project written in Swift. To do so, I am loosely following the guide here, but am having trouble. In the compilation step, after adding the include paths to the build settings in Xcode, I am getting the following errors:
<unknown>:0: error: module 'LLVM_Backend.CodeGen.PBQP.math' requires feature 'cplusplus'
/Users/freddy/Development/llvm-source/build/include/llvm/Support/DataTypes.h:35:10: note: submodule of top-level module 'LLVM_Backend' implicitly imported here
#include <math.h>
^
<module-includes>:1:9: note: in file included from <module-includes>:1:
#import "./Analysis.h"
^
/Users/freddy/Development/llvm-source/llvm/include/llvm-c/./Analysis.h:22:10: note: in file included from /Users/freddy/Development/llvm-source/llvm/include/llvm-c/./Analysis.h:22:
#include "llvm-c/Types.h"
^
/Users/freddy/Development/llvm-source/llvm/include/llvm-c/Types.h:17:10: error: could not build module 'LLVM_Support_DataTypes'
#include "llvm/Support/DataTypes.h"
^
/Users/freddy/Development/Xcode Projects/SwiftLLVMTest/SwiftLLVMTest/main.swift:10:8: error: could not build Objective-C module 'LLVM_C'
import LLVM_C
The next step in the slides is to add the flags:
-Xcc -D__STDC_CONSTANT_MACROS \
-Xcc -D__STDC_LIMIT_MACROS
but I'm not sure where to put these in the build settings--adding them to the 'Other C Flags' or 'Other Swift Flags' options doesn't seem to do anything.
How should I go about doing this?