Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/plotfi/cxx-interop-test
Small test app for C++ Interop with Swift.
https://github.com/plotfi/cxx-interop-test
Last synced: 3 months ago
JSON representation
Small test app for C++ Interop with Swift.
- Host: GitHub
- URL: https://github.com/plotfi/cxx-interop-test
- Owner: plotfi
- License: apache-2.0
- Created: 2021-03-07T07:44:23.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-11-05T05:23:26.000Z (about 1 year ago)
- Last Synced: 2024-07-05T13:46:20.451Z (4 months ago)
- Language: Swift
- Size: 60.5 KB
- Stars: 20
- Watchers: 6
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# cxx-interop test
Small test app for C++ Interop with Swift.To build you need the latest top of tree Swift from github.com/apple/swift
## NOTE: SPM can be busted at times when things require the latest ToT Swift. CMake can be more reliable:
```
cmake -GNinja -B./build \
-DCMAKE_Swift_COMPILER=/path/to/bin/swiftc \
-DCMAKE_CXX_COMPILER=/path/to/bin/clang++ \
-DSWIFT_CXX_TOOLCHAIN=/path/to/toolchain/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/ .ninja -C./build
./build/cxx-interop-testOutput:
std::vector: [1, 2, 3]
Done.```
To build Swift with swift PM use buildscript as follows:
```
/path/to/swift/checkouts/swift/utils/build-script \
--skip-build-benchmarks --skip-ios --skip-watchos --skip-tvos \
--swift-darwin-supported-archs "$(uname -m)" \
--release-debuginfo --swift-disable-dead-stripping \
--swiftpm --libcxx --llbuild --install-all true
```This will setup an xcode.app directory in your build dir. Modify your `PATH`,
`SDKROOT` and `CPATH` as follows:```
# Set these manually as you see fit:
export SWIFT_BUILD_DIR=/path/to/swift/checkouts/build
export TOOLCHAIN_BUILD_DIR=$SWIFT_BUILD_DIR/Ninja-RelWithDebInfoAssert/toolchain-macosx-x86_64
export XCODE_DEV_ROOT=`xcode-select -p`# These should be correct as is:
export XCTOOLCHAIN_SUBDIR=Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain
export XCTOOLCHAIN=$TOOLCHAIN_BUILD_DIR/$XCTOOLCHAIN_SUBDIR
export CPATH=$XCTOOLCHAIN/usr/include/c++/v1
export PATH=$XCTOOLCHAIN/usr/bin/:$PATH
export SDKROOT=$XCODE_DEV_ROOT/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk
```Ths should give you a workable swift package manager to use to build this project.
To build run the following:
```
swift build
```The runable end result should be in the .build directory.