Using SPM to wrap a Swift wrapper around a C wrapper around a C++ library is a hassle. SPM version 5.3 currently makes it even more of a hassle. My Package structure is the following:
Package/ CXXTarget include/ -> *.hpp (with subfolders) src/ -> *.cpp CTarget include/ -> *.h src/ -> *.cpp SwiftTarget file.swift resource.txt
My Package manifest contains the following target:
... .target( name: "CXXTarget", dependencies: , cxxSettings: [ .define("SOME_DEFINE"), .unsafeFlags(["-std=c++17", // because .cxx17 LanguageStandard is not yet available "-I", "/usr/local/opt/boost/include" ])], linkerSettings: [ .linkedLibrary("boost_system-mt"), .unsafeFlags(["-L/usr/local/opt/boost/lib"])] ), ...
In version 5.2, this compiled without a hitch (had no resources then), but now in version 5.3, SPM requires all files within targets to be explicitly handled (which is a good thing). It recognizes all .h, .cpp and .swift files but fails for all 200+ .hpp files, as if it didn't recognize them anymore. The manifest resolver asks for them to be explicitly handled.
I've tried declaring them with
publicHeadersPath: but it still considered them unhandled.
My current workaround is to explicitly declare the sources in the C++ target using
... sources: ["include", "src"], ..., however now I have 200+ warnings that
no rule to process file '/path/*.hpp' of type 'file' for architecture 'x86_64' when compiling. Although this compiles successfully, I would like to avoid the warning and declaring headers as "sources" seems semantically wrong.
In short: does SPM v5.3 (as shipped with Xcode 12.0b2) incorrectly recognize .hpp files or have I done something wrong?