From a2d9f7a44e1cf4ddfd7c18c5b35f44c1e7ed45c0 Mon Sep 17 00:00:00 2001 From: John Viega Date: Sun, 20 Aug 2023 19:47:57 -0400 Subject: [PATCH 1/2] Added a flag to link the default libclang that installs when you have Xcode. I couldn't figure out how to get this into the nimble file, so it's living in a new config.nims. --- config.nims | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 config.nims diff --git a/config.nims b/config.nims new file mode 100644 index 0000000..20370d4 --- /dev/null +++ b/config.nims @@ -0,0 +1,2 @@ +if defined(macosx): + switch("passl", "-L/Library/Developer/CommandLineTools/usr/lib/") From 586c3b46cb0c2909877281bc876cc742918eb55e Mon Sep 17 00:00:00 2001 From: John Viega Date: Sun, 20 Aug 2023 22:44:22 -0400 Subject: [PATCH 2/2] Make sure the compiler has the right location for headers on MacOS. Defaults to major version 14, unless you set MAC_SDK. --- src/futhark.nim | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/futhark.nim b/src/futhark.nim index d6ae729..5100b97 100644 --- a/src/futhark.nim +++ b/src/futhark.nim @@ -649,6 +649,14 @@ macro importc*(imports: varargs[untyped]): untyped = let clangIncludePath = getClangIncludePath() if clangIncludePath != "": cargs.add newLit("-I" & clangIncludePath) + when defined(macosx): + var sdkVersion = getenv("MAC_SDK") + + if sdkVersion == "": + sdkVersion = "14" + cargs.add newLit("-I/Library/Developer/CommandLineTools/SDKs/MacOSX" & + sdkVersion & ".sdk/usr/include") + result.add quote do: importcImpl(`defs`, `outputPath`, `cargs`, `files`, `importDirs`, `renames`, `retypes`, RenameCallback(`renameCallback`), OpirCallbacks(`opirCallbacks`), `forwards`) proc hash*(n: NimNode): Hash = hash(n.treeRepr)