Skip to content

Commit 63ea8f1

Browse files
authored
Update project (#23)
* Fix issue #11 - Cannot find TextureTypeToString in scope AiTextureType.swift * Remove custom pkg-config files for mac - libassimp.5.2.4 has working support * Fix tests * Update mint dependencies * Update CI * Update headers * Add Swift Package Index shields * Update macOS runner platform * Update Linux CI to account for missing make * Remove texture to string * Make tests Linux compatible again * Update README * Fix linux CI cache
1 parent 6d0fb10 commit 63ea8f1

24 files changed

+45
-85
lines changed

.github/workflows/ci-linux.yml

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,27 +16,32 @@ jobs:
1616
image: swift:${{ matrix.swift }}
1717
steps:
1818
- name: Checkout
19-
uses: actions/checkout@master
19+
uses: actions/checkout@v3.6.0
20+
2021
- name: Restore APT cache
21-
uses: actions/cache@v3
22+
uses: actions/cache@v3.3.1
2223
with:
2324
path: /var/cache/apt
2425
key: ${{ runner.os }}-apt
26+
2527
- name: Restore cached SPM dependencies
26-
uses: actions/cache@v3
28+
uses: actions/cache@v3.3.1
2729
with:
28-
path: |
29-
.build/repositories
30-
key: ${{ runner.os }}-spm-repos-${{ hashFiles('**/Package.resolved') }}
30+
path: .build
31+
key: swiftpm-${{ runner.os }}-${{ inputs.swift-version }}-${{ hashFiles('Package.swift') }}
3132
restore-keys: |
32-
${{ runner.os }}-spm-repos-
33+
swiftpm-${{ runner.os }}-${{ inputs.swift-version }}-
34+
swiftpm-${{ runner.os }}-
35+
3336
- name: Install dependencies
3437
run: |
3538
# update dependency source list to more modern linux distribution
3639
# echo -e "deb http://archive.ubuntu.com/ubuntu focal main restricted universe multiverse" >> /etc/apt/sources.list
3740
apt update
3841
apt-get install -y -qq pkg-config libassimp-dev
42+
3943
- name: Test
40-
run: make test
44+
run: swift test
45+
4146
- name: Build Release
42-
run: make build-release
47+
run: swift build -c release

.github/workflows/ci-macos.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,25 +8,25 @@ on:
88

99
jobs:
1010
macos-test-build-release-xcode:
11-
runs-on: macOS-latest
11+
runs-on: macos-13
1212
strategy:
1313
matrix:
14-
xcode: ["13.2.1"]
14+
xcode: ["14.3.1", "15.0"]
1515
steps:
1616
- name: Checkout
17-
uses: actions/checkout@master
17+
uses: actions/checkout@v3.6.0
1818
- name: Select Xcode ${{ matrix.xcode }}
1919
run: sudo xcode-select -s /Applications/Xcode_${{ matrix.xcode }}.app
2020
- name: Restore cached Homebrew dependencies
21-
uses: actions/cache@v3
21+
uses: actions/cache@v3.3.1
2222
with:
2323
path: |
2424
~/Library/Caches/Homebrew/assimp--*
2525
~/Library/Caches/Homebrew/downloads/*--assimp-*
2626
key: ${{ runner.os }}-brew-assimp-${{ hashFiles('.github/brew-formulae') }}
2727
restore-keys: ${{ runner.os }}-brew-assimp-
2828
- name: Restore cached SPM dependencies
29-
uses: actions/cache@v3
29+
uses: actions/cache@v3.3.1
3030
with:
3131
path: |
3232
.build/repositories

Mintfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
realm/SwiftLint@0.52.2
2-
nicklockwood/SwiftFormat@0.51.9
1+
realm/SwiftLint@0.52.4
2+
nicklockwood/SwiftFormat@0.52.2

README.md

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# Swift Assimp
22

3+
[![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Fctreffs%2FSwiftAssimp%2Fbadge%3Ftype%3Dswift-versions)](https://swiftpackageindex.com/ctreffs/SwiftAssimp)
4+
[![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Fctreffs%2FSwiftAssimp%2Fbadge%3Ftype%3Dplatforms)](https://swiftpackageindex.com/ctreffs/SwiftAssimp)
35
[![macOS](https://github.com/ctreffs/SwiftAssimp/actions/workflows/ci-macos.yml/badge.svg)](https://github.com/ctreffs/SwiftAssimp/actions/workflows/ci-macos.yml)
46
[![Linux](https://github.com/ctreffs/SwiftAssimp/actions/workflows/ci-linux.yml/badge.svg)](https://github.com/ctreffs/SwiftAssimp/actions/workflows/ci-linux.yml)
57
[![license](https://img.shields.io/badge/license-BSD3-brightgreen.svg)](LICENSE)
6-
[![swift version](https://img.shields.io/badge/swift-5.3+-brightgreen.svg)](https://swift.org/download)
7-
[![platforms](https://img.shields.io/badge/platforms-%20macOS%20-brightgreen.svg)](#)
8-
[![platforms](https://img.shields.io/badge/platforms-linux-brightgreen.svg)](#)
8+
99

1010
This is a **thin** Swift wrapper around the popular and excellent [**Open Asset Import Library**](https://github.com/assimp/assimp) library.
1111
It provides a **swifty** and **typesafe** API.
@@ -40,7 +40,7 @@ import PackageDescription
4040
let package = Package(
4141
name: "YourPackageName",
4242
dependencies: [
43-
.package(name: "Assimp", url: "https://github.com/ctreffs/SwiftAssimp.git", from: "1.3.1")
43+
.package(name: "Assimp", url: "https://github.com/ctreffs/SwiftAssimp.git", from: "2.1.0")
4444
],
4545
targets: [
4646
.target(
@@ -65,23 +65,6 @@ apt-get install libassimp-dev
6565

6666
depending on you platform.
6767

68-
### ⚠️ Caution macOS homebrew users
69-
70-
Swift package manager relies on the [pkg-config](http://pkg-config.freedesktop.org) tool to find system installed libraries.
71-
Assimp version 5 contains a regression, which provides a broken pkg-config file (assimp.pc).
72-
Therefore SPM is not able to find the include headers out of the box resulting in the error:
73-
`shims.h:1:10: error: 'assimp/cimport.h' file not found`.
74-
This is a known bug and is tracked here <https://github.com/assimp/assimp/issues/3174> and here <https://github.com/assimp/assimp/issues/2804>.
75-
However there is a fix that requires one manual step.
76-
77-
Depending on your assimp version run the following command in your Terminal:
78-
79-
- print the currently installed assimp version: `printBrewAssimpVersion`
80-
- for version 5.0.0: `make copyMacPkgConfig500`
81-
- for version 5.0.1: `make copyMacPkgConfig501`
82-
83-
This will copy a corrected pkg-config file to the appropriate library location. You will need to repeat this step when updating assimp via homebrew until a fix is provided by the assimp developers.
84-
Be sure to close Xcode before retrying to build.
8568

8669
## 📝 Code Example
8770

Sources/Assimp/AiCamera.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// AiCamera.swift
33
// SwiftAssimp
44
//
5-
// Copyright © 2019-2022 Christian Treffs. All rights reserved.
5+
// Copyright © 2019-2023 Christian Treffs. All rights reserved.
66
// Licensed under BSD 3-Clause License. See LICENSE file for details.
77

88
@_implementationOnly import CAssimp

Sources/Assimp/AiFace.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// AiFace.swift
33
// SwiftAssimp
44
//
5-
// Copyright © 2019-2022 Christian Treffs. All rights reserved.
5+
// Copyright © 2019-2023 Christian Treffs. All rights reserved.
66
// Licensed under BSD 3-Clause License. See LICENSE file for details.
77

88
@_implementationOnly import CAssimp

Sources/Assimp/AiLight.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// AiLight.swift
33
// SwiftAssimp
44
//
5-
// Copyright © 2019-2022 Christian Treffs. All rights reserved.
5+
// Copyright © 2019-2023 Christian Treffs. All rights reserved.
66
// Licensed under BSD 3-Clause License. See LICENSE file for details.
77

88
@_implementationOnly import CAssimp

Sources/Assimp/AiMatKey.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// AiMatKey.swift
33
// SwiftAssimp
44
//
5-
// Copyright © 2019-2022 Christian Treffs. All rights reserved.
5+
// Copyright © 2019-2023 Christian Treffs. All rights reserved.
66
// Licensed under BSD 3-Clause License. See LICENSE file for details.
77

88
public struct AiMatKey: RawRepresentable {

Sources/Assimp/AiMaterial.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// AiMaterial.swift
33
// SwiftAssimp
44
//
5-
// Copyright © 2019-2022 Christian Treffs. All rights reserved.
5+
// Copyright © 2019-2023 Christian Treffs. All rights reserved.
66
// Licensed under BSD 3-Clause License. See LICENSE file for details.
77

88
@_implementationOnly import CAssimp

Sources/Assimp/AiMaterialProperty.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// AiMaterialProperty.swift
33
// SwiftAssimp
44
//
5-
// Copyright © 2019-2022 Christian Treffs. All rights reserved.
5+
// Copyright © 2019-2023 Christian Treffs. All rights reserved.
66
// Licensed under BSD 3-Clause License. See LICENSE file for details.
77

88
@_implementationOnly import CAssimp
@@ -125,7 +125,7 @@ public struct AiMaterialProperty: AiMaterialPropertyIdentifiable {
125125
return String(bytes: bytes, length: dataLength - 1 - MemoryLayout<Int32>.stride)
126126
}
127127

128-
internal func getString(pMat: UnsafePointer<aiMaterial>) -> String? {
128+
func getString(pMat: UnsafePointer<aiMaterial>) -> String? {
129129
var pOut = aiString()
130130

131131
let result = aiGetMaterialString(pMat,

Sources/Assimp/AiMesh.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// AiMesh.swift
33
// SwiftAssimp
44
//
5-
// Copyright © 2019-2022 Christian Treffs. All rights reserved.
5+
// Copyright © 2019-2023 Christian Treffs. All rights reserved.
66
// Licensed under BSD 3-Clause License. See LICENSE file for details.
77

88
@_implementationOnly import CAssimp

Sources/Assimp/AiNode.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// AiNode.swift
33
// SwiftAssimp
44
//
5-
// Copyright © 2019-2022 Christian Treffs. All rights reserved.
5+
// Copyright © 2019-2023 Christian Treffs. All rights reserved.
66
// Licensed under BSD 3-Clause License. See LICENSE file for details.
77

88
@_implementationOnly import CAssimp

Sources/Assimp/AiPostProcessStep.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// AiPostProcessStep.swift
33
// SwiftAssimp
44
//
5-
// Copyright © 2019-2022 Christian Treffs. All rights reserved.
5+
// Copyright © 2019-2023 Christian Treffs. All rights reserved.
66
// Licensed under BSD 3-Clause License. See LICENSE file for details.
77

88
@_implementationOnly import CAssimp

Sources/Assimp/AiScene.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// AiScene.swift
33
// SwiftAssimp
44
//
5-
// Copyright © 2019-2022 Christian Treffs. All rights reserved.
5+
// Copyright © 2019-2023 Christian Treffs. All rights reserved.
66
// Licensed under BSD 3-Clause License. See LICENSE file for details.
77

88
@_implementationOnly import CAssimp

Sources/Assimp/AiShadingMode.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// AiShadingMode.swift
33
// SwiftAssimp
44
//
5-
// Copyright © 2019-2022 Christian Treffs. All rights reserved.
5+
// Copyright © 2019-2023 Christian Treffs. All rights reserved.
66
// Licensed under BSD 3-Clause License. See LICENSE file for details.
77

88
@_implementationOnly import CAssimp

Sources/Assimp/AiTexture.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// AiTexture.swift
33
// SwiftAssimp
44
//
5-
// Copyright © 2019-2022 Christian Treffs. All rights reserved.
5+
// Copyright © 2019-2023 Christian Treffs. All rights reserved.
66
// Licensed under BSD 3-Clause License. See LICENSE file for details.
77

88
@_implementationOnly import CAssimp

Sources/Assimp/AiTextureType.swift

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// AiTextureType.swift
33
// SwiftAssimp
44
//
5-
// Copyright © 2019-2022 Christian Treffs. All rights reserved.
5+
// Copyright © 2019-2023 Christian Treffs. All rights reserved.
66
// Licensed under BSD 3-Clause License. See LICENSE file for details.
77

88
@_implementationOnly import CAssimp
@@ -110,9 +110,3 @@ public struct AiTextureType: RawRepresentable {
110110
}
111111

112112
extension AiTextureType: Equatable {}
113-
114-
extension AiTextureType: CustomDebugStringConvertible {
115-
public var debugDescription: String {
116-
String(cString: TextureTypeToString(aiTextureType(rawValue: rawValue)))
117-
}
118-
}

Sources/Assimp/Assimp.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Assimp.swift
33
// SwiftAssimp
44
//
5-
// Copyright © 2019-2022 Christian Treffs. All rights reserved.
5+
// Copyright © 2019-2023 Christian Treffs. All rights reserved.
66
// Licensed under BSD 3-Clause License. See LICENSE file for details.
77

88
@_implementationOnly import CAssimp

Sources/Assimp/CArray.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// CArray.swift
33
// SwiftAssimp
44
//
5-
// Copyright © 2019-2022 Christian Treffs. All rights reserved.
5+
// Copyright © 2019-2023 Christian Treffs. All rights reserved.
66
// Licensed under BSD 3-Clause License. See LICENSE file for details.
77

88
enum CArray<T> {

Sources/Assimp/String+aiString.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// String+aiString.swift
33
// SwiftAssimp
44
//
5-
// Copyright © 2019-2022 Christian Treffs. All rights reserved.
5+
// Copyright © 2019-2023 Christian Treffs. All rights reserved.
66
// Licensed under BSD 3-Clause License. See LICENSE file for details.
77

88
@_implementationOnly import CAssimp

Sources/Assimp/simd+aiVector.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// simd+aiVector.swift
33
// SwiftAssimp
44
//
5-
// Copyright © 2019-2022 Christian Treffs. All rights reserved.
5+
// Copyright © 2019-2023 Christian Treffs. All rights reserved.
66
// Licensed under BSD 3-Clause License. See LICENSE file for details.
77

88
@_implementationOnly import CAssimp

Tests/AssimpTests/AssimpTests.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ final class AssimpTests: XCTestCase {
155155

156156
// Materials
157157

158-
XCTAssertEqual(scene.materials[0].numProperties, 16)
158+
XCTAssertGreaterThanOrEqual(scene.materials[0].numProperties, 12)
159159
XCTAssertEqual(scene.materials[0].numAllocated, 20)
160160
XCTAssertEqual(scene.materials[0].properties[0].key, "?mat.name")
161161

@@ -295,7 +295,7 @@ final class AssimpTests: XCTestCase {
295295

296296
// Materials
297297

298-
XCTAssertEqual(scene.materials[0].numProperties, 50)
298+
XCTAssertGreaterThanOrEqual(scene.materials[0].numProperties, 50)
299299
XCTAssertEqual(scene.materials[0].numAllocated, 80)
300300
XCTAssertEqual(scene.materials[0].properties[0].key, "?mat.name")
301301

assimp5.0.0.mac.pc

Lines changed: 0 additions & 11 deletions
This file was deleted.

assimp5.0.1.mac.pc

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)