Skip to content

Commit

Permalink
Add Apple Watch and Apple TV support (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sajjon authored Mar 25, 2023
1 parent b231bad commit 722e6cc
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 4 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/swift.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: CI

on:
push:
branches:
- main
pull_request:
branches:
- '*'
workflow_dispatch:

concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true

jobs:
library:
runs-on: macos-12
strategy:
matrix:
xcode: ['13.4.1', '14.0.1']
config: ['debug', 'release']
steps:
- uses: actions/checkout@v3
- name: Select Xcode ${{ matrix.xcode }}
run: sudo xcode-select -s /Applications/Xcode_${{ matrix.xcode }}.app
- name: Run ${{ matrix.config }} tests
run: CONFIG=${{ matrix.config }} make test-library
21 changes: 21 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
PLATFORM_IOS = iOS Simulator,name=iPhone 11 Pro Max
PLATFORM_MACOS = macOS
PLATFORM_MAC_CATALYST = macOS,variant=Mac Catalyst
PLATFORM_TVOS = tvOS Simulator,name=Apple TV
PLATFORM_WATCHOS = watchOS Simulator,name=Apple Watch Series 7 (45mm)

default: test-all

test-all: test-library

test-library:
swift test

format:
swift format \
--ignore-unparsable-files \
--in-place \
--recursive \
./Examples ./Package.swift ./Sources ./Tests

.PHONY: format test-all
23 changes: 19 additions & 4 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@

import PackageDescription

let development = false

let cSettings: [CSetting] = [
// Basic config values that are universal and require no dependencies.
// https://github.com/bitcoin-core/secp256k1/blob/master/src/basic-config.h#L12-L13
.define("ECMULT_WINDOW_SIZE", to: "15"),
.define("ECMULT_GEN_PREC_BITS", to: "4"),

// Enable modules in secp256k1.
// See bottom of: Sources/secp256k1/libsecp256k1/src/secp256k1.c
// For list
// Enable modules in secp256k1, for list scroll down to bottom of:
// Sources/secp256k1/libsecp256k1/src/secp256k1.c
.define("ENABLE_MODULE_ECDH"),
.define("ENABLE_MODULE_RECOVERY"),
.define("ENABLE_MODULE_SCHNORRSIG"),
Expand All @@ -21,8 +22,10 @@ let cSettings: [CSetting] = [
let package = Package(
name: "K1",
platforms: [
.macOS(.v11),
.iOS(.v13),
.macOS(.v11),
.tvOS(.v13),
.watchOS(.v6),
],
products: [
.library(
Expand Down Expand Up @@ -85,3 +88,15 @@ let package = Package(
]
)

if development {
for target in package.targets {
target.swiftSettings = target.swiftSettings ?? []
target.swiftSettings?.append(
.unsafeFlags([
"-Xfrontend", "-warn-concurrency",
"-Xfrontend", "-enable-actor-data-race-checks",
"-enable-library-evolution",
])
)
}
}

0 comments on commit 722e6cc

Please sign in to comment.