Commit 3b5fedcb authored by Alex Washburn's avatar Alex Washburn
Browse files

Correcting build to compile C and C++ sources with seperate options and correctly link to both.

parent a6e427ac
......@@ -444,7 +444,7 @@ binfoFieldDescrs =
ccOptions (\val binfo -> binfo{ccOptions=val})
, spaceListField "cxx-options"
showToken parsecToken'
cxxOption (\val binfo -> binfo{cxxOptions=val})
cxxOptions (\val binfo -> binfo{cxxOptions=val})
, spaceListField "ld-options"
showToken parsecToken'
ldOptions (\val binfo -> binfo{ldOptions=val})
......
......@@ -201,7 +201,7 @@ buildComponent verbosity numJobs pkg_descr lbi suffixes
setupMessage' verbosity "Building" (packageId pkg_descr)
(componentLocalName clbi) (maybeComponentInstantiatedWith clbi)
let libbi = libBuildInfo lib
lib' = lib { libBuildInfo = addExtraCSources libbi extras }
lib' = lib { libBuildInfo = addExtraCxxSources (addExtraCSources libbi extras) extras }
buildLib verbosity numJobs pkg_descr lbi lib' clbi
let oneComponentRequested (OneComponentRequestedSpec _) = True
......
......@@ -557,7 +557,7 @@ buildOrReplLib forRepl verbosity numJobs pkg_descr lbi lib clbi = do
createDirectoryIfMissingVerbose verbosity True libTargetDir
-- TODO: do we need to put hs-boot files into place for mutually recursive
-- modules?
let cObjs = map (`replaceExtension` objExtension) (cSources libBi)
let cObjs = map (`replaceExtension` objExtension) (cSources libBi ++ cxxSources libBi)
baseOpts = componentGhcOptions verbosity lbi libBi clbi libTargetDir
vanillaOpts = baseOpts `mappend` mempty {
ghcOptMode = toFlag GhcModeMake,
......@@ -714,9 +714,9 @@ buildOrReplLib forRepl verbosity numJobs pkg_descr lbi lib clbi = do
when has_code . unless forRepl $ do
info verbosity "Linking..."
let cProfObjs = map (`replaceExtension` ("p_" ++ objExtension))
(cSources libBi)
(cSources libBi ++ cxxSources libBi)
cSharedObjs = map (`replaceExtension` ("dyn_" ++ objExtension))
(cSources libBi)
(cSources libBi ++ cxxSources libBi)
compiler_id = compilerId (compiler lbi)
vanillaLibFilePath = libTargetDir </> mkLibName uid
profileLibFilePath = libTargetDir </> mkProfLibName uid
......
......@@ -320,7 +320,7 @@ componentCxxGhcOptions verbosity _implInfo lbi bi cxxlbi odir filename =
MinimalDebugInfo -> ["-g1"]
NormalDebugInfo -> ["-g"]
MaximalDebugInfo -> ["-g3"]) ++
PD.ccOptions bi,
PD.cxxOptions bi,
ghcOptObjDir = toFlag odir
}
......
......@@ -388,13 +388,16 @@ renderGhcOptions comp _platform@(Platform _arch os) opts
, [ "-i" ++ dir | dir <- flags ghcOptSourcePath ]
--------------------
-- C and CPP stuff
--------------------
-- CPP, C, and C++ stuff
, [ "-I" ++ dir | dir <- flags ghcOptCppIncludePath ]
, [ "-optP" ++ opt | opt <- flags ghcOptCppOptions ]
, concat [ [ "-optP-include", "-optP" ++ inc]
| inc <- flags ghcOptCppIncludes ]
, [ "-optc" ++ opt | opt <- flags ghcOptCcOptions ]
, [ "-optc" ++ opt | opt <- flags ghcOptCxxOptions ]
-----------------
-- Linker stuff
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment