I have a Swift package like:
// swift-tools-version: 5.10
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription
let package = Package(
name: "nmbr-icu",
products: [
.library(name: "nmbr-icu", targets: ["nmbr-icu"])
],
targets: [
// Main NMBR target, contains 1 ObjC++ file (h + mm)
.target(name: "nmbr-icu",
dependencies: ["ICU"]),
// Target to build the ICU framework, an xcframework for the ICU C++ code
.binaryTarget(name: "ICU",
path: "./ICU.xcframework"),
// Test target
.testTarget(name: "nmbrTests", dependencies: ["nmbr-icu"])
],
cxxLanguageStandard: .cxx20
)
The project structure looks like:
When I open this package (in Xcode – by double-clicking the Package.swift
file) I can build (CMD+B) and test (CMD+U). However, running swift build
returns an error saying that one of the header files in my xcframework cannot be found:
NMBRFormatter.mm:11:10: fatal error: 'unicode/unistr.h' file not found
#include <unicode/unistr.h>
What am I missing? The repo is open source here: https://github.com/kerrmarin/nmbr-icu