[swift-build-dev] [swift-evolution] SwiftPM C++ Support

Harlan Haskins harlan at harlanhaskins.com
Mon Jan 16 18:47:58 CST 2017


-swift-evolution, for now.

I’m trying to build a C++ shim around the LLVM API to create an instance of the ORCJIT, visible in this PR:
https://github.com/trill-lang/LLVMSwift/pull/18 <https://github.com/trill-lang/LLVMSwift/pull/18>

I can’t build this file without passing `-Xcc -std=c++1` to `swift build`. When I pass that (along with the necessary linker flags and include dirs):

`swift build -Xcc -std=c++11 -Xcc -I/usr/local/opt/llvm/include -Xlinker -L/usr/local/opt/llvm/lib -Xlinker -lc++ -Xlinker -lLLVM`

Then It can’t build SwiftShims:

<unknown>:0: error: could not build Objective-C module 'SwiftShims'
<unknown>:0: error: invalid argument '-std=c++11' not allowed with 'C/ObjC'

That’s the issue here — I can’t pass arguments to the C++ files without affecting the C/ObjC files.

Thanks,
Harlan

> On Jan 16, 2017, at 4:51 PM, Daniel Dunbar via swift-build-dev <swift-build-dev at swift.org> wrote:
> 
> Hi Harlan,
> 
> Can you describe more about exactly what distinct problems you are running into?
> 
> Thanks!
>  - Daniel
> 
> On Mon, Jan 16, 2017 at 10:54 AM, Ankit Agarwal via swift-build-dev <swift-build-dev at swift.org <mailto:swift-build-dev at swift.org>> wrote:
> + swift-build-dev
> 
> On Tue, Jan 17, 2017 at 12:03 AM, Harlan Haskins via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> wrote:
> Hi swift-evolution!
> 
> Robert Widmann and I have been working on a Swift wrapper for LLVM (https://github.com/harlanhaskins/LLVMSwift <https://github.com/harlanhaskins/LLVMSwift>) and we’re lamenting the lack of C++ support in SwiftPM.
> 
> Ideally, we’d be able to write C++ files that expose C APIs for LLVM APIs that aren’t yet exposed in the llvm-c API.
> 
> Before we write a proposal for C++ files in SwiftPM targets, are there any concerns/things we should consider?
> 
> Thanks,
> Harlan
> 
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org <mailto:swift-evolution at swift.org>
> https://lists.swift.org/mailman/listinfo/swift-evolution <https://lists.swift.org/mailman/listinfo/swift-evolution>
> 
> 
> 
> 
> -- 
> Ankit
> 
> 
> _______________________________________________
> swift-build-dev mailing list
> swift-build-dev at swift.org <mailto:swift-build-dev at swift.org>
> https://lists.swift.org/mailman/listinfo/swift-build-dev <https://lists.swift.org/mailman/listinfo/swift-build-dev>
> 
> 
> _______________________________________________
> swift-build-dev mailing list
> swift-build-dev at swift.org <mailto:swift-build-dev at swift.org>
> https://lists.swift.org/mailman/listinfo/swift-build-dev <https://lists.swift.org/mailman/listinfo/swift-build-dev>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-build-dev/attachments/20170116/a893e0ff/attachment.html>


More information about the swift-build-dev mailing list