Merge branch 'manu/swift_package_manager' into 'master'

Xcode: Add support of Swift Package Manager

See merge request matrix-org/olm!19
This commit is contained in:
Hubert Chathi 2021-04-06 18:22:51 +00:00
commit dbbf467075
6 changed files with 81 additions and 4 deletions

1
.gitignore vendored
View file

@ -12,6 +12,7 @@
# Xcode
build/
.build/
DerivedData/
*.pbxuser
!default.pbxuser

52
Package.swift Normal file
View file

@ -0,0 +1,52 @@
// swift-tools-version:5.3
import PackageDescription
let major = 3, minor = 2, patch = 2
let package = Package(
name: "Olm",
platforms: [.iOS(.v8), .macOS(.v10_10)],
products: [
.library(name: "libolm", targets: ["libolm"]),
.library(name: "OLMKit", targets: ["OLMKit"])
],
targets: [
.target(
name: "libolm",
path: ".",
sources: [
"src",
"lib/crypto-algorithms/aes.c",
"lib/crypto-algorithms/sha256.c",
"lib/curve25519-donna/curve25519-donna.c"
],
cSettings: [
.headerSearchPath("lib"),
.define("OLMLIB_VERSION_MAJOR", to: "\(major)"),
.define("OLMLIB_VERSION_MINOR", to: "\(minor)"),
.define("OLMLIB_VERSION_PATCH", to: "\(patch)")
]
),
.target(
name: "OLMKit",
dependencies: ["libolm"],
path: "xcode/OLMKit",
exclude: ["Info.plist"],
cSettings: [
.headerSearchPath("..")
]
),
.testTarget(
name: "OLMKitTests",
dependencies: ["OLMKit"],
path: "xcode/OLMKitTests",
exclude: ["Info.plist"],
cSettings: [
.headerSearchPath("..")
]
)
],
cLanguageStandard: .c99,
cxxLanguageStandard: .cxx11
)

View file

@ -119,7 +119,7 @@ endorsed by the Matrix.org Foundation C.I.C.
## Release process
First: bump version numbers in ``common.mk``, ``CMakeLists.txt``,
``javascript/package.json``, ``python/olm/__version__.py``, ``OLMKit.podspec``,
``javascript/package.json``, ``python/olm/__version__.py``, ``OLMKit.podspec``, ``Package.swift``,
and ``android/olm-sdk/build.gradle`` (``versionCode``, ``versionName`` and
``version``).

4
include/module.modulemap Normal file
View file

@ -0,0 +1,4 @@
module libolm {
header "olm/olm.h"
export *
}

View file

@ -0,0 +1,13 @@
module OLMKit {
header "../OLMAccount.h"
header "../OLMSession.h"
header "../OLMMessage.h"
header "../OLMUtility.h"
header "../OLMInboundGroupSession.h"
header "../OLMOutboundGroupSession.h"
header "../OLMPkEncryption.h"
header "../OLMPkDecryption.h"
header "../OLMPkSigning.h"
header "../OLMSAS.h"
export *
}

View file

@ -12,15 +12,22 @@ the latest OLMKit release is::
pod 'OLMKit'
Or you can use Swift Package Manager with the URL::
https://gitlab.matrix.org/matrix-org/olm
Development
-----------
Run `pod install` and open `OLMKit.xcworkspace`.
Run `pod install` and open `OLMKit.xcworkspace` with Xcode.
The project contains only tests files. The libolm and the Objective-C wrapper source files are loaded via the OLMKit CocoaPods pod.
To add a new source file, add it to the file system and run `pod update` to make CocoaPods insert it into OLMKit.xcworkspace.
Development alternative
-----------------------
Based on the Swift package, you can build source files and run tests directly from the command line: `swift test`.
Release
-------
See ../README.rst for the release of the CocoaPod.
See ../README.rst for the release of the CocoaPod and the Swift package.