Skip to content

Repository files navigation

Noise

English | 中文

A Swift wrapper around the Racket CS runtime that simplifies embedding Racket in Swift applications. Noise also includes C++ bindings via CppNoise.

Quick Start

  1. Clone this repository.
  2. Install the Racket Serde packages:
raco pkg install Racket/noise-serde{-lib,-doc}/
  1. Build the framework:
make

Note:Git LFS is required. Binary files in Lib/ and Sources/Noise/boot are stored via LFS.

Usage

The shared libraries and boot files must match the Racket version used to compile your code. The files on the master branch likely will not match a release build of Racket. To use your own, build Racket from source and run:

./Bin/copy-libs.sh arm64-macos /path/to/src/racket

The first argument depends on your target OS and architecture:

OSArchitectureArgument
macOSx86_64x86_64-macos
macOSarm64/aarch64arm64-macos
iOSarm64/aarch64arm64-ios
iOS Simulatorarm64/aarch64arm64-iphonesimulator

Building for iOS

Configure Racket with:

configure \
--host=aarch64-apple-darwin \
--enable-ios=iPhoneOS \
--enable-pb \
--enable-racket=auto \
--enable-libffi

For the iPhone Simulator, change --enable-ios to iPhoneSimulator. After building, merge libffi into libracketcs.a:

libtool -s \
-o racket/lib/libracketcs1.a \
racket/lib/libracketcs.a \
/path/to/libffi.a \
&& mv racket/lib/libracketcs{1,}.a

Pre-compiled Builds

Pre-compiled builds for specific Racket versions are available on dedicated branches:

  • racket-9.0
  • racket-8.18
  • racket-8.17
  • racket-8.16
  • racket-8.15 (first branch to include an iOS build)
  • racket-8.14
  • racket-8.13
  • racket-8.12
  • racket-8.11.1
  • racket-8.11
  • racket-8.10

Packages

Noise (Core)

The core Swift wrapper around the Racket CS runtime. Provides a Racket struct for loading and evaluating Racket code from Swift.

NoiseSerde

A serialization/deserialization layer that allows data structures to be automatically shared between Racket and Swift. Install from Racket:

raco pkg install Racket/noise-serde-lib/
raco pkg install Racket/noise-serde-doc/
raco docs noise

NoiseBackend

Builds on NoiseSerde to provide a client-server model where the Racket server runs in a background thread and the Swift client communicates via pipes.

CppNoise

C++ bindings providing Noise, NoiseSerde, and NoiseBackend headers for embedding Racket in C++ applications (including WinUI support).

Project Structure

Noise/
├── SwiftNoise/ Swift packages (Noise, NoiseSerde, NoiseBackend)
├── CppNoise/ C++ bindings
├── Racket/ Racket packages (noise-serde-lib, noise-serde-doc)
├── Examples/
│ ├── Swift/ Swift NoiseBackend example app
│ └── Cpp/ C++ NoiseBackend example (WinUI)
└── .github/workflows/ CI and release builds

Examples

  • Swift: See Examples/Swift/NoiseBackendExample/ and SwiftNoise/Tests/NoiseTest/RacketTest.swift
  • C++: See Examples/Cpp/NoiseBackendExample/
  • External: NoiseBackendExample

License

Noise and its associated packages are licensed under the 3-Clause BSD License.

See Racket's license for information on Racket's license.

About

A Swift wrapper around Racket CS.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages