Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Building F# .fsproj on Mac (Mono)

I have an .fsproj (and .sln) from an F# project that was developed on Windows that I want to build on the Mac.

I've built several single-source-file F# programs with Mono, and it's great. Unfortunately, this .fsproj is non-trivial, as there are several source files and a number of references.

Devising the command line to build the project by hand doesn't seem fun.

Is there a tool that will analyze the .sln/.fsproj and give the correct command line? Or perhaps just do the build from the .sln/.fsproj?

I'd like to do this without MonoDevelop or SharpDevelop if possible, though answers along those lines are welcome.

like image 231
Harold Avatar asked Nov 21 '11 20:11

Harold


1 Answers

Here is a simple makefile that I use

FSC=/home/john/FSharp-2.0.0.0/bin/fsc.exe
FSFILES= tokenizer.fs BuildTree.fs symtable.fs mkVMCommands.fs codegen.fs
compiler: compiler.exe

compiler.exe: $(FSFILES)
    $(FSC) --define:LINUX --debug:full --debug+ $(FSFILES) -o:compiler.exe --sig:sigfile.fs

run: compiler
    mono compiler.exe

note that the lines after each target - compiler.exe:... need to be indented with a TAB rather than spaces. If you need reerences, you just add -r "Somefile.dll" to the commandline.

like image 162
John Palmer Avatar answered Nov 02 '22 18:11

John Palmer