lexrus / MMDB-Swift

A tiny wrapper for libmaxminddb which allows you to lookup Geo data by IP address.
Apache License 2.0
123 stars 58 forks source link

Swift Package manager error #17

Open Xiangao2018 opened 3 years ago

Xiangao2018 commented 3 years ago

Showing All Messages Source files for target MMDB should be located under 'Sources/MMDB', or a custom sources path can be set with the 'path' property in Package.swift

lexrus commented 3 years ago

I'm sorry that I've not managed to fix this issue.

According to the following article, it's complicated for a mixed-language project to support SPM. https://joesusnick.medium.com/swift-package-manager-with-a-mixed-swift-and-objective-c-project-part-2-2-e71dad234e6

I've fixed the Package.swift in this branch. https://github.com/lexrus/MMDB-Swift/tree/fix_spm But the MMDB.swift could not find the necessary headers in the embed SPM dependency even if I specified the headers.

Screen Shot 2020-12-11 at 12 21 23 AM

Thus, I'll remove the SPM installation description in the README sooner or later.

5t111111 commented 3 years ago

I have encountered the same problem a few years ago, and managed to build a package via SPM somehow.

My approach was similar to your branch called spm (not fix_spm), I don't know what spm branch was created for though.

At least my approach seems to work even now. I have created a branch from the latest master, and was able to build a package successfully. https://github.com/5t111111/MMDB-Swift/tree/fix-spm-2

Since unfortunately I am not a full time Swift developer and uses Swift only on kind of server-side CLI, I cannot send a pull request about SPM support. I just hope it helps you.

MKXiaoyue commented 3 years ago

相对路径咋写