-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.ps1
58 lines (52 loc) · 1.6 KB
/
build.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
param ([string] $Target = "build")
Import-Module PSBuild
$FSharpCompiler = "fsc"
$FSharpParams = @("--nologo", "--nowarn:82")
$OutputLibrary = "solar.dll"
$OutputBinary = "solar-bin.exe"
$OutputStandaloneBinary = "solar-standalone.exe"
$OutputDir = "Build"
$Files = @(
'improvements.fs'
'constants.fs'
'vector.fs'
'body.fs'
'physics.fs'
'graphics.fs'
'xml.fs'
'keymap.fs'
)
$Main = "main.fs"
$Targets = @{
'build' =
New-Target -Comment "building executable $OutputBinary" `
-Depends @("build-lib") {
New-Item -Type Directory -Force $OutputDir | Out-Null
& $FSharpCompiler `
-r (Join-Path $OutputDir $OutputLibrary) `
$Main `
-o (Join-Path $OutputDir $OutputBinary) `
$FSharpParams
};
'build-standalone' =
New-Target -Comment "building standalone executable $OutputStandaloneBinary" `
-Depends @("build-lib") {
& $FSharpCompiler `
-r (Join-Path $OutputDir $OutputLibrary) `
$Main `
-o (Join-Path $OutputDir $OutputStandaloneBinary) `
$FSharpParams --standalone
};
'build-lib' =
New-Target -Comment "building library $OutputLibrary" {
& $FSharpCompiler `
$Files -a `
-o (Join-Path $OutputDir $OutputLibrary) `
$FSharpParams
};
'clean' =
New-Target -Comment "removing $OutputDir" {
Remove-Item -Confirm -Recurse $OutputDir
}
}
Start-Building $Target $Targets