Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- name: Build the executable for release
run: |
# macos-latest is arm64, but we cross-compile for x86_64 too.
# The CSQLite system-library bridge resolves via pkg-config to
# The OACSQLite system-library bridge resolves via pkg-config to
# Homebrew's arm64-only sqlite3. The macOS system SQLite at
# /usr/lib/libsqlite3.dylib is universal (arm64+x86_64), so we
# shadow Homebrew's pkg-config file with one pointing at the SDK.
Expand All @@ -41,7 +41,7 @@ jobs:
printf 'Cflags: -I${includedir}\n'
} > "$PC_DIR/sqlite3.pc"
export PKG_CONFIG_PATH="$PC_DIR:${PKG_CONFIG_PATH:-}"
swift build -c release --arch arm64 --arch x86_64 --product mvt
swift build -c release --enable-all-traits --arch arm64 --arch x86_64 --product mvt
- name: Compress the archive
run: tar -czf mvt.tar.gz -C .build/apple/Products/Release mvt
- name: Create or update the release and upload the asset
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/swift.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ jobs:
with:
swift-version: '6.3.3'
- name: Build and Test
run: swift test
run: swift test --enable-all-traits
6 changes: 3 additions & 3 deletions Package.resolved

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

51 changes: 41 additions & 10 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,30 @@ let package = Package(
name: "MVTTools",
targets: ["MVTTools"]),
],
traits: [
.trait(
name: "EnableMLT",
description: "Enables the MapLibre tile specification (MLT) decoder/encoder backed by a C++ bridge (FastPFOR + FSST). Requires Swift C++ interoperability."),
.trait(
name: "EnableCSV",
description: "Enables CSV vector tile import/export."),
.trait(
name: "EnableGeoPackage",
description: "Enables GeoPackage vector tile import/export via gis-tools-geopackage."),
.trait(
name: "EnableGPX",
description: "Enables GPX vector tile import/export."),
.trait(
name: "EnableFIT",
description: "Enables FIT vector tile import/export."),
.trait(
name: "EnableShapefile",
description: "Enables Shapefile vector tile import/export."),
],
dependencies: [
.package(url: "https://github.com/Outdooractive/gis-tools", from: "2.3.0"),
.package(url: "https://github.com/Outdooractive/gis-tools-csv", from: "1.2.0"),
.package(url: "https://github.com/Outdooractive/gis-tools-geopackage", from: "1.0.2"),
.package(url: "https://github.com/Outdooractive/gis-tools-geopackage", from: "1.0.3"),
.package(url: "https://github.com/Outdooractive/gis-tools-gpx", from: "1.0.4"),
.package(url: "https://github.com/Outdooractive/gis-tools-fit", from: "1.0.0"),
.package(url: "https://github.com/Outdooractive/gis-tools-shapefile", from: "1.0.2"),
Expand All @@ -43,27 +63,38 @@ let package = Package(
name: "MVTTools",
dependencies: [
.product(name: "GISTools", package: "gis-tools"),
.product(name: "GISToolsCSV", package: "gis-tools-csv"),
.product(name: "GISToolsGeoPackage", package: "gis-tools-geopackage"),
.product(name: "GISToolsGPX", package: "gis-tools-gpx"),
.product(name: "GISToolsFIT", package: "gis-tools-fit"),
.product(name: "GISToolsShapefile", package: "gis-tools-shapefile"),
.product(name: "GISToolsCSV", package: "gis-tools-csv",
condition: .when(traits: ["EnableCSV"])),
.product(name: "GISToolsGeoPackage", package: "gis-tools-geopackage",
condition: .when(traits: ["EnableGeoPackage"])),
.product(name: "GISToolsGPX", package: "gis-tools-gpx",
condition: .when(traits: ["EnableGPX"])),
.product(name: "GISToolsFIT", package: "gis-tools-fit",
condition: .when(traits: ["EnableFIT"])),
.product(name: "GISToolsShapefile", package: "gis-tools-shapefile",
condition: .when(traits: ["EnableShapefile"])),
.product(name: "Gzip", package: "GzipSwift"),
.product(name: "Logging", package: "swift-log"),
.product(name: "SwiftProtobuf", package: "swift-protobuf"),
.target(name: "CMLT"),
.target(name: "CMLT", condition: .when(traits: ["EnableMLT"])),
],
swiftSettings: [.interoperabilityMode(.Cxx)]),
swiftSettings: [
.interoperabilityMode(.Cxx, .when(traits: ["EnableMLT"])),
]),

