|
| 1 | +// swift-tools-version: 5.10 |
| 2 | + |
| 3 | +import PackageDescription |
| 4 | + |
| 5 | +/// Cocoapods to SPM Notes: |
| 6 | +/// My goal is to to minimal changes to support SPM since this is a fork of OSGeo/PROJ. |
| 7 | +/// |
| 8 | +/// * Creating a custom module.modulemap seems to fix build issues when using the proj.h header |
| 9 | +/// * The public interface is C for the proj.h API we use, so we don't need to use the C++ headers exposed |
| 10 | +/// * The C++ header search paths are added so under the hood we can find the headers. |
| 11 | +/// * The 9.4_release_spm does not include proj.db, since with Bundles, we need to load resources in the |
| 12 | +/// package that requires it. So projections-ios loads the proj.db from it's own bundle. (In Cocoapods you could |
| 13 | +/// reach into other bundles, but not with SPM) |
| 14 | +/// * Potentially the 9.6_release_spm can provided proj.db in source, but I haven't figured how that integrates. |
| 15 | +/// * CMake autogenerates some files that need to be added like "proj_config.h" (9.6 has more autogenerated files) |
| 16 | + |
| 17 | +let package = Package( |
| 18 | + name: "proj", |
| 19 | + platforms: [ |
| 20 | + .iOS(.v13), .macOS(.v12) |
| 21 | + ], |
| 22 | + products: [ |
| 23 | + .library( |
| 24 | + name: "proj", |
| 25 | + type: .static, |
| 26 | + targets: ["proj"] |
| 27 | + ), |
| 28 | + ], |
| 29 | + targets: [ |
| 30 | + .target( |
| 31 | + name: "proj", |
| 32 | + path: "src", |
| 33 | + exclude: [ |
| 34 | + "apps", |
| 35 | + "tests", |
| 36 | + "CMakeLists.txt", |
| 37 | + "lib_proj.cmake", |
| 38 | + "check_md5sum.cmake", |
| 39 | + "generate_wkt_parser.cmake", |
| 40 | + "general_doc.dox", |
| 41 | + "wkt1_grammar.y", |
| 42 | + "wkt2_grammar.y", |
| 43 | + ], |
| 44 | + resources: [ |
| 45 | + ], |
| 46 | + publicHeadersPath: ".", // The C header files are mixed with src files, we use a modulemap.module to load "proj.h" |
| 47 | + cxxSettings: [ |
| 48 | + .headerSearchPath("../include"), |
| 49 | + .headerSearchPath("../include/proj"), |
| 50 | + .headerSearchPath("../include/proj/internal"), |
| 51 | + .headerSearchPath("../include/proj/internal/vendor/nlohmann"), |
| 52 | + ], |
| 53 | + linkerSettings: [ |
| 54 | + .linkedLibrary("c++"), |
| 55 | + .linkedLibrary("sqlite3"), |
| 56 | + ] |
| 57 | + ) |
| 58 | + ], |
| 59 | + cxxLanguageStandard: .cxx11 |
| 60 | +) |
0 commit comments