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.
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.
You may want to look at xbuild, which directly read sln
and fsproj
files and build them on Mono platform.
As @JPW mentioned in the comment, it also works on Mac OS X. Although xbuild's F# support seems to be immature, someone has managed to build F# projects with xbuild on Linux. Hopefully, it is helpful for you to set up the build environment on Mac.
链接地址: http://www.djcxy.com/p/63704.html