Corrected the C++ compilation commands, and gave the header a different extension
This commit is contained in:
parent
cc4720832b
commit
ae61b22355
24
Main.hs
24
Main.hs
|
@ -270,14 +270,15 @@ compileFull inputFile moutputFile
|
||||||
("-", Nothing) -> dieReport (Nothing, "Must specify an output file when using full-compile mode")
|
("-", Nothing) -> dieReport (Nothing, "Must specify an output file when using full-compile mode")
|
||||||
(file, _) -> return file
|
(file, _) -> return file
|
||||||
|
|
||||||
let extension = case csBackend optsPS of
|
let (cExtension, hExtension)
|
||||||
BackendC -> ".tock.c"
|
= case csBackend optsPS of
|
||||||
BackendCPPCSP -> ".tock.cpp"
|
BackendC -> (".tock.c", ".tock.h")
|
||||||
_ -> ""
|
BackendCPPCSP -> (".tock.cpp", ".tock.hpp")
|
||||||
|
_ -> ("", "")
|
||||||
|
|
||||||
-- Translate input file to C/C++
|
-- Translate input file to C/C++
|
||||||
let cFile = outputFile ++ extension
|
let cFile = outputFile ++ cExtension
|
||||||
hFile = outputFile ++ ".tock.h"
|
hFile = outputFile ++ hExtension
|
||||||
iFile = outputFile ++ ".tock.inc"
|
iFile = outputFile ++ ".tock.inc"
|
||||||
lift $ modify $ \cs -> cs { csOutputIncFile = Just iFile }
|
lift $ modify $ \cs -> cs { csOutputIncFile = Just iFile }
|
||||||
lift $ withOutputFile cFile $ \hb ->
|
lift $ withOutputFile cFile $ \hb ->
|
||||||
|
@ -324,9 +325,14 @@ compileFull inputFile moutputFile
|
||||||
|
|
||||||
-- For C++, just compile the source file directly into a binary
|
-- For C++, just compile the source file directly into a binary
|
||||||
BackendCPPCSP ->
|
BackendCPPCSP ->
|
||||||
exec $ cxxCommand cFile outputFile
|
do cs <- lift getCompState
|
||||||
(csCompilerFlags optsPS ++ " " ++ csCompilerLinkFlags optsPS)
|
if csHasMain optsPS
|
||||||
|
then let otherOFiles = [usedFile ++ ".tock.o"
|
||||||
|
| usedFile <- Set.toList $ csUsedFiles cs]
|
||||||
|
in exec $ cxxCommand cFile outputFile
|
||||||
|
(concat (intersperse " " otherOFiles) ++ " " ++ csCompilerFlags optsPS ++ " " ++ csCompilerLinkFlags optsPS)
|
||||||
|
else exec $ cxxCommand cFile (outputFile ++ ".tock.o")
|
||||||
|
("-c " ++ csCompilerFlags optsPS)
|
||||||
_ -> dieReport (Nothing, "Cannot use specified backend: "
|
_ -> dieReport (Nothing, "Cannot use specified backend: "
|
||||||
++ show (csBackend optsPS)
|
++ show (csBackend optsPS)
|
||||||
++ " with full-compile mode")
|
++ " with full-compile mode")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user