Skip to content

Commit f5188f5

Browse files
mbroadstkmahar
authored andcommitted
SWIFT-952 Remove dependency on conditional defines in package file
XCode seems to have difficulty transferring SwiftPM conditional defines to generated XCode projects. This patch removes the need to depend on these definitions by hardcoding the changes directly in the source
1 parent 0326ab1 commit f5188f5

13 files changed

+20
-63
lines changed

Package.swift

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,6 @@ let package = Package(
2424
.target(
2525
name: "CLibMongoC",
2626
dependencies: [],
27-
cSettings: [
28-
.define("MONGO_SWIFT_OS_LINUX", .when(platforms: [.linux])),
29-
.define("MONGO_SWIFT_OS_DARWIN", .when(platforms: [.macOS])),
30-
.define("BSON_COMPILATION"),
31-
.define("MONGOC_COMPILATION")
32-
],
3327
linkerSettings: [
3428
.linkedLibrary("resolv"),
3529
.linkedLibrary("ssl", .when(platforms: [.linux])),

Sources/CLibMongoC/include/CLibMongoC_bson-config.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@
1414
* limitations under the License.
1515
*/
1616

17-
#if !defined(BSON_INSIDE) && !defined(BSON_COMPILATION)
18-
#error "Only <bson/bson.h> can be included directly."
19-
#endif
20-
2117
#ifndef BSON_CONFIG_H
2218
#define BSON_CONFIG_H
2319

Sources/CLibMongoC/include/CLibMongoC_bson-prelude.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@
1515
*/
1616

1717
#if !defined(BSON_INSIDE) && !defined(BSON_COMPILATION)
18-
#error "Only <bson/bson.h> can be included directly."
18+
// #error "Only <bson/bson.h> can be included directly."
1919
#endif

Sources/CLibMongoC/include/CLibMongoC_bson-version.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,6 @@
1414
* limitations under the License.
1515
*/
1616

17-
18-
#if !defined (BSON_INSIDE) && !defined (BSON_COMPILATION)
19-
#error "Only <bson/bson.h> can be included directly."
20-
#endif
21-
22-
2317
#ifndef BSON_VERSION_H
2418
#define BSON_VERSION_H
2519

Sources/CLibMongoC/include/CLibMongoC_common-prelude.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@
1616

1717
#if !defined(MONGOC_INSIDE) && !defined(MONGOC_COMPILATION) && \
1818
!defined(BSON_COMPILATION) && !defined(BSON_INSIDE)
19-
#error "Only <mongoc/mongoc.h> or <bson/bson.h> can be included directly."
19+
// #error "Only <mongoc/mongoc.h> or <bson/bson.h> can be included directly."
2020
#endif

Sources/CLibMongoC/include/CLibMongoC_mongoc-config.h

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,6 @@
1414
* limitations under the License.
1515
*/
1616

17-
#if !defined(MONGOC_INSIDE) && !defined(MONGOC_COMPILATION)
18-
#error "Only <mongoc/mongoc.h> can be included directly."
19-
#endif
20-
21-
2217
#ifndef MONGOC_CONFIG_H
2318
#define MONGOC_CONFIG_H
2419

@@ -32,7 +27,7 @@
3227
#define MONGOC_CC "/usr/bin/cc"
3328

3429
/* Defines introduced by `Package.swift` */
35-
#ifdef MONGO_SWIFT_OS_DARWIN
30+
#ifdef __APPLE__
3631
# define MONGOC_ENABLE_SSL_SECURE_TRANSPORT 1
3732
# define MONGOC_ENABLE_CRYPTO_COMMON_CRYPTO 1
3833
# define MONGOC_ENABLE_CRYPTO_LIBCRYPTO 0
@@ -44,11 +39,11 @@
4439
# define MONGOC_ENABLE_SSL_SECURE_TRANSPORT 0
4540
# define MONGOC_ENABLE_CRYPTO_LIBCRYPTO 1
4641
# define MONGOC_ENABLE_SSL_OPENSSL 1
47-
# define MONGOC_HAVE_ASN1_STRING_GET0_DATA 1
48-
#endif
49-
50-
#if MONGOC_ENABLE_SSL_OPENSSL && OPENSSL_VERSION_NUMBER < 0x10100000L
51-
# define MONGOC_HAVE_ASN1_STRING_GET0_DATA 0
42+
# if OPENSSL_VERSION_NUMBER < 0x10100000L
43+
# define MONGOC_HAVE_ASN1_STRING_GET0_DATA 0
44+
# else
45+
# define MONGOC_HAVE_ASN1_STRING_GET0_DATA 1
46+
# endif
5247
#endif
5348

5449
/*

Sources/CLibMongoC/include/CLibMongoC_mongoc-prelude.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@
1515
*/
1616

1717
#if !defined(MONGOC_INSIDE) && !defined(MONGOC_COMPILATION)
18-
#error "Only <mongoc/mongoc.h> can be included directly."
18+
// #error "Only <mongoc/mongoc.h> can be included directly."
1919
#endif

Sources/CLibMongoC/include/CLibMongoC_mongoc-version.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,6 @@
1414
* limitations under the License.
1515
*/
1616

17-
18-
#if !defined (MONGOC_INSIDE) && !defined (MONGOC_COMPILATION)
19-
#error "Only <mongoc/mongoc.h> can be included directly."
20-
#endif
21-
22-
2317
#ifndef MONGOC_VERSION_H
2418
#define MONGOC_VERSION_H
2519

etc/generated_headers/bson-config.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@
1414
* limitations under the License.
1515
*/
1616

17-
#if !defined(BSON_INSIDE) && !defined(BSON_COMPILATION)
18-
#error "Only <bson/bson.h> can be included directly."
19-
#endif
20-
2117
#ifndef BSON_CONFIG_H
2218
#define BSON_CONFIG_H
2319

etc/generated_headers/bson-version.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,6 @@
1414
* limitations under the License.
1515
*/
1616

17-
18-
#if !defined (BSON_INSIDE) && !defined (BSON_COMPILATION)
19-
#error "Only <bson/bson.h> can be included directly."
20-
#endif
21-
22-
2317
#ifndef BSON_VERSION_H
2418
#define BSON_VERSION_H
2519

0 commit comments

Comments
 (0)