.testTarget(
name: "MVTToolsTests",
dependencies: ["MVTTools"],
exclude: ["TestData"],
swiftSettings: [.interoperabilityMode(.Cxx)]),
swiftSettings: [
.interoperabilityMode(.Cxx, .when(traits: ["EnableMLT"])),
]),
.testTarget(
name: "MVTCLITests",
dependencies: ["MVTCLI"],
swiftSettings: [.interoperabilityMode(.Cxx)]),
swiftSettings: [
.interoperabilityMode(.Cxx, .when(traits: ["EnableMLT"])),
]),

// MARK: - MLT C++ bridge (decoder + encoder + FastPFOR + FSST)

Expand Down
2 changes: 2 additions & 0 deletions Sources/MVTTools/Coders/CSV/VectorTile+CSV.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#if EnableCSV
import Foundation
import GISTools
import GISToolsCSV
Expand Down Expand Up @@ -187,3 +188,4 @@ extension VectorTile {
}

}
#endif
2 changes: 2 additions & 0 deletions Sources/MVTTools/Coders/FIT/VectorTile+FIT.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#if EnableFIT
import Foundation
import GISTools
import GISToolsFIT
Expand Down Expand Up @@ -178,3 +179,4 @@ extension VectorTile {
}

}
#endif
2 changes: 2 additions & 0 deletions Sources/MVTTools/Coders/GPX/VectorTile+GPX.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#if EnableGPX
import Foundation
import GISTools
import GISToolsGPX
Expand Down Expand Up @@ -163,3 +164,4 @@ extension VectorTile {
}

}
#endif
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#if EnableGeoPackage
import Foundation
import GISTools
import GISToolsGeoPackage
Expand Down Expand Up @@ -154,3 +155,4 @@ extension VectorTile {
}

}
#endif
2 changes: 2 additions & 0 deletions Sources/MVTTools/Coders/MLT/MLTDecoder.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#if EnableMLT
import CMLT
import Foundation
import GISTools
Expand Down Expand Up @@ -350,3 +351,4 @@ enum MLTDecoder {
}

}
#endif
2 changes: 2 additions & 0 deletions Sources/MVTTools/Coders/MLT/MLTEncoder.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#if EnableMLT
#if canImport(CoreLocation)
import CoreLocation
#endif
Expand Down Expand Up @@ -340,3 +341,4 @@ enum MLTEncoder {
}

}
#endif
2 changes: 2 additions & 0 deletions Sources/MVTTools/Coders/MLT/VectorTile+MLT.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#if EnableMLT
import Foundation
import GISTools
import Logging
Expand Down Expand Up @@ -223,3 +224,4 @@ extension VectorTile {
}

}
#endif
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#if EnableShapefile
import Foundation
import GISTools
import GISToolsShapefile
Expand Down Expand Up @@ -146,3 +147,4 @@ public enum ShapefileError: Error, Equatable {
case mixedGeometry(types: Set<GeoJsonType>)

}
#endif
3 changes: 3 additions & 0 deletions Tests/MVTToolsTests/CSV/CSVCoderTests.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#if EnableCSV
import Foundation
import GISTools
import GISToolsCSV
Expand Down Expand Up @@ -109,3 +110,5 @@ struct VectorTileCSVTests {
}

}

#endif
3 changes: 3 additions & 0 deletions Tests/MVTToolsTests/FIT/FITCoderTests.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#if EnableFIT
import Foundation
import GISTools
import GISToolsFIT
Expand Down Expand Up @@ -125,3 +126,5 @@ struct VectorTileFITTests {
}

}

#endif
3 changes: 3 additions & 0 deletions Tests/MVTToolsTests/GPX/GPXCoderTests.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#if EnableGPX
import Foundation
import GISTools
@testable import MVTTools
Expand Down Expand Up @@ -67,3 +68,5 @@ struct VectorTileGPXTests {
}

}

#endif
3 changes: 3 additions & 0 deletions Tests/MVTToolsTests/GeoPackage/GeoPackageCoderTests.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#if EnableGeoPackage
import Foundation
import GISTools
import GISToolsGeoPackage
Expand Down Expand Up @@ -108,3 +109,5 @@ struct VectorTileGeoPackageTests {
}

}

