From 659a776022b3ad22465c44a86e0ce3b60c845535 Mon Sep 17 00:00:00 2001 From: Jurvis Tan Date: Fri, 3 Jun 2022 22:44:09 +0800 Subject: [PATCH] Support multiple architectures per platform Add Package.swift --- LibWally.xcodeproj/project.pbxproj | 2 ++ Package.swift | 26 ++++++++++++++++++++++++++ build-libwally-swift.sh | 7 +++++++ 3 files changed, 35 insertions(+) create mode 100644 Package.swift diff --git a/LibWally.xcodeproj/project.pbxproj b/LibWally.xcodeproj/project.pbxproj index 928b0453..d3af8a4e 100644 --- a/LibWally.xcodeproj/project.pbxproj +++ b/LibWally.xcodeproj/project.pbxproj @@ -46,6 +46,7 @@ /* Begin PBXFileReference section */ 754D4D172811111B00216F1E /* libsecp256k1.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libsecp256k1.a; path = "CLibWally/libwally-core/src/secp256k1/.libs/libsecp256k1.a"; sourceTree = ""; }; + 757DBE97281E181D00AE30F2 /* Package.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Package.swift; sourceTree = ""; }; 75F6BECF281F6F650072D4DE /* LibWallyCore */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = LibWallyCore; path = "CLibWally/libwally-core/build/LibWallyCore"; sourceTree = ""; }; 75F6BED0281F6F650072D4DE /* libsecp256k1 */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libsecp256k1; path = "CLibWally/libwally-core/build/libsecp256k1"; sourceTree = ""; }; A20557A522C6CDBE007221AA /* LibWally.modulemap */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = "sourcecode.module-map"; path = LibWally.modulemap; sourceTree = ""; }; @@ -104,6 +105,7 @@ FE9CD3A7229C397900345DFA = { isa = PBXGroup; children = ( + 757DBE97281E181D00AE30F2 /* Package.swift */, A20C942622C6BDB000B0D206 /* CLibWally */, FE39CDF5229D534100DD135E /* DemoPlayground.playground */, FE9CD3B3229C397900345DFA /* LibWally */, diff --git a/Package.swift b/Package.swift new file mode 100644 index 00000000..6c6abdef --- /dev/null +++ b/Package.swift @@ -0,0 +1,26 @@ +// swift-tools-version:5.3 +import PackageDescription + +let tag = "0.0.7" +let checksum = "62aca7cefdf59cfe96d152e12cfd56387e9960e99523527ff478508f70ac25da" +let url = "https://github.com/jurvis/libwally-swift/releases/download/\(tag)/LibWally.xcframework.zip" + +let package = Package( + name: "LibWally", + platforms: [ + .iOS(.v11) + ], + products: [ + .library( + name: "LibWally", + targets: ["LibWally"] + ) + ], + targets: [ + .binaryTarget( + name: "LibWally", + url: url, + checksum: checksum + ) + ] +) diff --git a/build-libwally-swift.sh b/build-libwally-swift.sh index df1c254b..ee024618 100755 --- a/build-libwally-swift.sh +++ b/build-libwally-swift.sh @@ -12,6 +12,13 @@ xcodebuild archive -scheme LibWally \ -archivePath ${BIN_OUTPUT_DIRECTORY}/LibWally-Sim \ SKIP_INSTALL=NO BUILD_LIBRARY_FOR_DISTRIBUTION=YES +# We want to clean the libwally-core static build files for simulator so we can +# build the ones for device. +pushd CLibWally/libwally-core + make clean + rm -rf $(pwd)/build +popd + xcodebuild archive -scheme LibWally \ -destination "generic/platform=iOS" \ -archivePath ${BIN_OUTPUT_DIRECTORY}/LibWally-iOS \