Giter VIP home page Giter VIP logo

cxx-interop-test's Introduction

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 .
ninja -C./build
./build/cxx-interop-test

Output:

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.

cxx-interop-test's People

Contributors

compnerd avatar plotfi avatar proffan avatar zoecarver avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.