Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions cuda/Setup.hs
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,19 @@ libraryBuildInfo cwd verbosity profile installPath platform@(Platform arch os) g
_ -> ""
emptyCase = ["-DUSE_EMPTY_CASE" | versionBranch ghcVersion >= [7,8]]
blocksExtension = [ "-U__BLOCKS__" | os == OSX ]
-- Pass include dirs, CUDA path macros, and cbits/ to c2hs so that:
-- * stubs.h resolves (needs cbits/ and package root in -I)
-- * Path.chs resolves CUDA_INSTALL_PATH / CUDA_LIBRARY_PATH string consts
-- * CUDA system headers are found without relying on c2hs default search
c2hsIncludePaths = map (("--cppopts=-I" ++) . interpretSymbolicPath cwd) includePaths
++ [ "--cppopts=-I." -- package root for cbits/stubs.h
, "--cppopts=-Icbits" -- cbits/ for compat headers
]
cudaInstallMacro = "--cppopts=-DCUDA_INSTALL_PATH=\"" ++ escDefPath installPath ++ "\""
cudaLibraryMacro = "--cppopts=-DCUDA_LIBRARY_PATH=\"" ++ escDefPath canonicalLibraryPath ++ "\""
c2hsOptions = unwords $ map ("--cppopts="++) ("-E" : archFlag : emptyCase ++ blocksExtension)
++ c2hsIncludePaths
++ [cudaInstallMacro, cudaLibraryMacro]
c2hsExtraOptions = ("x-extra-c2hs-options", c2hsOptions)

addSystemSpecificOptions :: BuildInfo -> IO BuildInfo
Expand Down