diff options
author | Paul Beusterien <paulbeusterien@google.com> | 2020-08-07 02:38:52 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-07 12:38:52 +0300 |
commit | 3cfa21200eea012d8765239ad4c50d8a36c283f1 (patch) | |
tree | de4d64d5180e35cbbf9a891dc87a2cef7b27fa42 | |
parent | 4502555fd3a11d2618e58c2053413b2ffcd9e59a (diff) | |
download | nanopb-c-3cfa21200eea012d8765239ad4c50d8a36c283f1.tar.gz |
More seamless SwiftPM implementation (#567)
This update allows clients to share common syntax for nanopb imports/includes between CocoaPods and Swift Package Manager.
See example at firebase/firebase-ios-sdk#6165
-rw-r--r-- | Package.swift | 9 | ||||
-rw-r--r-- | SwiftPackage/module.modulemap | 5 | ||||
-rw-r--r-- | SwiftPackage/nanopb.h | 4 | ||||
-rw-r--r-- | spm-test/objc/c-header.c | 4 | ||||
-rw-r--r-- | spm-test/objc/objc-header.m | 4 | ||||
-rw-r--r-- | spm-test/objc/objc-qualified.m | 3 | ||||
l--------- | spm_headers/nanopb/pb.h | 1 | ||||
l--------- | spm_headers/nanopb/pb_common.h | 1 | ||||
l--------- | spm_headers/nanopb/pb_decode.h | 1 | ||||
l--------- | spm_headers/nanopb/pb_encode.h | 1 | ||||
-rw-r--r-- | spm_headers/pb.h | 1 | ||||
-rw-r--r-- | spm_headers/pb_common.h | 1 | ||||
-rw-r--r-- | spm_headers/pb_decode.h | 1 | ||||
-rw-r--r-- | spm_headers/pb_encode.h | 1 |
14 files changed, 25 insertions, 12 deletions
diff --git a/Package.swift b/Package.swift index 828d5ed..2b8c581 100644 --- a/Package.swift +++ b/Package.swift @@ -12,6 +12,13 @@ let package = Package( .watchOS(.v2) ], + products: [ + .library( + name: "nanopb", + targets: ["nanopb"] + ) + ], + targets: [ .target( name: "nanopb", @@ -25,7 +32,7 @@ let package = Package( "pb_encode.h", "pb_encode.c" ], - publicHeadersPath: "SwiftPackage", + publicHeadersPath: "spm_headers", cSettings: [ .define("PB_FIELD_32BIT", to: "1"), .define("PB_NO_PACKED_STRUCTS", to: "1"), diff --git a/SwiftPackage/module.modulemap b/SwiftPackage/module.modulemap deleted file mode 100644 index 0888ab1..0000000 --- a/SwiftPackage/module.modulemap +++ /dev/null @@ -1,5 +0,0 @@ -module nanopb { - umbrella header "nanopb.h" - - export * -}
\ No newline at end of file diff --git a/SwiftPackage/nanopb.h b/SwiftPackage/nanopb.h deleted file mode 100644 index d0666d7..0000000 --- a/SwiftPackage/nanopb.h +++ /dev/null @@ -1,4 +0,0 @@ -#import "../pb.h" -#import "../pb_common.h" -#import "../pb_decode.h" -#import "../pb_encode.h" diff --git a/spm-test/objc/c-header.c b/spm-test/objc/c-header.c index 2995860..17d6795 100644 --- a/spm-test/objc/c-header.c +++ b/spm-test/objc/c-header.c @@ -1 +1,3 @@ -#include "nanopb.h" +#include "pb.h" +#include "pb_common.h" +#include "pb_decode.h" diff --git a/spm-test/objc/objc-header.m b/spm-test/objc/objc-header.m index d8f79cf..860f42b 100644 --- a/spm-test/objc/objc-header.m +++ b/spm-test/objc/objc-header.m @@ -1 +1,3 @@ -#import "nanopb.h" +#import "pb.h" +#import <pb_common.h> +#include "pb_decode.h" diff --git a/spm-test/objc/objc-qualified.m b/spm-test/objc/objc-qualified.m new file mode 100644 index 0000000..ada0ba1 --- /dev/null +++ b/spm-test/objc/objc-qualified.m @@ -0,0 +1,3 @@ +#import "nanopb/pb.h" +#import <nanopb/pb_common.h> +#include "nanopb/pb_decode.h" diff --git a/spm_headers/nanopb/pb.h b/spm_headers/nanopb/pb.h new file mode 120000 index 0000000..e2be14d --- /dev/null +++ b/spm_headers/nanopb/pb.h @@ -0,0 +1 @@ +../../pb.h
\ No newline at end of file diff --git a/spm_headers/nanopb/pb_common.h b/spm_headers/nanopb/pb_common.h new file mode 120000 index 0000000..9449ad8 --- /dev/null +++ b/spm_headers/nanopb/pb_common.h @@ -0,0 +1 @@ +../../pb_common.h
\ No newline at end of file diff --git a/spm_headers/nanopb/pb_decode.h b/spm_headers/nanopb/pb_decode.h new file mode 120000 index 0000000..d8288c7 --- /dev/null +++ b/spm_headers/nanopb/pb_decode.h @@ -0,0 +1 @@ +../../pb_decode.h
\ No newline at end of file diff --git a/spm_headers/nanopb/pb_encode.h b/spm_headers/nanopb/pb_encode.h new file mode 120000 index 0000000..3236a5f --- /dev/null +++ b/spm_headers/nanopb/pb_encode.h @@ -0,0 +1 @@ +../../pb_encode.h
\ No newline at end of file diff --git a/spm_headers/pb.h b/spm_headers/pb.h new file mode 100644 index 0000000..ee67ff0 --- /dev/null +++ b/spm_headers/pb.h @@ -0,0 +1 @@ +#include "nanopb/pb.h" diff --git a/spm_headers/pb_common.h b/spm_headers/pb_common.h new file mode 100644 index 0000000..656424e --- /dev/null +++ b/spm_headers/pb_common.h @@ -0,0 +1 @@ +#include "nanopb/pb_common.h" diff --git a/spm_headers/pb_decode.h b/spm_headers/pb_decode.h new file mode 100644 index 0000000..dee5064 --- /dev/null +++ b/spm_headers/pb_decode.h @@ -0,0 +1 @@ +#include "nanopb/pb_decode.h" diff --git a/spm_headers/pb_encode.h b/spm_headers/pb_encode.h new file mode 100644 index 0000000..3e8b73b --- /dev/null +++ b/spm_headers/pb_encode.h @@ -0,0 +1 @@ +#include "nanopb/pb_encode.h" |