Skip to content

Commit 476f7b4

Browse files
compnerdQuietMisdreavus
authored andcommitted
build: adjust the configuration for Windows
Ensure that we indicate to the C code that we are building a static library as the default library type on Windows is dynamic. This corrects the inconsistent dll storage and penalties for symbolic resolution.
1 parent c4a8037 commit 476f7b4

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

Package.swift

+11-2
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,25 @@ import PackageDescription
55

66
#if os(Windows)
77
#if arch(i386) || arch(x86_64)
8-
let cSettings: [CSetting] = [
8+
var cSettings: [CSetting] = [
99
.define("_X86_", .when(platforms: [.windows])),
1010
]
1111
#elseif arch(arm) || arch(arm64)
12-
let cSettings: [CSetting] = [
12+
var cSettings: [CSetting] = [
1313
.define("_ARM_", .when(platforms: [.windows])),
1414
]
1515
#else
1616
#error("unsupported architecture")
1717
#endif
18+
// When building the library on Windows, we do not have proper control of
19+
// whether it is being built statically or dynamically. However, given the
20+
// current default of static, we will assume that we are building
21+
// statically. More importantly, should this not hold, this will fail at
22+
// link time.
23+
cSettings += [
24+
.define("CMARK_GFM_STATIC_DEFINE", .when(platforms: [.windows])),
25+
.define("CMARK_GFM_EXTENSIONS_STATIC_DEFINE", .when(platforms: [.windows])),
26+
]
1827
#else
1928
let cSettings: [CSetting] = []
2029
#endif

0 commit comments

Comments
 (0)