简体   繁体   English

在Mac上构建F#.fsproj(Mono)

[英]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. 我有一个来自在Windows上开发的F#项目的.fsproj(和.sln),我想在Mac上构建。

I've built several single-source-file F# programs with Mono, and it's great. 我用Mono构建了几个单源文件F#程序,这很棒。 Unfortunately, this .fsproj is non-trivial, as there are several source files and a number of references. 不幸的是,这个.fsproj并不重要,因为有几个源文件和许多引用。

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? 是否有工具可以分析.sln / .fsproj并提供正确的命令行? Or perhaps just do the build from the .sln/.fsproj? 或者也许只是从.sln / .fsproj构建?

I'd like to do this without MonoDevelop or SharpDevelop if possible, though answers along those lines are welcome. 如果可能的话,我想在没有MonoDevelop或SharpDevelop的情况下这样做,尽管这些方面的答案是受欢迎的。

Here is a simple makefile that I use 这是我使用的简单makefile

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. 请注意每个目标后面的行 - compiler.exe:...需要使用TAB而不是空格缩进。 If you need reerences, you just add -r "Somefile.dll" to the commandline. 如果需要reerences,只需在命令行中添加-r "Somefile.dll"即可。

You may want to look at xbuild , which directly read sln and fsproj files and build them on Mono platform. 您可能需要查看xbuild ,它直接读取slnfsproj文件并在Mono平台上构建它们。

As @JPW mentioned in the comment, it also works on Mac OS X . 正如@JPW在评论中提到的,它也适用于Mac OS X. Although xbuild's F# support seems to be immature, someone has managed to build F# projects with xbuild on Linux . 尽管xbuild的F#支持似乎还不成熟,但有人已经设法在Linux上使用xbuild构建F#项目 Hopefully, it is helpful for you to set up the build environment on Mac. 希望您在Mac上设置构建环境很有帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM