Skip to content

Commit

Permalink
build: adjust build rules for Windows (#35)
Browse files Browse the repository at this point in the history
Because we do not use `cl` from MSVC or `clang-cl`, we lose some of the
necessary target macros.  This manually constructs the macro definitions
to allow building the C/C++ code on Windows.  This is required in
addition to #34 to build the gfm branch.
  • Loading branch information
compnerd authored Feb 24, 2022
1 parent 7fc530e commit 6ddaa39
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,22 @@

import PackageDescription

#if os(Windows)
#if arch(i386) || arch(x86_64)
let cSettings: [CSetting] = [
.define("_X86_", .when(platforms: [.windows])),
]
#elseif arch(arm) || arch(arm64)
let cSettings: [CSetting] = [
.define("_ARM_", .when(platforms: [.windows])),
]
#else
#error("unsupported architecture")
#endif
#else
let cSettings: [CSetting] = []
#endif

let package = Package(
name: "cmark-gfm",
products: [
Expand Down Expand Up @@ -30,7 +46,8 @@ let package = Package(
"cmark-gfm_version.h.in",
"case_fold_switch.inc",
"entities.inc",
]
],
cSettings: cSettings
),
.target(name: "cmark-gfm-extensions",
dependencies: [
Expand All @@ -40,7 +57,8 @@ let package = Package(
exclude: [
"CMakeLists.txt",
"ext_scanners.re",
]
],
cSettings: cSettings
),
.target(name: "cmark-gfm-bin",
dependencies: [
Expand Down

0 comments on commit 6ddaa39

Please sign in to comment.