#endif
3 changes: 3 additions & 0 deletions Tests/MVTToolsTests/MLT/MLTDecoderTests.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#if EnableMLT
import Foundation
import GISTools
@testable import MVTTools
Expand Down Expand Up @@ -164,3 +165,5 @@ struct MLTDecoderTests {
}

}

#endif
4 changes: 3 additions & 1 deletion Tests/MVTToolsTests/MLT/MLTEncoderRingClosureTests.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#if EnableMLT
import Foundation
import GISTools
@testable import MVTTools
Expand Down Expand Up @@ -297,4 +298,5 @@ struct MLTEncoderRingClosureTests {
#expect(result.rings[0].coordinates.first == result.rings[0].coordinates.last)
}

}
}
#endif
3 changes: 3 additions & 0 deletions Tests/MVTToolsTests/MLT/MLTRoundtripConvenienceTests.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#if EnableMLT
import Foundation
import GISTools
@testable import MVTTools
Expand Down Expand Up @@ -173,3 +174,5 @@ struct MLTRoundtripConvenienceTests {
}

}

#endif
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#if EnableMLT
import Foundation
import GISTools
@testable import MVTTools
Expand Down Expand Up @@ -118,3 +119,5 @@ struct MLTRoundtripCoordinateAccuracyTests {
}

}

#endif
3 changes: 3 additions & 0 deletions Tests/MVTToolsTests/MLT/MLTRoundtripFeatureIDTests.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#if EnableMLT
import Foundation
import GISTools
@testable import MVTTools
Expand Down Expand Up @@ -103,3 +104,5 @@ struct MLTRoundtripFeatureIDTests {
}

}

#endif
3 changes: 3 additions & 0 deletions Tests/MVTToolsTests/MLT/MLTRoundtripGeometryTests.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#if EnableMLT
import Foundation
import GISTools
@testable import MVTTools
Expand Down Expand Up @@ -266,3 +267,5 @@ struct MLTRoundtripGeometryTests {
}

}

#endif
3 changes: 3 additions & 0 deletions Tests/MVTToolsTests/MLT/MLTRoundtripLayerTests.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#if EnableMLT
import Foundation
import GISTools
@testable import MVTTools
Expand Down Expand Up @@ -38,3 +39,5 @@ struct MLTRoundtripLayerTests {
}

}

#endif
3 changes: 3 additions & 0 deletions Tests/MVTToolsTests/MLT/MLTRoundtripPropertiesTests.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#if EnableMLT
import Foundation
import GISTools
@testable import MVTTools
Expand Down Expand Up @@ -279,3 +280,5 @@ struct MLTRoundtripPropertiesTests {
}

}

#endif
4 changes: 3 additions & 1 deletion Tests/MVTToolsTests/MLT/MLTTestHelper.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#if EnableMLT
import Foundation
import Gzip

Expand Down Expand Up @@ -116,4 +117,5 @@ enum MLTTestHelper {
return []
}

}
}
#endif
3 changes: 3 additions & 0 deletions Tests/MVTToolsTests/Shapefile/ShapefileCoderTests.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#if EnableShapefile
import Foundation
import GISTools
import GISToolsShapefile
Expand Down Expand Up @@ -94,3 +95,5 @@ struct VectorTileShapefileTests {
}

}

#endif
19 changes: 1 addition & 18 deletions install_mvt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

echo "Building the 'mvt' command line tool..."

swift build --quiet -c release --arch arm64 --arch x86_64 --product mvt 2>&1 >/dev/null
swift build --quiet -c release --enable-all-traits --arch arm64 --arch x86_64 --product mvt 2>&1 >/dev/null
if [[ $? -ne 0 ]]
then
echo "Failed to build 'mvt'"
Expand All @@ -23,20 +23,3 @@ then
fi

echo "'mvt' installed in /usr/local/bin"

swift package --quiet plugin generate-manual 2>&1 >/dev/null
if [[ $? -ne 0 ]]
then
echo "Failed to build the 'mvt' man-page"
exit 1
fi

cp .build/plugins/GenerateManual/outputs/mvt/mvt.1 /usr/local/share/man/man1/
if [[ $? -ne 0 ]]
then
echo "Failed to copy the 'mvt.1' man-page to /usr/local/share/man/man1/"
exit 1
fi

echo "'mvt' man-page installed in /usr/local/share/man/man1"
exit 0
Loading