Merge pull request #160 from smumryak/master

Added simple swiftpm package file
This commit is contained in:
Recep Aslantas
2020-09-08 11:55:18 +03:00
committed by GitHub
4 changed files with 91 additions and 0 deletions

44
Package.swift Normal file
View File

@@ -0,0 +1,44 @@
// swift-tools-version:5.2
import PackageDescription
let package = Package(
name: "cglm",
products: [
.library(name: "cglm", type: .static, targets: ["cglmHeader"]),
.library(name: "cglmc", targets: ["cglmCompiled"]),
],
dependencies: [],
targets: [
.target(
name: "cglmCompiled",
path: "./",
exclude: [
"./docs",
"./src/swift",
"./include",
"./test",
"./win",
],
sources: [
"./src",
],
publicHeadersPath: "./include"
),
.target(
name: "cglmHeader",
path: "./",
exclude: [
"./docs",
"./include",
"./test",
"./win",
],
sources: [
"./src/swift",
],
publicHeadersPath: "./include"
),
],
cLanguageStandard: .c11
)

View File

@@ -212,6 +212,38 @@ cglm_dep = dependency('cglm', fallback : 'cglm', 'cglm_dep')
executable('exe', 'src/main.c', dependencies : cglm_dep)
```
### Swift (Swift Package Manager)
Currently only default build options are supported. Add **cglm** dependency to your project:
```swift
...
Package(
...
dependencies: [
...
.package(url: "https://github.com/recp/cglm", .branch("master")),
]
...
)
```
Now add **cgml** as a dependency to your target. Product choices are:
- **cglm** for inlined version of the library which can be linked only statically
- **cglmc** for a compiled version of the library with no linking limitation
```swift
...
.target(
...
dependencies: [
...
.product(name: "cglm", package: "cglm"),
]
...
)
...
```
### Unix (Autotools)

14
include/module.modulemap Normal file
View File

@@ -0,0 +1,14 @@
module cglm {
header "cglm/cglm.h"
header "cglm/struct.h"
export *
}
module cglmc {
header "cglm/cglm.h"
header "cglm/struct.h"
header "cglm/call.h"
export *
}

1
src/swift/empty.c Normal file
View File

@@ -0,0 +1 @@
// This empty file is needed to trick swiftpm to build the header-only version of cglm as swiftpm itself does not support C targets that have no source code files