Skip to content

Commit

Permalink
fix target
Browse files Browse the repository at this point in the history
  • Loading branch information
janmasrovira committed Apr 15, 2024
1 parent 0b1b4e5 commit afb002e
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 4 deletions.
8 changes: 7 additions & 1 deletion app/Commands/Dev/Tree/Compile/Native.hs
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,11 @@ runCommand ::
NativeOptions ('InputExtension 'FileExtJuvixTree) ->
Sem r ()
runCommand opts =
TreeToC.treeToC (opts ^. nativeCompileCommonOptions)
TreeToC.treeToC treeToCArgs
>>= Helper.fromC (nativeHelperOptions opts)
where
treeToCArgs =
TreeToC.TreeToCArgs
{ _treeToCTarget = TargetCNative64,
_treeToCCommonOptions = (opts ^. nativeCompileCommonOptions)
}
16 changes: 14 additions & 2 deletions app/Commands/Dev/Tree/Compile/TreeToC.hs
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,27 @@ import Commands.Compile.CommonOptions
import Juvix.Compiler.Backend.C
import Juvix.Compiler.Tree.Translation.FromSource qualified as Tree

data TreeToCArgs = TreeToCArgs
{ _treeToCTarget :: Target,
_treeToCCommonOptions :: CompileCommonOptions ('InputExtension 'FileExtJuvixTree)
}

makeLenses ''TreeToCArgs

instance EntryPointOptions TreeToCArgs where
applyOptions opts =
set entryPointTarget (Just (opts ^. treeToCTarget))
. applyOptions (opts ^. treeToCCommonOptions)

treeToC ::
forall r.
(Members '[EmbedIO, App, TaggedLock] r) =>
CompileCommonOptions ('InputExtension 'FileExtJuvixTree) ->
TreeToCArgs ->
Sem r MiniCResult
treeToC opts = do
afile <-
getMainAppFileFromInputFileType @('InputExtension 'FileExtJuvixTree)
(opts ^. compileInputFile)
(opts ^. treeToCCommonOptions . compileInputFile)
file <- fromAppPathFile afile
s <- readFile file
tab <- getRight (mapLeft JuvixError (Tree.runParser file s))
Expand Down
9 changes: 8 additions & 1 deletion app/Commands/Dev/Tree/Compile/Wasi.hs
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,11 @@ runCommand ::
WasiOptions ('InputExtension 'FileExtJuvixTree) ->
Sem r ()
runCommand opts =
TreeToC.treeToC (opts ^. wasiCompileCommonOptions) >>= Helper.fromC (wasiHelperOptions opts)
TreeToC.treeToC treeToCArgs
>>= Helper.fromC (wasiHelperOptions opts)
where
treeToCArgs =
TreeToC.TreeToCArgs
{ _treeToCTarget = TargetCNative64,
_treeToCCommonOptions = (opts ^. wasiCompileCommonOptions)
}

0 comments on commit afb002e

Please sign in to comment.